Re: [PATCH] synchronize_irq needs a barrier

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Wednesday, October 17, 2007 - 7:12 pm

On Thu, 18 Oct 2007, Benjamin Herrenschmidt wrote:

So, what exactly does it protect against? At a minimum, this needs a 
comment in the changelog, and probably preferably in the source code too.

The thing is, synchronize_irq() can only protect against interrupts that 
are *already*running* on another CPU, and the caller must have made sure 
that no new interrupts are coming in (or at least that whatever new 
interrupts that come in will not pick up a certain piece of data). 

So I can imagine that the smb_mb() is there so that the caller - who has 
cleared some list or done something like that - will have any preceding 
writes that it did be serialized with actually checking the old state of 
"desc->status".

Fair enough - I can see that a smp_mb() is useful. But I think it needs 
documenting as such, and preferably with an example of how this actually 
happened in the first place (do you have one?)

The synchronize_irq() users that are really fundamental (ie the irq 
datastructures themselves) all should use the irq descriptor spinlock, and 
should *not* be needing any of this, since they would have serialized with 
whoever actually set the IRQ_INPROGRESS bit in the first place.

So in *that* sense, I think the memory barrier is useless, and I can't 
make up my mind whether it's good or bad. Which is why I'd really like to 
have an example scenario spelled out where it makes a difference..

Ok?

		Linus
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Wed Oct 17, 6:25 pm)
Re: [PATCH] synchronize_irq needs a barrier, Andrew Morton, (Wed Oct 17, 6:45 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Wed Oct 17, 6:55 pm)
Re: [PATCH] synchronize_irq needs a barrier, Linus Torvalds, (Wed Oct 17, 7:12 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Wed Oct 17, 7:40 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Wed Oct 17, 7:57 pm)
Re: [PATCH] synchronize_irq needs a barrier, Herbert Xu, (Thu Oct 18, 7:35 am)
Re: [PATCH] synchronize_irq needs a barrier, Herbert Xu, (Thu Oct 18, 7:56 am)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 2:35 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 3:05 pm)
Re: [PATCH] synchronize_irq needs a barrier, Linus Torvalds, (Thu Oct 18, 3:52 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 4:17 pm)
Re: [PATCH] synchronize_irq needs a barrier, Linus Torvalds, (Thu Oct 18, 4:39 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 4:52 pm)
Re: [PATCH] synchronize_irq needs a barrier, Herbert Xu, (Thu Oct 18, 7:32 pm)
Re: [PATCH] synchronize_irq needs a barrier, Nick Piggin, (Thu Oct 18, 7:52 pm)
Re: [PATCH] synchronize_irq needs a barrier, Linus Torvalds, (Thu Oct 18, 7:55 pm)
Re: [PATCH] synchronize_irq needs a barrier, Linus Torvalds, (Thu Oct 18, 8:26 pm)
Re: [PATCH] synchronize_irq needs a barrier, Herbert Xu, (Thu Oct 18, 8:28 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 9:11 pm)
Re: [PATCH] synchronize_irq needs a barrier, Herbert Xu, (Thu Oct 18, 9:20 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 9:26 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 9:29 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 9:35 pm)
Re: [PATCH] synchronize_irq needs a barrier, Herbert Xu, (Thu Oct 18, 9:48 pm)
Re: [PATCH] synchronize_irq needs a barrier, Nick Piggin, (Thu Oct 18, 9:49 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Thu Oct 18, 9:58 pm)
[NET]: Fix possible dev_deactivate race condition, Herbert Xu, (Thu Oct 18, 10:36 pm)
Re: [NET]: Fix possible dev_deactivate race condition, David Miller, (Thu Oct 18, 10:38 pm)
Re: [PATCH] synchronize_irq needs a barrier, Herbert Xu, (Thu Oct 18, 10:53 pm)
Re: [NET]: Fix possible dev_deactivate race condition, Peter Zijlstra, (Fri Oct 19, 12:35 am)
Re: [PATCH] synchronize_irq needs a barrier, Maxim Levitsky, (Fri Oct 19, 7:02 pm)
Re: [PATCH] synchronize_irq needs a barrier, Linus Torvalds, (Fri Oct 19, 7:25 pm)
Re: [PATCH] synchronize_irq needs a barrier, Maxim Levitsky, (Fri Oct 19, 8:10 pm)
Re: [PATCH] synchronize_irq needs a barrier, Herbert Xu, (Fri Oct 19, 8:37 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Fri Oct 19, 8:56 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Fri Oct 19, 9:04 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Fri Oct 19, 9:06 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Fri Oct 19, 9:09 pm)
Re: [PATCH] synchronize_irq needs a barrier, Maxim Levitsky, (Fri Oct 19, 9:24 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Fri Oct 19, 10:04 pm)
Re: [PATCH] synchronize_irq needs a barrier, Maxim Levitsky, (Fri Oct 19, 10:36 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Fri Oct 19, 10:46 pm)
Re: [PATCH] synchronize_irq needs a barrier, Maxim Levitsky, (Fri Oct 19, 11:06 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Fri Oct 19, 11:13 pm)
Re: [PATCH] synchronize_irq needs a barrier, Benjamin Herrenschmidt, (Sun Oct 21, 2:10 pm)
[IRQ]: Fix synchronize_irq races with IRQ handler, Herbert Xu, (Mon Oct 22, 8:26 pm)