linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <patch-notifications@ellerman.id.au>
To: Paul Mackerras <paulus@ozlabs.org>, linuxppc-dev@ozlabs.org
Cc: "Shreyas B. Prabhu" <shreyas@linux.vnet.ibm.com>
Subject: Re: [2/2] powerpc/64: Fix race condition in setting lock bit in idle/wakeup code
Date: Wed, 26 Oct 2016 21:21:07 +1100 (AEDT)	[thread overview]
Message-ID: <3t3mJM26lwz9svs@ozlabs.org> (raw)
In-Reply-To: <20161021090417.GB3809@fergus.ozlabs.ibm.com>

On Fri, 2016-21-10 at 09:04:17 UTC, Paul Mackerras wrote:
> This fixes a race condition where one thread that is entering or
> leaving a power-saving state can inadvertently ignore the lock bit
> that was set by another thread, and potentially also clear it.
> The core_idle_lock_held function is called when the lock bit is
> seen to be set.  It polls the lock bit until it is clear, then
> does a lwarx to load the word containing the lock bit and thread
> idle bits so it can be updated.  However, it is possible that the
> value loaded with the lwarx has the lock bit set, even though an
> immediately preceding lwz loaded a value with the lock bit clear.
> If this happens then we go ahead and update the word despite the
> lock bit being set, and when called from pnv_enter_arch207_idle_mode,
> we will subsequently clear the lock bit.
> 
> No identifiable misbehaviour has been attributed to this race.
> 
> This fixes it by checking the lock bit in the value loaded by the
> lwarx.  If it is set then we just go back and keep on polling.
> 
> Fixes: b32aadc1a8ed
> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>

Applied to powerpc fixes, thanks.

I added: Cc: stable@vger.kernel.org # v4.2+

https://git.kernel.org/powerpc/c/09b7e37b18eecc1e347f4b1a3bc863

cheers

  parent reply	other threads:[~2016-10-26 10:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-21  9:03 [PATCH 1/2] powerpc/64: Re-fix race condition between going idle and entering guest Paul Mackerras
2016-10-21  9:04 ` [PATCH 2/2] powerpc/64: Fix race condition in setting lock bit in idle/wakeup code Paul Mackerras
2016-10-25 11:46   ` Gautham R Shenoy
2016-10-26 10:21   ` Michael Ellerman [this message]
2016-10-21 12:32 ` [PATCH 1/2] powerpc/64: Re-fix race condition between going idle and entering guest Shreyas B. Prabhu
2016-10-25 10:24 ` Gautham R Shenoy
2016-10-26 10:21 ` [1/2] " Michael Ellerman

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=3t3mJM26lwz9svs@ozlabs.org \
    --to=patch-notifications@ellerman.id.au \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@ozlabs.org \
    --cc=shreyas@linux.vnet.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).