From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Sam Bobroff <sam.bobroff@au1.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Greg Kurz <gkurz@linux.vnet.ibm.com>
Subject: [PATCH 4.0 22/22] powerpc/powernv: Restore non-volatile CRs after nap
Date: Fri, 26 Jun 2015 18:09:04 -0700 [thread overview]
Message-ID: <20150627010854.851142361@linuxfoundation.org> (raw)
In-Reply-To: <20150627010854.064848055@linuxfoundation.org>
4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sam Bobroff <sam.bobroff@au1.ibm.com>
commit 0aab3747091db309b8a484cfd382a41644552aa3 upstream.
Patches 7cba160ad "powernv/cpuidle: Redesign idle states management"
and 77b54e9f2 "powernv/powerpc: Add winkle support for offline cpus"
use non-volatile condition registers (cr2, cr3 and cr4) early in the system
reset interrupt handler (system_reset_pSeries()) before it has been determined
if state loss has occurred. If state loss has not occurred, control returns via
the power7_wakeup_noloss() path which does not restore those condition
registers, leaving them corrupted.
Fix this by restoring the condition registers in the power7_wakeup_noloss()
case.
This is apparent when running a KVM guest on hardware that does not
support winkle or sleep and the guest makes use of secondary threads. In
practice this means Power7 machines, though some early unreleased Power8
machines may also be susceptible.
The secondary CPUs are taken off line before the guest is started and
they call pnv_smp_cpu_kill_self(). This checks support for sleep
states (in this case there is no support) and power7_nap() is called.
When the CPU is woken, power7_nap() returns and because the CPU is
still off line, the main while loop executes again. The sleep states
support test is executed again, but because the tested values cannot
have changed, the compiler has optimized the test away and instead we
rely on the result of the first test, which has been left in cr3
and/or cr4. With the result overwritten, the wrong branch is taken and
power7_winkle() is called on a CPU that does not support it, leading
to it stalling.
Fixes: 7cba160ad789 ("powernv/cpuidle: Redesign idle states management")
Fixes: 77b54e9f213f ("powernv/powerpc: Add winkle support for offline cpus")
[mpe: Massage change log a bit more]
Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Cc: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/powerpc/kernel/idle_power7.S | 2 ++
1 file changed, 2 insertions(+)
--- a/arch/powerpc/kernel/idle_power7.S
+++ b/arch/powerpc/kernel/idle_power7.S
@@ -500,9 +500,11 @@ BEGIN_FTR_SECTION
CHECK_HMI_INTERRUPT
END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
ld r1,PACAR1(r13)
+ ld r6,_CCR(r1)
ld r4,_MSR(r1)
ld r5,_NIP(r1)
addi r1,r1,INT_FRAME_SIZE
+ mtcr r6
mtspr SPRN_SRR1,r4
mtspr SPRN_SRR0,r5
rfid
next prev parent reply other threads:[~2015-06-27 1:09 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-27 1:08 [PATCH 4.0 00/22] 4.0.7-stable review Greg Kroah-Hartman
2015-06-27 1:08 ` [PATCH 4.0 01/22] crypto: caam - improve initalization for context state saves Greg Kroah-Hartman
2015-06-27 1:08 ` [PATCH 4.0 02/22] crypto: caam - fix RNG buffer cache alignment Greg Kroah-Hartman
2015-06-27 1:08 ` [PATCH 4.0 04/22] clk: at91: pll: fix input range validity check Greg Kroah-Hartman
2015-06-27 1:08 ` [PATCH 4.0 05/22] clk: at91: fix h32mx prototype inclusion in pmc header Greg Kroah-Hartman
2015-06-27 1:08 ` [PATCH 4.0 06/22] ALSA: hda - adding a DAC/pin preference map for a HP Envy TS machine Greg Kroah-Hartman
2015-06-27 1:08 ` [PATCH 4.0 07/22] tracing: Have filter check for balanced ops Greg Kroah-Hartman
2015-06-27 1:08 ` [PATCH 4.0 08/22] iser-target: Fix variable-length response error completion Greg Kroah-Hartman
2015-06-27 1:08 ` [PATCH 4.0 09/22] iser-target: Fix possible use-after-free Greg Kroah-Hartman
2015-06-27 1:08 ` [PATCH 4.0 10/22] drm/mgag200: Reject non-character-cell-aligned mode widths Greg Kroah-Hartman
2015-06-27 1:08 ` [PATCH 4.0 11/22] drm/i915: Always reset vma->ggtt_view.pages cache on unbinding Greg Kroah-Hartman
2015-06-27 1:08 ` [PATCH 4.0 14/22] ath3k: Add support of 0489:e076 AR3012 device Greg Kroah-Hartman
2015-06-27 1:08 ` [PATCH 4.0 15/22] ath3k: add support of 13d3:3474 " Greg Kroah-Hartman
2015-06-27 1:08 ` [PATCH 4.0 17/22] cdc-acm: Add support of ATOL FPrint fiscal printers Greg Kroah-Hartman
2015-06-27 1:09 ` [PATCH 4.0 18/22] ARM: EXYNOS: Fix failed second suspend on Exynos4 Greg Kroah-Hartman
2015-06-27 1:09 ` [PATCH 4.0 19/22] kprobes/x86: Return correct length in __copy_instruction() Greg Kroah-Hartman
2015-06-27 1:09 ` [PATCH 4.0 20/22] dm: fix NULL pointer when clone_and_map_rq returns !DM_MAPIO_REMAPPED Greg Kroah-Hartman
2015-06-27 1:09 ` [PATCH 4.0 21/22] drm/i915: Avoid GPU hang when coming out of s3 or s4 Greg Kroah-Hartman
2015-06-27 1:09 ` Greg Kroah-Hartman [this message]
2015-06-27 3:13 ` [PATCH 4.0 00/22] 4.0.7-stable review Shuah Khan
2015-06-27 6:07 ` Guenter Roeck
2015-06-27 9:04 ` Sudip Mukherjee
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=20150627010854.851142361@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=gkurz@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpe@ellerman.id.au \
--cc=sam.bobroff@au1.ibm.com \
--cc=stable@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;
as well as URLs for NNTP newsgroup(s).