public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: eranian@hpl.hp.com
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org
Subject: Re: [PATCH] x86_64 add missing enter_idle() calls
Date: Fri, 27 Oct 2006 09:03:44 -0700	[thread overview]
Message-ID: <200610270903.44810.ak@suse.de> (raw)
In-Reply-To: <20061025212940.GA10003@frankl.hpl.hp.com>

On Wednesday 25 October 2006 14:29, Stephane Eranian wrote:
> Andi,
>
> Looking a the exit_idle() code:
>
> static void __exit_idle(void)
> {
>         if (read_pda(isidle) == 0)
>                 return;
>         write_pda(isidle, 0);
>         atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL);
> }
>
> I am wondering whether you are exposed to a race condition  w.r.t. to
> interrupts. Supposed you are in idle, you get an interrupt and you execute
> __exit_idle(), the test evaluate to false but before you can change the
> value of isidle, you get a higher priority interrupt which then also calls
> __exit_idle(), the test is still false and you invoke the notifier, when
> you return from this interrupt you also clear the isidle, but you call the
> notifier yet a second time.
>
> I think that isidle needs to be test_and_clear atomically for this to
> guarantee only one call the notifier on __exit_idle().
>
> what do you think?

Agreed. I will fix that. Thanks

-Andi

      reply	other threads:[~2006-10-27 16:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-06  8:16 [PATCH] x86_64 add missing enter_idle() calls Stephane Eranian
2006-10-16 10:08 ` Andi Kleen
2006-10-16 14:13   ` Stephane Eranian
2006-10-16 14:36     ` Andi Kleen
2006-10-16 14:44       ` Stephane Eranian
2006-10-17 16:47       ` Stephane Eranian
2006-10-21  9:18       ` Stephane Eranian
2006-10-21 13:22         ` Andi Kleen
2006-10-24 10:00           ` Stephane Eranian
2006-10-25 21:29           ` Stephane Eranian
2006-10-27 16:03             ` Andi Kleen [this message]

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=200610270903.44810.ak@suse.de \
    --to=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=eranian@hpl.hp.com \
    --cc=linux-kernel@vger.kernel.org \
    /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