Skip to contentSkip to conversation

arm/nospec: Make nospec helpers always_inline

PATCH Superseded Alejandro Vallejo 4 participants 8 messages Oct 6 – Oct 7

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm/nospec: Make nospec helpers always_inline

While today they don't implement fencing in a way that would block speculation, once/if they do they'll absolutely need to be inlined, even if -fno-inline or -fno-early-inlining are passed.

---
 xen/arch/arm/include/asm/nospec.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/arm/include/asm/nospec.h +2 -2
index 51c7aea4f4..b84f8dff45 100644
@@ -4,12 +4,12 @@
 #ifndef _ASM_ARM_NOSPEC_H
 #define _ASM_ARM_NOSPEC_H
 
-static inline bool evaluate_nospec(bool condition)
+static always_inline bool evaluate_nospec(bool condition)
 {
     return condition;
 }
 
-static inline void block_speculation(void)
+static always_inline void block_speculation(void)
 {
 }
 

base-commit: 290959692726bed9a9404fbb151767dba9928c5b

Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Alejandro Vallejo

While today they don't implement fencing in a way that would block speculation, once/if they do they'll absolutely need to be inlined, even if -fno-inline or -fno-early-inlining are passed.

but this should be done for Arm, RISCV and PPC at once in which case you can keep my tag for v2 # for Arm.

~Michal

#2 lore raw
Quoted 11 lines · Michal
Quoted 5 lines · Alejandro Vallejo

While today they don't implement fencing in a way that would block speculation, once/if they do they'll absolutely need to be inlined, even if -fno-inline or -fno-early-inlining are passed.

but this should be done for Arm, RISCV and PPC at once in which case you can keep my tag for v2 # for Arm.

I previously had a patch series which made this all common, for these kinds of reasons.

I think I'd prefer to kick that over the line, than to keep on taking micro-bugfixes like this.

~Andrew

#3 lore raw
Quoted 10 lines · Andrew Cooper
Quoted 9 lines · Michal
Quoted 5 lines · Alejandro Vallejo

While today they don't implement fencing in a way that would block speculation, once/if they do they'll absolutely need to be inlined, even if -fno-inline or -fno-early-inlining are passed.

Quoted 8 lines
Quoted 2 lines

but this should be done for Arm, RISCV and PPC at once in which case you can keep my tag for v2 # for Arm.

I previously had a patch series which made this all common, for these kinds of reasons.

I think I'd prefer to kick that over the line, than to keep on taking micro-bugfixes like this.

for reference:

    https://lore.kernel.org/all/[email protected]/

I wouldn't mind that, I can R-by it if you resend it. I'll still send a v2 of this on the grounds that it's a strict improvement over existing matters and might land faster.

Cheers,
Alejandro

Quoted 2 lines

~Andrew

#4 lore raw
In reply to Orzel, Michal
Quoted 7 lines · Michal
Quoted 4 lines · Alejandro Vallejo

While today they don't implement fencing in a way that would block speculation, once/if they do they'll absolutely need to be inlined, even if -fno-inline or -fno-early-inlining are passed.

Quoted 5 lines
Quoted 1 line

but this should be done for Arm, RISCV and PPC at once in which case you can keep my tag for v2 # for Arm.

Neither RISCV nor PPC implement nospec.h today. Should I considered the R-by just settled for this patch?

Cheers,
Alejandro

Quoted 2 lines

~Michal

#5 lore raw
Quoted 8 lines · Alejandro Vallejo
Quoted 7 lines · Michal
Quoted 4 lines · Alejandro Vallejo

While today they don't implement fencing in a way that would block speculation, once/if they do they'll absolutely need to be inlined, even if -fno-inline or -fno-early-inlining are passed.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

but this should be done for Arm, RISCV and PPC at once in which case you can keep my tag for v2 # for Arm.

Neither RISCV nor PPC implement nospec.h today. Should I considered the R-by just settled for this patch?

I'm not sure I understand. You wrote that they don't implement the header whereas I can see:
arch/riscv/include/asm/nospec.h
arch/ppc/include/asm/nospec.h
hence my remark to fix all at once.

~Michal

#6 lore raw
Quoted 17 lines · Michal
Quoted 14 lines · Alejandro Vallejo
Quoted 12 lines · Michal
Quoted 5 lines · Alejandro Vallejo

While today they don't implement fencing in a way that would block speculation, once/if they do they'll absolutely need to be inlined, even if -fno-inline or -fno-early-inlining are passed.

but this should be done for Arm, RISCV and PPC at once in which case you can keep my tag for v2 # for Arm.

Quoted 7 lines
Quoted 2 lines

Neither RISCV nor PPC implement nospec.h today. Should I considered the R-by just settled for this patch?

I'm not sure I understand. You wrote that they don't implement the header whereas I can see:
arch/riscv/include/asm/nospec.h
arch/ppc/include/asm/nospec.h
hence my remark to fix all at once.

Bah, I was on a completely different baseline than I should've been. Even v1 doesn't apply cleanly.

Let me prep a proper v2 then.

Cheers,
Alejandro

Quoted 2 lines

~Michal

#7 lore raw
In reply to Alejandro Vallejo
Quoted 3 lines · Alejandro Vallejo

While today they don't implement fencing in a way that would block speculation, once/if they do they'll absolutely need to be inlined, even if -fno-inline or -fno-early-inlining are passed.

FWIW, it's my understanding that -fno-early-inlining is not really relevant here; it disables the early inlining pass, but the late(r) one(s) is/are still present, so inlining will happen, just later in the compilation process. -fno-inline is indeed relevant here.

Thanks, Roger.