x86: Disable RTM on Skylake [BZ #27398]

Message ID 20210327183417.3390361-1-hjl.tools@gmail.com
State Dropped
Headers
Series x86: Disable RTM on Skylake [BZ #27398] |

Commit Message

H.J. Lu March 27, 2021, 6:34 p.m. UTC
  Disable RTM explicitly on Skylake since CPUID may incorrectly report RTM
feature.
---
 sysdeps/x86/cpu-features.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Florian Weimer March 27, 2021, 7:15 p.m. UTC | #1
* H. J. Lu via Libc-alpha:

> Disable RTM explicitly on Skylake since CPUID may incorrectly report RTM
> feature.
> ---
>  sysdeps/x86/cpu-features.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
> index d7248cbb45..3641a48407 100644
> --- a/sysdeps/x86/cpu-features.c
> +++ b/sysdeps/x86/cpu-features.c
> @@ -518,6 +518,10 @@ init_cpu_features (struct cpu_features *cpu_features)
>  		 with stepping >= 4) to avoid TSX on kernels that weren't
>  		 updated with the latest microcode package (which disables
>  		 broken feature by default).  */
> +	    case 0x8e:
> +	    case 0x9e:
> +	      /* Disable RTM explicitly on Skylake since CPUID may report
> +		 RTM feature incorrectly [BZ #27398].  */
>  	      CPU_FEATURE_UNSET (cpu_features, RTM);
>  	      break;
>  	    }

Won't this affect the server parts as well?  I'm not sure if that's
what our users want.

We need to report the kernel bug properly, it got stalled because we
initially suspected it might be a security bug.
  
H.J. Lu March 27, 2021, 7:57 p.m. UTC | #2
On Sat, Mar 27, 2021 at 12:15 PM Florian Weimer <fw@deneb.enyo.de> wrote:
>
> * H. J. Lu via Libc-alpha:
>
> > Disable RTM explicitly on Skylake since CPUID may incorrectly report RTM
> > feature.
> > ---
> >  sysdeps/x86/cpu-features.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
> > index d7248cbb45..3641a48407 100644
> > --- a/sysdeps/x86/cpu-features.c
> > +++ b/sysdeps/x86/cpu-features.c
> > @@ -518,6 +518,10 @@ init_cpu_features (struct cpu_features *cpu_features)
> >                with stepping >= 4) to avoid TSX on kernels that weren't
> >                updated with the latest microcode package (which disables
> >                broken feature by default).  */
> > +         case 0x8e:
> > +         case 0x9e:
> > +           /* Disable RTM explicitly on Skylake since CPUID may report
> > +              RTM feature incorrectly [BZ #27398].  */
> >             CPU_FEATURE_UNSET (cpu_features, RTM);
> >             break;
> >           }
>
> Won't this affect the server parts as well?  I'm not sure if that's
> what our users want.

No since Xeon has a different model number (0x55).

> We need to report the kernel bug properly, it got stalled because we
> initially suspected it might be a security bug.
  
Florian Weimer March 27, 2021, 8:02 p.m. UTC | #3
* H. J. Lu:

> On Sat, Mar 27, 2021 at 12:15 PM Florian Weimer <fw@deneb.enyo.de> wrote:
>>
>> * H. J. Lu via Libc-alpha:
>>
>> > Disable RTM explicitly on Skylake since CPUID may incorrectly report RTM
>> > feature.
>> > ---
>> >  sysdeps/x86/cpu-features.c | 4 ++++
>> >  1 file changed, 4 insertions(+)
>> >
>> > diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
>> > index d7248cbb45..3641a48407 100644
>> > --- a/sysdeps/x86/cpu-features.c
>> > +++ b/sysdeps/x86/cpu-features.c
>> > @@ -518,6 +518,10 @@ init_cpu_features (struct cpu_features *cpu_features)
>> >                with stepping >= 4) to avoid TSX on kernels that weren't
>> >                updated with the latest microcode package (which disables
>> >                broken feature by default).  */
>> > +         case 0x8e:
>> > +         case 0x9e:
>> > +           /* Disable RTM explicitly on Skylake since CPUID may report
>> > +              RTM feature incorrectly [BZ #27398].  */
>> >             CPU_FEATURE_UNSET (cpu_features, RTM);
>> >             break;
>> >           }
>>
>> Won't this affect the server parts as well?  I'm not sure if that's
>> what our users want.
>
> No since Xeon has a different model number (0x55).

Hmm.  Xeon E3-1240 v6 has model number 158 (0x9e), too.
  
