Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-22 Thread Borislav Petkov
On Thu, Jan 21, 2016 at 03:37:16PM -0800, H. Peter Anvin wrote: > Maybe a label attribute would help, I don't know. Here's another version which works, not really better though: Change is this: --- + asm_volatile_goto(ALTERNATIVE("", "jmp %l[t_fixup_ss]", +

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-22 Thread Borislav Petkov
On Thu, Jan 21, 2016 at 03:37:16PM -0800, H. Peter Anvin wrote: > Maybe a label attribute would help, I don't know. Here's another version which works, not really better though: Change is this: --- + asm_volatile_goto(ALTERNATIVE("", "jmp %l[t_fixup_ss]", +

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-21 Thread H. Peter Anvin
Maybe a label attribute would help, I don't know. -hpa

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-21 Thread H. Peter Anvin
On 01/21/16 14:56, Borislav Petkov wrote: > > so this is silly: we're basically jumping after the JMP instruction > itself. So that will be the case on !X86_BUG_SYSRET_SS_ATTRS CPUs. > Still a two-byte and now even a useless JMP. > > The right thing to do would be to generate a NOP simply. >

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-21 Thread Borislav Petkov
On Thu, Jan 21, 2016 at 02:22:28PM -0800, H. Peter Anvin wrote: > Yes, having t_no as the fallthrough case ought to move the yes code > out of line. Dunno, maybe I'm doing something wrong: I have this change: --- diff --git a/arch/x86/include/asm/cpufeature.h

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-21 Thread H. Peter Anvin
On January 21, 2016 2:14:42 PM PST, Borislav Petkov wrote: >On Wed, Jan 20, 2016 at 02:41:22AM -0800, H. Peter Anvin wrote: >> Ah. What would be even more of a win would be to rebias >> static_cpu_has_bug() so that the fallthrough case is the functional >> one. Easily done by reversing the

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-21 Thread Borislav Petkov
On Wed, Jan 20, 2016 at 02:41:22AM -0800, H. Peter Anvin wrote: > Ah. What would be even more of a win would be to rebias > static_cpu_has_bug() so that the fallthrough case is the functional > one. Easily done by reversing the labels. By reversing you mean this: --- diff --git

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-21 Thread Borislav Petkov
On Wed, Jan 20, 2016 at 02:41:22AM -0800, H. Peter Anvin wrote: > Ah. What would be even more of a win would be to rebias > static_cpu_has_bug() so that the fallthrough case is the functional > one. Easily done by reversing the labels. By reversing you mean this: --- diff --git

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-21 Thread H. Peter Anvin
Maybe a label attribute would help, I don't know. -hpa

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-21 Thread H. Peter Anvin
On January 21, 2016 2:14:42 PM PST, Borislav Petkov wrote: >On Wed, Jan 20, 2016 at 02:41:22AM -0800, H. Peter Anvin wrote: >> Ah. What would be even more of a win would be to rebias >> static_cpu_has_bug() so that the fallthrough case is the functional >> one. Easily done by

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-21 Thread H. Peter Anvin
On 01/21/16 14:56, Borislav Petkov wrote: > > so this is silly: we're basically jumping after the JMP instruction > itself. So that will be the case on !X86_BUG_SYSRET_SS_ATTRS CPUs. > Still a two-byte and now even a useless JMP. > > The right thing to do would be to generate a NOP simply. >

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-21 Thread Borislav Petkov
On Thu, Jan 21, 2016 at 02:22:28PM -0800, H. Peter Anvin wrote: > Yes, having t_no as the fallthrough case ought to move the yes code > out of line. Dunno, maybe I'm doing something wrong: I have this change: --- diff --git a/arch/x86/include/asm/cpufeature.h

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-20 Thread H. Peter Anvin
On 01/20/16 08:04, Borislav Petkov wrote: > On Wed, Jan 20, 2016 at 07:09:39AM -0800, H. Peter Anvin wrote: >> But then you're using testl and get long immediates. >> >> (And the parentheses around boot_cpu_data->x86_capability are redundant.) > > Right. > > Ok, below is what builds here. So no

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-20 Thread Borislav Petkov
On Wed, Jan 20, 2016 at 07:09:39AM -0800, H. Peter Anvin wrote: > But then you're using testl and get long immediates. > > (And the parentheses around boot_cpu_data->x86_capability are redundant.) Right. Ok, below is what builds here. So no SOBs etc. All this include hell wankery is so that we

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-20 Thread H. Peter Anvin
On 01/20/16 07:01, Borislav Petkov wrote: > On Tue, Jan 19, 2016 at 08:02:01PM -0800, H. Peter Anvin wrote: >> ... "i" (1 << (bit & 7)), >> "m" (((const char *)boot_cpu_data->x86_capability)[bit >> 3]) ... > > Nice! > > I was going to do: > > "i" (1 << (bit & 31)), >

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-20 Thread Borislav Petkov
On Tue, Jan 19, 2016 at 08:02:01PM -0800, H. Peter Anvin wrote: > ... "i" (1 << (bit & 7)), > "m" (((const char *)boot_cpu_data->x86_capability)[bit >> 3]) ... Nice! I was going to do: "i" (1 << (bit & 31)), "m"

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-20 Thread Borislav Petkov
On Tue, Jan 19, 2016 at 08:02:01PM -0800, H. Peter Anvin wrote: > ... "i" (1 << (bit & 7)), > "m" (((const char *)boot_cpu_data->x86_capability)[bit >> 3]) ... Nice! I was going to do: "i" (1 << (bit & 31)), "m"

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-20 Thread H. Peter Anvin
On 01/20/16 07:01, Borislav Petkov wrote: > On Tue, Jan 19, 2016 at 08:02:01PM -0800, H. Peter Anvin wrote: >> ... "i" (1 << (bit & 7)), >> "m" (((const char *)boot_cpu_data->x86_capability)[bit >> 3]) ... > > Nice! > > I was going to do: > > "i" (1 << (bit & 31)), >

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-20 Thread Borislav Petkov
On Wed, Jan 20, 2016 at 07:09:39AM -0800, H. Peter Anvin wrote: > But then you're using testl and get long immediates. > > (And the parentheses around boot_cpu_data->x86_capability are redundant.) Right. Ok, below is what builds here. So no SOBs etc. All this include hell wankery is so that we

Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

2016-01-20 Thread H. Peter Anvin
On 01/20/16 08:04, Borislav Petkov wrote: > On Wed, Jan 20, 2016 at 07:09:39AM -0800, H. Peter Anvin wrote: >> But then you're using testl and get long immediates. >> >> (And the parentheses around boot_cpu_data->x86_capability are redundant.) > > Right. > > Ok, below is what builds here. So no