[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <19f34abd0805231010j54c20e5ge70dc5020e825bf6@mail.gmail.com>
Date: Fri, 23 May 2008 19:10:58 +0200
From: "Vegard Nossum" <vegard.nossum@...il.com>
To: "Johannes Weiner" <hannes@...urebad.de>
Cc: "Ingo Molnar" <mingo@...e.hu>,
"Pekka Enberg" <penberg@...helsinki.fi>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kmemcheck: SMP support
On Fri, May 23, 2008 at 6:09 PM, Johannes Weiner <hannes@...urebad.de> wrote:
> Hi Vegard,
>
> Vegard Nossum <vegard.nossum@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists