Re: BUG: spinlock bad magic on CPU#0, migration/0/9
From: Oleg Nesterov
Date: Sat Feb 14 2015 - 09:03:45 EST
On 02/14, Nicholas Mc Guire wrote:
>
> Basically if you call wait_for_completion_timeout and the timeout condition
> occures you always need some way of notifying the completing end that it
> should no longer call complete()/complete_all().
Sure. "struct completion" doesn't differ from any other object when it comes
to use-after-free.
> > OK, perhaps you can ack the fix I sent?
>
> the only question I still have is that there would be no matching
> smp_wmb() to the smp_rmb() you are using (atleast I did not figure out where).
You seem to assume that every rmb() must be paired with wmb(). This is not
always true.
But as for completion_done(), its rmb() pairs with "release" semantics of
complete()->spin_unlock(), which is a "one way" barrier.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/