linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH, v2] powerpc: fix hardware PMU exception bug on PowerVM compatibility mode systems
@ 2020-02-27 13:47 Desnes A. Nunes do Rosario
  2020-02-27 15:25 ` Leonardo Bras
  2020-03-06  0:11 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Desnes A. Nunes do Rosario @ 2020-02-27 13:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: desnesn, gromero, leonardo

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")
Signed-off-by: Desnes A. Nunes do Rosario <desnesn@linux.ibm.com>
---
 arch/powerpc/kernel/cputable.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index e745abc5457a..245be4fafe13 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -2193,11 +2193,13 @@ static struct cpu_spec * __init setup_cpu_spec(unsigned long offset,
 		 * oprofile_cpu_type already has a value, then we are
 		 * possibly overriding a real PVR with a logical one,
 		 * and, in that case, keep the current value for
-		 * oprofile_cpu_type.
+		 * oprofile_cpu_type. Futhermore, let's ensure that the
+		 * fix for the PMAO bug is enabled on compatibility mode.
 		 */
 		if (old.oprofile_cpu_type != NULL) {
 			t->oprofile_cpu_type = old.oprofile_cpu_type;
 			t->oprofile_type = old.oprofile_type;
+			t->cpu_features |= old.cpu_features & CPU_FTR_PMAO_BUG;
 		}
 	}
 
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH, v2] powerpc: fix hardware PMU exception bug on PowerVM compatibility mode systems
  2020-02-27 13:47 [PATCH, v2] powerpc: fix hardware PMU exception bug on PowerVM compatibility mode systems Desnes A. Nunes do Rosario
@ 2020-02-27 15:25 ` Leonardo Bras
  2020-03-06  0:11 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Leonardo Bras @ 2020-02-27 15:25 UTC (permalink / raw)
  To: Desnes A. Nunes do Rosario, linuxppc-dev; +Cc: gromero

[-- Attachment #1: Type: text/plain, Size: 1630 bytes --]

On Thu, 2020-02-27 at 10:47 -0300, Desnes A. Nunes do Rosario wrote:
> 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")
> Signed-off-by: Desnes A. Nunes do Rosario <desnesn@linux.ibm.com>
> ---
>  arch/powerpc/kernel/cputable.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
> index e745abc5457a..245be4fafe13 100644
> --- a/arch/powerpc/kernel/cputable.c
> +++ b/arch/powerpc/kernel/cputable.c
> @@ -2193,11 +2193,13 @@ static struct cpu_spec * __init setup_cpu_spec(unsigned long offset,
>  		 * oprofile_cpu_type already has a value, then we are
>  		 * possibly overriding a real PVR with a logical one,
>  		 * and, in that case, keep the current value for
> -		 * oprofile_cpu_type.
> +		 * oprofile_cpu_type. Futhermore, let's ensure that the
> +		 * fix for the PMAO bug is enabled on compatibility mode.
>  		 */
>  		if (old.oprofile_cpu_type != NULL) {
>  			t->oprofile_cpu_type = old.oprofile_cpu_type;
>  			t->oprofile_type = old.oprofile_type;
> +			t->cpu_features |= old.cpu_features & CPU_FTR_PMAO_BUG;
>  		}
>  	}
>  

Looks good to me.

Reviewed-by: Leonardo Bras <leonardo@linux.ibm.com>

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, v2] powerpc: fix hardware PMU exception bug on PowerVM compatibility mode systems
  2020-02-27 13:47 [PATCH, v2] powerpc: fix hardware PMU exception bug on PowerVM compatibility mode systems Desnes A. Nunes do Rosario
  2020-02-27 15:25 ` Leonardo Bras
@ 2020-03-06  0:11 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2020-03-06  0:11 UTC (permalink / raw)
  To: Desnes A. Nunes do Rosario, linuxppc-dev; +Cc: leonardo, desnesn, gromero

On Thu, 2020-02-27 at 13:47:15 UTC, "Desnes A. Nunes do Rosario" wrote:
> 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")
> Signed-off-by: Desnes A. Nunes do Rosario <desnesn@linux.ibm.com>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/fc37a1632d40c80c067eb1bc235139f5867a2667

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-06  0:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-27 13:47 [PATCH, v2] powerpc: fix hardware PMU exception bug on PowerVM compatibility mode systems Desnes A. Nunes do Rosario
2020-02-27 15:25 ` Leonardo Bras
2020-03-06  0:11 ` Michael Ellerman

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).