aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2021-10-03 11:22:05 +1000
committerVasant Hegde <hegdevasant@linux.vnet.ibm.com>2021-10-19 12:08:19 +0530
commitb30fb5365fe21f60de13d08bd50524f1ead8fe54 (patch)
tree60e6d639cf2a56e6a016547e0baa9d4293aff24b /core
parent1996990f769bcb02c4eea6ef774484052ff7e68e (diff)
downloadskiboot-b30fb5365fe21f60de13d08bd50524f1ead8fe54.zip
skiboot-b30fb5365fe21f60de13d08bd50524f1ead8fe54.tar.gz
skiboot-b30fb5365fe21f60de13d08bd50524f1ead8fe54.tar.bz2
cpu: add debug check in cpu_relax
If cpu_relax() is called when not at medium SMT priority, it will lose the prior priority and return at medium. Add a debug check to catch this, which would have flagged the previous bug. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Diffstat (limited to 'core')
-rw-r--r--core/cpu.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/cpu.c b/core/cpu.c
index 5c10fc6..0f2da15 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -80,6 +80,12 @@ unsigned long __attrconst cpu_emergency_stack_top(unsigned int pir)
void __nomcount cpu_relax(void)
{
+ if ((mfspr(SPR_PPR32) >> 18) != 0x4) {
+ printf("cpu_relax called when not at medium SMT priority: "
+ "PPR[PRI]=0x%lx\n", mfspr(SPR_PPR32) >> 18);
+ backtrace();
+ }
+
/* Relax a bit to give sibling threads some breathing space */
smt_lowest();
asm volatile("nop; nop; nop; nop;\n"