public inbox for linuxppc-dev@ozlabs.org 
 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: [1/2] powerpc/64: Re-fix race condition between going idle and entering guest
Date: Wed, 26 Oct 2016 21:21:06 +1100 (AEDT)	[thread overview]
Message-ID: <3t3mJL3D45z9sf9@ozlabs.org> (raw)
In-Reply-To: <20161021090305.GA3809@fergus.ozlabs.ibm.com>

On Fri, 2016-21-10 at 09:03:05 UTC, Paul Mackerras wrote:
> Commit 8117ac6a6c2f ("powerpc/powernv: Switch off MMU before entering
> nap/sleep/rvwinkle mode", 2014-12-10) fixed a race condition where one
> thread entering a KVM guest could switch the MMU context to the guest
> while another thread was still in host kernel context with the MMU on.
> That commit moved the point where a thread entering a power-saving
> mode set its kvm_hstate.hwthread_state field in its PACA to
> KVM_HWTHREAD_IN_IDLE from a point where the MMU was on to after the
> MMU had been switched off.  That commit also added a comment
> explaining that we have to switch to real mode before setting
> hwthread_state to avoid this race.
> 
> Nevertheless, commit 4eae2c9ae54a ("powerpc/powernv: Make
> pnv_powersave_common more generic", 2016-07-08) subsequently moved
> the setting of hwthread_state back to a point where the MMU is on,
> thus reintroducing the race, despite the comment saying that this
> should not be done being included in full in the context lines of
> the patch that did it.
> 
> This fixes the race again and adds a bigger and shoutier comment
> explaining the potential race condition.
> 
> Cc: stable@vger•kernel.org # v4.8
> Fixes: 4eae2c9ae54a
> Signed-off-by: Paul Mackerras <paulus@ozlabs•org>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/56c46222af0d09149fadec2a3ce9d4

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   ` [2/2] " Michael Ellerman
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 ` Michael Ellerman [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=3t3mJL3D45z9sf9@ozlabs.org \
    --to=patch-notifications@ellerman$(echo .)id.au \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=paulus@ozlabs$(echo .)org \
    --cc=shreyas@linux$(echo .)vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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