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

2020-07-28 Thread peterz
On Mon, Jul 27, 2020 at 09:41:14PM -0700, Ricardo Neri wrote: > I think I got a little lost here. Hehe, sorry. I got carried away, it's just that recently people expressed interest in 'fixing' some of the text_poke_sync() issues again. > If I understand correctly, there are > two alternatives to

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

2020-07-27 Thread Ricardo Neri
On Mon, Jul 27, 2020 at 03:30:20PM +0200, pet...@infradead.org wrote: > On Mon, Jul 27, 2020 at 03:05:36PM +0200, pet...@infradead.org wrote: > > Yeah, I'm not sure.. the 'funny' thing is that typically call > > sync_core() from an IPI anyway. And the synchronous broadcast IPI is by > > far the

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

2020-07-27 Thread Ricardo Neri
On Mon, Jul 27, 2020 at 05:47:32AM -0700, h...@zytor.com wrote: > On July 27, 2020 1:20:03 AM PDT, pet...@infradead.org wrote: > >On Sun, Jul 26, 2020 at 09:31:32PM -0700, Ricardo Neri wrote: > >> +static inline void serialize(void) > >> +{ > >> + asm volatile(".byte 0xf, 0x1, 0xe8"); > >> +} > >

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

2020-07-27 Thread Ricardo Neri
On Mon, Jul 27, 2020 at 10:20:03AM +0200, pet...@infradead.org wrote: > On Sun, Jul 26, 2020 at 09:31:32PM -0700, Ricardo Neri wrote: > > +static inline void serialize(void) > > +{ > > + asm volatile(".byte 0xf, 0x1, 0xe8"); > > +} > > Can we pretty please have a comment with the binutils

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

2020-07-27 Thread Luck, Tony
> For a really overenginered solution, but which might perform unnecessary > poorly on existing hardware: > > asm volatile("1: .byte 0xf, 0x1, 0xe8; 2:" >_ASM_EXTABLE(1b,2b)); You win the prize for the smallest code. Might need (the already large) comment to double in

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

2020-07-27 Thread peterz
On Mon, Jul 27, 2020 at 03:05:36PM +0200, pet...@infradead.org wrote: > Yeah, I'm not sure.. the 'funny' thing is that typically call > sync_core() from an IPI anyway. And the synchronous broadcast IPI is by > far the most expensive part of that. > > Something like this... > > diff --git

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

2020-07-27 Thread peterz
On Mon, Jul 27, 2020 at 05:49:28AM -0700, h...@zytor.com wrote: > On July 27, 2020 1:36:19 AM PDT, pet...@infradead.org wrote: > >On Sun, Jul 26, 2020 at 10:55:15PM -0700, h...@zytor.com wrote: > >> For a really overenginered solution, but which might perform > >> unnecessary poorly on existing

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

2020-07-27 Thread hpa
On July 27, 2020 1:36:19 AM PDT, pet...@infradead.org wrote: >On Sun, Jul 26, 2020 at 10:55:15PM -0700, h...@zytor.com wrote: >> For a really overenginered solution, but which might perform >> unnecessary poorly on existing hardware: >> >> asm volatile("1: .byte 0xf, 0x1, 0xe8; 2:" >>

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

2020-07-27 Thread hpa
On July 27, 2020 1:20:03 AM PDT, pet...@infradead.org wrote: >On Sun, Jul 26, 2020 at 09:31:32PM -0700, Ricardo Neri wrote: >> +static inline void serialize(void) >> +{ >> +asm volatile(".byte 0xf, 0x1, 0xe8"); >> +} > >Can we pretty please have a comment with the binutils version that has

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

2020-07-27 Thread peterz
On Sun, Jul 26, 2020 at 10:55:15PM -0700, h...@zytor.com wrote: > For a really overenginered solution, but which might perform > unnecessary poorly on existing hardware: > > asm volatile("1: .byte 0xf, 0x1, 0xe8; 2:" > _ASM_EXTABLE(1b,2b)); Ha! cute, you take an #UD ? We

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

2020-07-27 Thread peterz
On Sun, Jul 26, 2020 at 09:31:32PM -0700, Ricardo Neri wrote: > @@ -75,6 +77,12 @@ static inline void sync_core(void) >* Like all of Linux's memory ordering operations, this is a >* compiler barrier as well. >*/ > + > + if (boot_cpu_has(X86_FEATURE_SERIALIZE)) { > +

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

2020-07-27 Thread peterz
On Sun, Jul 26, 2020 at 09:31:32PM -0700, Ricardo Neri wrote: > +static inline void serialize(void) > +{ > + asm volatile(".byte 0xf, 0x1, 0xe8"); > +} Can we pretty please have a comment with the binutils version that has the mnomic? Such that when we increase the required binutils version

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

2020-07-27 Thread hpa
On July 26, 2020 10:55:15 PM PDT, h...@zytor.com wrote: >On July 26, 2020 9:31:32 PM PDT, Ricardo Neri > wrote: >>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

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

2020-07-26 Thread hpa
On July 26, 2020 9:31:32 PM PDT, Ricardo Neri wrote: >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

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

2020-07-26 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