Re: [PATCH v6 2/3] CPU hotplug, stop-machine: Plug race-window that leads to "IPI-to-offline-CPU"

From: Peter Zijlstra
Date: Fri May 23 2014 - 11:31:30 EST


On Fri, May 23, 2014 at 08:48:07PM +0530, Srivatsa S. Bhat wrote:
> On 05/23/2014 08:42 PM, Peter Zijlstra wrote:
> > On Fri, May 23, 2014 at 08:15:35PM +0530, Srivatsa S. Bhat wrote:
> >>>> + * During CPU offline, we don't want the other CPUs to send
> >>>> + * IPIs to the active_cpu (the outgoing CPU) *after* it has
> >>>> + * disabled interrupts (because, then it will notice the IPIs
> >>>> + * only after it has gone offline). We can prevent this by
> >>>> + * making the other CPUs disable their interrupts first - that
> >>>> + * way, they will run the stop-machine code with interrupts
> >>>> + * disabled, and hence won't send IPIs after that point.
> >
> > That's complete nonsense, you can send IPIs all you want with interrupts
> > disabled.
> >
>
> True, but that's not what the comment says. It says "you can't send IPIs
> because you are running the *stop-machine* loop, because the stop-machine loop
> doesn't send IPIs itself! The only possibility of sending IPIs from within
> stop-machine is if that CPU can takes an interrupt and the *interrupt handler*
> sends the IPI (like what the block layer used to do) - and we precisely avoid
> that possibility by disabling interrupts. So no IPIs will be sent beyond
> this point.

but one of those CPUs is running the stop machine function, which calls
CPU_DYING which runs all kinds of nonsense and therefore can send IPIs
all it wants, right?

Attachment: pgp6aaUTGK6yJ.pgp
Description: PGP signature