Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1588403

[PATCH] powernv:idle: Fix bug due to labeling ambiguity in power_enter_stop

Path csiph.com!news.mixmin.net!aioe.org!news.servidellagleba.it!bofh.it!news.nic.it!robomod
From "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject [PATCH] powernv:idle: Fix bug due to labeling ambiguity in power_enter_stop
Date Sun, 26 Feb 2017 22:40:01 +0100
Message-ID <tfeHT-44T-19@gated-at.bofh.it> (permalink)
X-Original-To Michael Ellerman <mpe@ellerman.id.au>, Benjamin Herrenschmidt <benh@kernel.crashing.org>, Michael Neuling <mikey@neuling.org>, Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>, "Shreyas B. Prabhu" <shreyasbp@gmail.com>, Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>, Balbir Singh <bsingharora@gmail.com>, Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
X-Mailer git-send-email 1.8.3.1
X-Tm-As-Gconf 00
X-Content-Scanned Fidelis XPS MAILER
X-Cbid 17022621-0004-0000-0000-000011B27B29
X-Ibm-Spammodules-Versions BY=3.00006689; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000204; SDB=6.00827401; UDB=6.00405410; IPR=6.00604918; BA=6.00005172; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014449; XFM=3.00000011; UTC=2017-02-26 21:33:30
X-Ibm-Av-Detection SAVI=unused REMOTE=unused XFE=unused
X-Cbparentid 17022621-0005-0000-0000-00007D6703CF
X-Proofpoint-Virus-Version vendor=fsecure engine=2.50.10432:,, definitions=2017-02-26_11:,, signatures=0
X-Proofpoint-Spam-Details rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702260221
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 74
Organization linux.* mail to news gateway
X-Original-Cc linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
X-Original-Date Mon, 27 Feb 2017 03:03:07 +0530
X-Original-Message-ID <1488144787-26010-1-git-send-email-ego@linux.vnet.ibm.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1588403

Show key headers only | View raw


From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

Commit 09206b600c76 ("powernv: Pass PSSCR value and mask to
power9_idle_stop") added additional code in power_enter_stop() to
distinguish between stop requests whose PSSCR had ESL=EC=1 from those
which did not. When ESL=EC=1, we do a forward-jump to a location
labelled by "1", which had the code to handle the ESL=EC=1 case.

Unforunately just a couple of instructions before this label, is the
macro IDLE_STATE_ENTER_SEQ() which also has a label "1" in its
expansion.

As a result, the current code can result in directly executing stop
instruction for deep stop requests with PSSCR ESL=EC=1, without saving
the hypervisor state.

Fix this BUG by labeling the location that handles ESL=EC=1 case with
a more descriptive label.

For a good measure, change the label in IDLE_STATE_ENTER_SEQ() macro
to an not-so commonly used value.

Fixes: 09206b600c76 ("powernv: Pass PSSCR value and mask to
power9_idle_stop")

Cc: Michael Neuling <mikey@neuling.org>
Cc: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/cpuidle.h | 4 ++--
 arch/powerpc/kernel/idle_book3s.S  | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/cpuidle.h b/arch/powerpc/include/asm/cpuidle.h
index 31192d8..3989d94 100644
--- a/arch/powerpc/include/asm/cpuidle.h
+++ b/arch/powerpc/include/asm/cpuidle.h
@@ -85,8 +85,8 @@ static inline void report_invalid_psscr_val(u64 psscr_val, int err)
 	std	r0,0(r1);					\
 	ptesync;						\
 	ld	r0,0(r1);					\
-1:	cmpd	cr0,r0,r0;					\
-	bne	1b;						\
+236:	cmpd	cr0,r0,r0;					\
+	bne	236b;						\
 	IDLE_INST;						\
 
 #define	IDLE_STATE_ENTER_SEQ_NORET(IDLE_INST)			\
diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
index 9f6bce5..95889af 100644
--- a/arch/powerpc/kernel/idle_book3s.S
+++ b/arch/powerpc/kernel/idle_book3s.S
@@ -276,14 +276,16 @@ power_enter_stop:
  */
 	andis.   r4,r3,PSSCR_EC_ESL_MASK_SHIFTED
 	clrldi   r3,r3,60 /* r3 = Bits[60:63] = Requested Level (RL) */
-	bne	 1f
+	bne	 handle_esl_ec_set
 	IDLE_STATE_ENTER_SEQ(PPC_STOP)
 	li	r3,0  /* Since we didn't lose state, return 0 */
 	b 	pnv_wakeup_noloss
+
+handle_esl_ec_set:
 /*
  * Check if the requested state is a deep idle state.
  */
-1:	LOAD_REG_ADDRBASE(r5,pnv_first_deep_stop_state)
+	LOAD_REG_ADDRBASE(r5,pnv_first_deep_stop_state)
 	ld	r4,ADDROFF(pnv_first_deep_stop_state)(r5)
 	cmpd	r3,r4
 	bge	2f
-- 
1.8.3.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] powernv:idle: Fix bug due to labeling ambiguity in power_enter_stop "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> - 2017-02-26 22:40 +0100
  Re: [PATCH] powernv:idle: Fix bug due to labeling ambiguity in  power_enter_stop Anton Blanchard <anton@samba.org> - 2017-02-27 01:40 +0100
    Re: [PATCH] powernv:idle: Fix bug due to labeling ambiguity in  power_enter_stop Gautham R Shenoy <ego@linux.vnet.ibm.com> - 2017-02-27 08:30 +0100

csiph-web