Re: [Xen-devel] [PATCH v3 4/4] x86/asm: Rewrite sync_core() to use IRET-to-self

2016-12-06 Thread H. Peter Anvin
On 12/06/16 00:46, Jan Beulich wrote: >> + >> +#ifdef CONFIG_X86_32 >> +asm volatile ( >> +"pushfl\n\t" >> +"pushl %%cs\n\t" >> +"pushl $1f\n\t" >> +"iret\n\t" >> +"1:" >> +: "+r" (__sp) : : "cc", "memory"); > > I don't

Re: [Xen-devel] [PATCH v3 4/4] x86/asm: Rewrite sync_core() to use IRET-to-self

2016-12-06 Thread Andy Lutomirski
On Mon, Dec 5, 2016 at 11:52 PM, Borislav Petkov wrote: > On Mon, Dec 05, 2016 at 01:32:43PM -0800, Andy Lutomirski wrote: >> Aside from being excessively slow, CPUID is problematic: Linux runs >> on a handful of CPUs that don't have CPUID. Use IRET-to-self >> instead.

Re: [Xen-devel] [PATCH v3 4/4] x86/asm: Rewrite sync_core() to use IRET-to-self

2016-12-06 Thread Andy Lutomirski
On Tue, Dec 6, 2016 at 1:49 AM, Jan Beulich wrote: On 06.12.16 at 10:25, wrote: >> On Tue, Dec 06, 2016 at 01:46:37AM -0700, Jan Beulich wrote: >>> > + asm volatile ( >>> > + "pushfl\n\t" >>> > + "pushl %%cs\n\t" >>> > +

Re: [Xen-devel] [PATCH v3 4/4] x86/asm: Rewrite sync_core() to use IRET-to-self

2016-12-06 Thread Jan Beulich
>>> On 06.12.16 at 10:25, wrote: > On Tue, Dec 06, 2016 at 01:46:37AM -0700, Jan Beulich wrote: >> > + asm volatile ( >> > + "pushfl\n\t" >> > + "pushl %%cs\n\t" >> > + "pushl $1f\n\t" >> > + "iret\n\t" >> > + "1:" >> > +

Re: [Xen-devel] [PATCH v3 4/4] x86/asm: Rewrite sync_core() to use IRET-to-self

2016-12-06 Thread Peter Zijlstra
On Tue, Dec 06, 2016 at 01:46:37AM -0700, Jan Beulich wrote: > > + asm volatile ( > > + "pushfl\n\t" > > + "pushl %%cs\n\t" > > + "pushl $1f\n\t" > > + "iret\n\t" > > + "1:" > > + : "+r" (__sp) : : "cc", "memory"); > > I don't thing

Re: [Xen-devel] [PATCH v3 4/4] x86/asm: Rewrite sync_core() to use IRET-to-self

2016-12-06 Thread Jan Beulich
>>> On 05.12.16 at 22:32, wrote: > static inline void sync_core(void) > { > - int tmp; > - > -#ifdef CONFIG_X86_32 > /* > - * Do a CPUID if available, otherwise do a jump. The jump > - * can conveniently enough be the jump around CPUID. > + * There are

Re: [Xen-devel] [PATCH v3 4/4] x86/asm: Rewrite sync_core() to use IRET-to-self

2016-12-05 Thread Borislav Petkov
On Mon, Dec 05, 2016 at 01:32:43PM -0800, Andy Lutomirski wrote: > Aside from being excessively slow, CPUID is problematic: Linux runs > on a handful of CPUs that don't have CPUID. Use IRET-to-self > instead. IRET-to-self works everywhere, so it makes testing easy. > > For reference, On my

[Xen-devel] [PATCH v3 4/4] x86/asm: Rewrite sync_core() to use IRET-to-self

2016-12-05 Thread Andy Lutomirski
Aside from being excessively slow, CPUID is problematic: Linux runs on a handful of CPUs that don't have CPUID. Use IRET-to-self instead. IRET-to-self works everywhere, so it makes testing easy. For reference, On my laptop, IRET-to-self is ~110ns, CPUID(eax=1, ecx=0) is ~83ns on native and very