x86/asm: Use alternative_input() in amd_clear_divider()
PATCH 1/1 x86/asm: Use alternative_input() in amd_clear_divider()
Use higher-level API to declare assembly with alternatives.
bloat-o-meter reports no code size changes.
--- arch/x86/include/asm/processor.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/x86/include/asm/processor.h +3 -2
@@ -707,8 +707,9 @@ static inline u32 per_cpu_l2c_id(unsigned int cpu)*/ static __always_inline void amd_clear_divider(void) { - asm volatile(ALTERNATIVE("", "div %2\n\t", X86_BUG_DIV0) - :: "a" (0), "d" (0), "r" (1)); +alternative_input ("" ,"div %[den]" , +X86_BUG_DIV0 , + "a" (0), "d" (0), [den] "r" (1)); }extern void amd_check_microcode (void );
Signature · 1 line
2.48.1
Borislav Petkov
maintainerQuoted 10 lines · Uros Bizjak
Use higher-level API to declare assembly with alternatives.
bloat-o-meter reports no code size changes.
Signed-off-by Uros Bizjak <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc Borislav Petkov <[email protected]>Cc Dave Hansen <[email protected]>Cc "H. Peter Anvin" <[email protected]>
Quoted 3 lines
--- arch/x86/include/asm/processor.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
I'm getting tired of patches which cause unnecessary code churn. Please stop this. If it ain't broke, it doesn't need fixing!
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteH. Peter Anvin
reviewerQuoted 20 lines · Uros Bizjak
Use higher-level API to declare assembly with alternatives.
bloat-o-meter reports no code size changes.
Signed-off-by Uros Bizjak <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc Borislav Petkov <[email protected]>Cc Dave Hansen <[email protected]>Cc "H. Peter Anvin" <[email protected]>---
arch/x86/include/asm/processor.h| 5 +++--1 file changed, 3 insertions(+), 2 deletions(-)arch/x86/include/asm/processor.h +0
-0@@ -707,8 +707,9 @@ static inline u32 per_cpu_l2c_id(unsigned int cpu)*/
arch/x86/include/asm/processor.h static inline u32 per_cpu_l2c_id(unsigned int cpu) · line 715
Quoted 10 lines
arch/x86/include/asm/processor.h +3
-2static __always_inline void amd_clear_divider(void) { - asm volatile(ALTERNATIVE("", "div %2\n\t", X86_BUG_DIV0) - :: "a" (0), "d" (0), "r" (1)); +alternative_input ("" ,"div %[den]" , +X86_BUG_DIV0 , + "a" (0), "d" (0), [den] "r" (1)); }extern void amd_check_microcode (void );
I realize I'm probably in the minority, but I find these "higher-level APIs" for alternatives much harder to read and understand.
Quoted 15 lines · Borislav Petkov
Quoted 10 lines · Uros Bizjak
Use higher-level API to declare assembly with alternatives.
bloat-o-meter reports no code size changes.
Signed-off-by Uros Bizjak <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc Borislav Petkov <[email protected]>Cc Dave Hansen <[email protected]>Cc "H. Peter Anvin" <[email protected]>Quoted 3 lines
--- arch/x86/include/asm/processor.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Quoted 2 lines
I'm getting tired of patches which cause unnecessary code churn. Please stop this. If it ain't broke, it doesn't need fixing!
So why does the higher level alternative_input() API exist? If it shouldn't exist then we should remove it. If it exists, we should use it consistently instead of open-coding its equivalent.
Cleanups like this, especially if they are clearly part of an effort to improve x86 code generation in this area, are not 'code churn', why would they be?
Thanks,
Ingo
Borislav Petkov
maintainerQuoted 7 lines · Ingo Molnar
So why does the higher level
alternative_input()API exist? If it shouldn't exist then we should remove it. If it exists, we should use it consistently instead of open-coding its equivalent.Cleanups like this, especially if they are clearly part of an effort to improve x86 code generation in this area, are not 'code churn', why would they be?
Because this is not improving anything, IMO. It is simply writing it differently, perhaps obscuring it more in the process.
And I, just like hpa, would need to go look at alternative_input() to figure out what really happens there.
Dunno, maybe we should really remove alternative_input() instead...
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 10 lines · Borislav Petkov
Quoted 7 lines · Ingo Molnar
So why does the higher level
alternative_input()API exist? If it shouldn't exist then we should remove it. If it exists, we should use it consistently instead of open-coding its equivalent.Cleanups like this, especially if they are clearly part of an effort to improve x86 code generation in this area, are not 'code churn', why would they be?
Quoted 7 lines
Because this is not improving anything, IMO. It is simply writing it differently, perhaps obscuring it more in the process.
And I, just like hpa, would need to go look at
alternative_input()to figure out what really happens there.Dunno, maybe we should really remove
alternative_input()instead...
Please note that all other functions involving ALTERNATIVE in asm/processor.h use "alternative" API.
Uros.
H. Peter Anvin
reviewerQuoted 9 lines · Borislav Petkov
Quoted 7 lines · Ingo Molnar
So why does the higher level
alternative_input()API exist? If it shouldn't exist then we should remove it. If it exists, we should use it consistently instead of open-coding its equivalent.Cleanups like this, especially if they are clearly part of an effort to improve x86 code generation in this area, are not 'code churn', why would they be?
Quoted 8 lines
Because this is not improving anything, IMO. It is simply writing it differently, perhaps obscuring it more in the process.
And I, just like hpa, would need to go look at
alternative_input()to figure out what really happens there.Dunno, maybe we should really remove
alternative_input()instead...
My main beef with the "higher level" macros is that they both obscure what is going on and they have a syntax which is very different from the typical asm statement, all of which makes them harder to read. Furthermore, they don't cover all the possible ways that one can use the alternatives API – and because cpp doesn't lend itself well to handling the colon-separated groups of asm syntax – that really can't be fixed easily.