Skip to contentSkip to conversation

powerpc/pmu/fsl: fix is_nmi test for irq mask change

PATCH In review Nicholas Piggin 4 participants 5 messages May 10, 2018 – Jun 4, 2018 PowerPC

lore
Share & tools
lore

Nicholas Piggin

author reviewer
#0 lore raw

PATCH 1/2 powerpc/pmu/fsl: fix is_nmi test for irq mask change

When soft enabled was changed to irq disabled mask, this test missed being converted (although the equivalent book3s test was converted).

The PMU drivers consider it an NMI when they take a PMI while general interrupts are disabled. This change restores that behaviour.

Fixes 01417c6cc7 ("powerpc/64: Change soft_enabled from flag to bitmask")
---
 arch/powerpc/perf/core-fsl-emb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/perf/core-fsl-emb.c +1 -1
index 85f1d18e5fd3..ba485844d506 100644
@@ -42,7 +42,7 @@ static DEFINE_MUTEX(pmc_reserve_mutex);
 static inline int perf_intr_is_nmi(struct pt_regs *regs)
 {
 #ifdef __powerpc64__
-	return !regs->softe;
+	return (regs->softe & IRQS_DISABLED);
 #else
 	return 0;
 #endif
Signature · 1 line
2.17.0
author reviewer
#1 lore raw

PATCH 2/2 powerpc/64: change softe to irqmask in show_regs and xmon

When the soft enabled flag was changed to a soft disable mask, xmon and register dump code was not updated to reflect that, which is confusing ('SOFTE: 1' previously meant interrupts were soft enabled, currently it means the opposite, the general interrupt type has been disabled).

Fix this by using the name irqmask, and printing it in hex.

---
 arch/powerpc/kernel/process.c | 2 +-
 arch/powerpc/xmon/xmon.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/process.c +1 -1
index 1237f13fed51..52b1c379d618 100644
@@ -1437,7 +1437,7 @@ void show_regs(struct pt_regs * regs)
 		pr_cont("DAR: "REG" DSISR: %08lx ", regs->dar, regs->dsisr);
 #endif
 #ifdef CONFIG_PPC64
-	pr_cont("SOFTE: %ld ", regs->softe);
+	pr_cont("IRQMASK: %lx ", regs->softe);
 #endif
 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
 	if (MSR_TM_ACTIVE(regs->msr))
arch/powerpc/xmon/xmon.c +1 -1
index a0842f1ff72c..05f648a55fa3 100644
@@ -1636,7 +1636,7 @@ static void excprint(struct pt_regs *fp)
 
 	printf("  current = 0x%lx\n", current);
 #ifdef CONFIG_PPC64
-	printf("  paca    = 0x%lx\t softe: %d\t irq_happened: 0x%02x\n",
+	printf("  paca    = 0x%lx\t irqmask: 0x%02x\t irq_happened: 0x%02x\n",
 	       local_paca, local_paca->irq_soft_mask, local_paca->irq_happened);
 #endif
 	if (current) {
Signature · 1 line
2.17.0
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] powerpc/64: change softe to irqmask in show_regs and xmon

Quoted 10 lines · Nicholas Piggin

When the soft enabled flag was changed to a soft disable mask, xmon and register dump code was not updated to reflect that, which is confusing ('SOFTE: 1' previously meant interrupts were soft enabled, currently it means the opposite, the general interrupt type has been disabled).

Fix this by using the name irqmask, and printing it in hex.

Reviewed-by on v1 1/2
#3 lore raw
In reply to Nicholas Piggin
Quoted 5 lines · Nicholas Piggin

When soft enabled was changed to irq disabled mask, this test missed being converted (although the equivalent book3s test was converted).

The PMU drivers consider it an NMI when they take a PMI while general interrupts are disabled. This change restores that behaviour.

Looks fine to me.

Quoted 19 lines
Fixes 01417c6cc7 ("powerpc/64: Change soft_enabled from flag to bitmask")
---
  arch/powerpc/perf/core-fsl-emb.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/perf/core-fsl-emb.c +1 -1
index 85f1d18e5fd3..ba485844d506 100644
@@ -42,7 +42,7 @@ static DEFINE_MUTEX(pmc_reserve_mutex);
  static inline int perf_intr_is_nmi(struct pt_regs *regs)
  {
  #ifdef __powerpc64__
-	return !regs->softe;
+	return (regs->softe & IRQS_DISABLED);
  #else
  	return 0;
  #endif
#4 lore raw
In reply to Nicholas Piggin
Quoted 9 lines · Nicholas Piggin

When soft enabled was changed to irq disabled mask, this test missed being converted (although the equivalent book3s test was converted).

The PMU drivers consider it an NMI when they take a PMI while general interrupts are disabled. This change restores that behaviour.

Fixes 01417c6cc7 ("powerpc/64: Change soft_enabled from flag to bitmask")

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/81ea11d3af3aba0bea475dd1dd2f79

cheers