H.J. Lu March 27, 2021, 8:13 p.m. UTC | #4
On Sat, Mar 27, 2021 at 1:02 PM Florian Weimer <fw@deneb.enyo.de> wrote:
>
> * H. J. Lu:
>
> > On Sat, Mar 27, 2021 at 12:15 PM Florian Weimer <fw@deneb.enyo.de> wrote:
> >>
> >> * H. J. Lu via Libc-alpha:
> >>
> >> > Disable RTM explicitly on Skylake since CPUID may incorrectly report RTM
> >> > feature.
> >> > ---
> >> >  sysdeps/x86/cpu-features.c | 4 ++++
> >> >  1 file changed, 4 insertions(+)
> >> >
> >> > diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
> >> > index d7248cbb45..3641a48407 100644
> >> > --- a/sysdeps/x86/cpu-features.c
> >> > +++ b/sysdeps/x86/cpu-features.c
> >> > @@ -518,6 +518,10 @@ init_cpu_features (struct cpu_features *cpu_features)
> >> >                with stepping >= 4) to avoid TSX on kernels that weren't
> >> >                updated with the latest microcode package (which disables
> >> >                broken feature by default).  */
> >> > +         case 0x8e:
> >> > +         case 0x9e:
> >> > +           /* Disable RTM explicitly on Skylake since CPUID may report
> >> > +              RTM feature incorrectly [BZ #27398].  */
> >> >             CPU_FEATURE_UNSET (cpu_features, RTM);
> >> >             break;
> >> >           }
> >>
> >> Won't this affect the server parts as well?  I'm not sure if that's
> >> what our users want.
> >
> > No since Xeon has a different model number (0x55).
>
> Hmm.  Xeon E3-1240 v6 has model number 158 (0x9e), too.

Does it have RTM?
  
Florian Weimer March 27, 2021, 8:16 p.m. UTC | #5
* H. J. Lu:

>> Hmm.  Xeon E3-1240 v6 has model number 158 (0x9e), too.
>
> Does it have RTM?

Yes, it does.

Maybe we should try to track down Siddhesh's bug instead?
  
H.J. Lu March 27, 2021, 8:16 p.m. UTC | #6
On Sat, Mar 27, 2021 at 1:13 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Sat, Mar 27, 2021 at 1:02 PM Florian Weimer <fw@deneb.enyo.de> wrote:
> >
> > * H. J. Lu:
> >
> > > On Sat, Mar 27, 2021 at 12:15 PM Florian Weimer <fw@deneb.enyo.de> wrote:
> > >>
> > >> * H. J. Lu via Libc-alpha:
> > >>
> > >> > Disable RTM explicitly on Skylake since CPUID may incorrectly report RTM
> > >> > feature.
> > >> > ---
> > >> >  sysdeps/x86/cpu-features.c | 4 ++++
> > >> >  1 file changed, 4 insertions(+)
> > >> >
> > >> > diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
> > >> > index d7248cbb45..3641a48407 100644
> > >> > --- a/sysdeps/x86/cpu-features.c
> > >> > +++ b/sysdeps/x86/cpu-features.c
> > >> > @@ -518,6 +518,10 @@ init_cpu_features (struct cpu_features *cpu_features)
> > >> >                with stepping >= 4) to avoid TSX on kernels that weren't
> > >> >                updated with the latest microcode package (which disables
> > >> >                broken feature by default).  */
> > >> > +         case 0x8e:
> > >> > +         case 0x9e:
> > >> > +           /* Disable RTM explicitly on Skylake since CPUID may report
> > >> > +              RTM feature incorrectly [BZ #27398].  */
> > >> >             CPU_FEATURE_UNSET (cpu_features, RTM);
> > >> >             break;
> > >> >           }
> > >>
> > >> Won't this affect the server parts as well?  I'm not sure if that's
> > >> what our users want.
> > >
> > > No since Xeon has a different model number (0x55).
> >
> > Hmm.  Xeon E3-1240 v6 has model number 158 (0x9e), too.
>
> Does it have RTM?

It does have TSX:

https://ark.intel.com/content/www/us/en/ark/products/97469/intel-xeon-processor-e3-1240-v6-8m-cache-3-70-ghz.html

Then my patch won't work.
  
H.J. Lu March 27, 2021, 8:16 p.m. UTC | #7
On Sat, Mar 27, 2021 at 1:16 PM Florian Weimer <fw@deneb.enyo.de> wrote:
>
> * H. J. Lu:
>
> >> Hmm.  Xeon E3-1240 v6 has model number 158 (0x9e), too.
> >
> > Does it have RTM?
>
> Yes, it does.
>
> Maybe we should try to track down Siddhesh's bug instead?

Yes.
  

Patch

diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
index d7248cbb45..3641a48407 100644
--- a/sysdeps/x86/cpu-features.c
+++ b/sysdeps/x86/cpu-features.c
@@ -518,6 +518,10 @@  init_cpu_features (struct cpu_features *cpu_features)
 		 with stepping >= 4) to avoid TSX on kernels that weren't
 		 updated with the latest microcode package (which disables
 		 broken feature by default).  */
+	    case 0x8e:
+	    case 0x9e:
+	      /* Disable RTM explicitly on Skylake since CPUID may report
+		 RTM feature incorrectly [BZ #27398].  */
 	      CPU_FEATURE_UNSET (cpu_features, RTM);
 	      break;
 	    }