lkml.org 
[lkml]   [2008]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2008-05-23 19:13    [W:0.105 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site