Bug#1017425: [PATCH] x86/speculation: Avoid LFENCE in FILL_RETURN_BUFFER on CPUs that lack it

2022-08-30 Thread Salvatore Bonaccorso
Hi Martin, On Tue, Aug 30, 2022 at 03:18:51PM +0300, Martin-??ric Racine wrote: > On Tue, Aug 30, 2022 at 3:00 PM Peter Zijlstra wrote: > > On Tue, Aug 30, 2022 at 02:42:04PM +0300, Martin-??ric Racine wrote: > > > On Fri, Aug 19, 2022 at 3:15 PM Peter Zijlstra > > > wrote: > > > > > > > > On

Bug#1017425: [PATCH] x86/speculation: Avoid LFENCE in FILL_RETURN_BUFFER on CPUs that lack it

2022-08-30 Thread Martin-Éric Racine
On Tue, Aug 30, 2022 at 3:00 PM Peter Zijlstra wrote: > On Tue, Aug 30, 2022 at 02:42:04PM +0300, Martin-Éric Racine wrote: > > On Fri, Aug 19, 2022 at 3:15 PM Peter Zijlstra wrote: > > > > > > On Fri, Aug 19, 2022 at 01:38:27PM +0200, Ben Hutchings wrote: > > > > > > > So that puts the whole

Bug#1017425: [PATCH] x86/speculation: Avoid LFENCE in FILL_RETURN_BUFFER on CPUs that lack it

2022-08-30 Thread Peter Zijlstra
On Tue, Aug 30, 2022 at 02:42:04PM +0300, Martin-Éric Racine wrote: > Greetings, > > On Fri, Aug 19, 2022 at 3:15 PM Peter Zijlstra wrote: > > > > On Fri, Aug 19, 2022 at 01:38:27PM +0200, Ben Hutchings wrote: > > > > > So that puts the whole __FILL_RETURN_BUFFER inside an alternative, and > > >

Bug#1017425: [PATCH] x86/speculation: Avoid LFENCE in FILL_RETURN_BUFFER on CPUs that lack it

2022-08-30 Thread Martin-Éric Racine
Greetings, On Fri, Aug 19, 2022 at 3:15 PM Peter Zijlstra wrote: > > On Fri, Aug 19, 2022 at 01:38:27PM +0200, Ben Hutchings wrote: > > > So that puts the whole __FILL_RETURN_BUFFER inside an alternative, and > > we can't have nested alternatives. That's unfortunate. > > Well, both alternatives

Bug#1017425: [PATCH] x86/speculation: Avoid LFENCE in FILL_RETURN_BUFFER on CPUs that lack it

2022-08-19 Thread Peter Zijlstra
On Fri, Aug 19, 2022 at 01:38:27PM +0200, Ben Hutchings wrote: > So that puts the whole __FILL_RETURN_BUFFER inside an alternative, and > we can't have nested alternatives. That's unfortunate. Well, both alternatives end with the LFENCE instruction, so I could pull it out and do two consequtive

Bug#1017425: [PATCH] x86/speculation: Avoid LFENCE in FILL_RETURN_BUFFER on CPUs that lack it

2022-08-19 Thread Peter Zijlstra
On Fri, Aug 19, 2022 at 10:47:21AM +0200, Peter Zijlstra wrote: > On Fri, Aug 19, 2022 at 02:33:08AM +0200, Ben Hutchings wrote: > > From: Ben Hutchings > > > > The mitigation for PBRSB includes adding LFENCE instructions to the > > RSB filling sequence. However, RSB filling is done on some

Bug#1017425: [PATCH] x86/speculation: Avoid LFENCE in FILL_RETURN_BUFFER on CPUs that lack it

2022-08-19 Thread Ben Hutchings
On Fri, 2022-08-19 at 13:01 +0200, Peter Zijlstra wrote: > On Fri, Aug 19, 2022 at 10:47:21AM +0200, Peter Zijlstra wrote: > > On Fri, Aug 19, 2022 at 02:33:08AM +0200, Ben Hutchings wrote: > > > From: Ben Hutchings > > > > > > The mitigation for PBRSB includes adding LFENCE instructions to the

Bug#1017425: [PATCH] x86/speculation: Avoid LFENCE in FILL_RETURN_BUFFER on CPUs that lack it

2022-08-19 Thread Martin-Éric Racine
On Fri, Aug 19, 2022 at 2:01 PM Peter Zijlstra wrote: > I'm not entirly sure what to do here. On the one hand, it's 32bit, so > who gives a crap, otoh we shouldn't break these ancient chips either I > suppose. This is something that I've repeatedly had to bring up, whenever something breaks

Bug#1017425: [PATCH] x86/speculation: Avoid LFENCE in FILL_RETURN_BUFFER on CPUs that lack it

2022-08-19 Thread Ben Hutchings
On Fri, 2022-08-19 at 10:47 +0200, Peter Zijlstra wrote: > On Fri, Aug 19, 2022 at 02:33:08AM +0200, Ben Hutchings wrote: > > From: Ben Hutchings > > > > The mitigation for PBRSB includes adding LFENCE instructions to the > > RSB filling sequence. However, RSB filling is done on some older CPUs

Bug#1017425: [PATCH] x86/speculation: Avoid LFENCE in FILL_RETURN_BUFFER on CPUs that lack it

2022-08-19 Thread Peter Zijlstra
On Fri, Aug 19, 2022 at 02:33:08AM +0200, Ben Hutchings wrote: > From: Ben Hutchings > > The mitigation for PBRSB includes adding LFENCE instructions to the > RSB filling sequence. However, RSB filling is done on some older CPUs > that don't support the LFENCE instruction. > Wait; what? There

Bug#1017425: [PATCH] x86/speculation: Avoid LFENCE in FILL_RETURN_BUFFER on CPUs that lack it

2022-08-18 Thread Ben Hutchings
From: Ben Hutchings The mitigation for PBRSB includes adding LFENCE instructions to the RSB filling sequence. However, RSB filling is done on some older CPUs that don't support the LFENCE instruction. Define and use a BARRIER_NOSPEC macro which makes the LFENCE conditional on

Bug#1017425: [PATCH] x86/speculation: Avoid LFENCE in FILL_RETURN_BUFFER on CPUs that lack it

2022-08-18 Thread Ben Hutchings
The mitigation for PBRSB includes adding LFENCE instructions to the RSB filling sequence. However, RSB filling is done on some older CPUs that don't support the LFENCE instruction. Define and use a BARRIER_NOSPEC macro which makes the LFENCE conditional on X86_FEATURE_LFENCE_RDTSC, like the