Re: [PATCH v3] x86/cpu: Use SERIALIZE in sync_core() when available

2020-08-06 Thread Ricardo Neri
On Thu, Aug 06, 2020 at 04:08:47PM -0700, Dave Hansen wrote: > On 8/6/20 4:04 PM, Ricardo Neri wrote: > > * CPUID is the conventional way, but it's nasty: it doesn't > > * exist on some 486-like CPUs, and it usually exits to a > > * hypervisor. > > * > > * The SERIALIZE

Re: [PATCH v3] x86/cpu: Use SERIALIZE in sync_core() when available

2020-08-06 Thread Dave Hansen
On 8/6/20 4:04 PM, Ricardo Neri wrote: >* CPUID is the conventional way, but it's nasty: it doesn't >* exist on some 486-like CPUs, and it usually exits to a >* hypervisor. >* >* The SERIALIZE instruction is the most straightforward way to >* do this

Re: [PATCH v3] x86/cpu: Use SERIALIZE in sync_core() when available

2020-08-06 Thread Ricardo Neri
On Thu, Aug 06, 2020 at 12:57:26PM -0700, Dave Hansen wrote: > On 8/6/20 12:25 PM, Ricardo Neri wrote: > > static inline void sync_core(void) > > { > > /* > > -* There are quite a few ways to do this. IRET-to-self is nice > > +* Hardware can do this for us if SERIALIZE is available.

Re: [PATCH v3] x86/cpu: Use SERIALIZE in sync_core() when available

2020-08-06 Thread Dave Hansen
On 8/6/20 12:25 PM, Ricardo Neri wrote: > static inline void sync_core(void) > { > /* > - * There are quite a few ways to do this. IRET-to-self is nice > + * Hardware can do this for us if SERIALIZE is available. Otherwise, > + * there are quite a few ways to do this.

[PATCH v3] x86/cpu: Use SERIALIZE in sync_core() when available

2020-08-06 Thread Ricardo Neri
The SERIALIZE instruction gives software a way to force the processor to complete all modifications to flags, registers and memory from previous instructions and drain all buffered writes to memory before the next instruction is fetched and executed. Thus, it serves the purpose of sync_core(). Use