mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Vegard Nossum" <vegard.nossum@gmail.com>
To: "Johannes Weiner" <hannes@saeurebad.de>
Cc: "Ingo Molnar" <mingo@elte.hu>,
	"Pekka Enberg" <penberg@cs.helsinki.fi>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kmemcheck: SMP support
Date: Fri, 23 May 2008 19:10:58 +0200	[thread overview]
Message-ID: <19f34abd0805231010j54c20e5ge70dc5020e825bf6@mail.gmail.com> (raw)
In-Reply-To: <87od6xngt7.fsf@saeurebad.de>

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

  reply	other threads:[~2008-05-23 17:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-23 14:17 Vegard Nossum
2008-05-23 15:06 ` Ingo Molnar
2008-05-23 15:30   ` Vegard Nossum
2008-05-23 16:13     ` Jeremy Fitzhardinge
2008-05-26  9:11     ` Ingo Molnar
2008-05-26  9:29     ` Avi Kivity
2008-05-23 15:40 ` Jeremy Fitzhardinge
2008-05-23 15:51   ` Vegard Nossum
2008-05-23 17:12     ` Jan Kiszka
2008-05-23 17:32       ` Vegard Nossum
2008-05-23 17:54         ` Jan Kiszka
2008-05-23 20:54         ` Jeremy Fitzhardinge
2008-05-23 16:09 ` Johannes Weiner
2008-05-23 17:10   ` Vegard Nossum [this message]
     [not found] ` <19f34abd0805230719j1ce0e2eje6da7c1f963fdf75@mail.gmail.com>
2008-05-25 14:30   ` Fwd: " Pekka Paalanen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19f34abd0805231010j54c20e5ge70dc5020e825bf6@mail.gmail.com \
    --to=vegard.nossum@gmail.com \
    --cc=hannes@saeurebad.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penberg@cs.helsinki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®