Skip to contentSkip to conversation

powerpc: fix hardware PMU exception bug on PowerVM compatibility mode systems

PATCH Superseded Desnes A. Nunes do Rosario 2 participants 2 messages Feb 14, 2020 – Feb 15, 2020 PowerPC

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: fix hardware PMU exception bug on PowerVM compatibility mode systems

PowerVM systems running compatibility mode on a few Power8 revisions are still vulnerable to the hardware defect that loses PMU exceptions arriving prior to a context switch.

The software fix for this issue is enabled through the CPU_FTR_PMAO_BUG cpu_feature bit, nevertheless this bit also needs to be set for PowerVM compatibility mode systems.

Fixes 68f2f0d431d9ea4 ("powerpc: Add a cpu feature CPU_FTR_PMAO_BUG")
---
 arch/powerpc/kernel/cputable.c | 2 ++
 1 file changed, 2 insertions(+)
arch/powerpc/kernel/cputable.c +2 -0
index e745abc5457a..5bfef6263dfb 100644
@@ -2198,6 +2198,8 @@ static struct cpu_spec * __init setup_cpu_spec(unsigned long offset,
 		if (old.oprofile_cpu_type != NULL) {
 			t->oprofile_cpu_type = old.oprofile_cpu_type;
 			t->oprofile_type = old.oprofile_type;
+			if (old.cpu_features & CPU_FTR_PMAO_BUG)
+				t->cpu_features |= CPU_FTR_PMAO_BUG;
 		}
 	}
 
Signature · 1 line
2.21.1
#1 lore raw

Hello Desnes, thanks for the patch.

Quoted 19 lines · Desnes A. Nunes do Rosario

PowerVM systems running compatibility mode on a few Power8 revisions are still vulnerable to the hardware defect that loses PMU exceptions arriving prior to a context switch.

The software fix for this issue is enabled through the CPU_FTR_PMAO_BUG cpu_feature bit, nevertheless this bit also needs to be set for PowerVM compatibility mode systems.

Fixes 68f2f0d431d9ea4 ("powerpc: Add a cpu feature CPU_FTR_PMAO_BUG")
---
 arch/powerpc/kernel/cputable.c | 2 ++
 1 file changed, 2 insertions(+)
arch/powerpc/kernel/cputable.c +0 -0
index e745abc5457a..5bfef6263dfb 100644

arch/powerpc/kernel/cputable.c static struct cpu_spec * __init setup_cpu_spec(unsigned long offset, · line 2205

Quoted 8 lines
arch/powerpc/kernel/cputable.c +2 -0
@@ -2198,6 +2198,8 @@ static struct cpu_spec * __init setup_cpu_spec(unsigned long offset,
 		if (old.oprofile_cpu_type != NULL) {
 			t->oprofile_cpu_type = old.oprofile_cpu_type;
 			t->oprofile_type = old.oprofile_type;
+			if (old.cpu_features & CPU_FTR_PMAO_BUG)
+				t->cpu_features |= CPU_FTR_PMAO_BUG;
 		}
 	}
 

What are your thoughts about doing:

        t->cpu_features |=  old.cpu_features & CPU_FTR_PMAO_BUG;

Also, I would recommend adding a short comment on top of the added lines explaining why it is needed.

Best regards,
Leonardo Bras