Messages in this thread | | | Date | Fri, 23 May 2008 19:10:58 +0200 | From | "Vegard Nossum" <> | Subject | Re: [PATCH] kmemcheck: SMP support |
| |
On Fri, May 23, 2008 at 6:09 PM, Johannes Weiner <hannes@saeurebad.de> wrote: > Hi Vegard, > > Vegard Nossum <vegard.nossum@gmail.com> writes: > >> +static void >> +resume(void) >> +{ >> +#ifdef CONFIG_SMP >> + int cpus; >> + >> + cpus = num_online_cpus() - 1; >> + >> + atomic_set(&nmi_resume, 1); >> + >> + while (atomic_read(&finished) != cpus) >> + cpu_relax(); >> +#endif >> +} > > How about merging finished and started into one? I.e. `paused'. > > The notifiers increases `paused' before the waiting-loop and decreases > it again afterwards. > > pause_allbutself() sends the IPIs and waits until `paused' reached the > number of CPUS. > > resume() justs waits until `paused' reaches zero. > > Would this work? Will the NMI handler finish even when the CPU is > removed while the handler runs?
Yup, that works perfectly. No CPU will be removed or added, since the IPI is broadcast to all CPUs and the only CPU running anything besides the NMI handler itself is waiting for the other CPUs... (At least I think this is the case. It won't change the way the code currently works I think...)
Thanks for the tip! :-)
Vegard
-- "The animistic metaphor of the bug that maliciously sneaked in while the programmer was not looking is intellectually dishonest as it disguises that the error is the programmer's own creation." -- E. W. Dijkstra, EWD1036
| |