* [PATCH] x86/alternatives: Remove double patching in ALTERNATIVE_TERNARY
@ 2022-10-08 20:14 Brian Gerst
0 siblings, 0 replies; only message in thread
From: Brian Gerst @ 2022-10-08 20:14 UTC (permalink / raw)
To: linux-kernel, x86
Cc: Thomas Gleixner, Andy Lutomirski, Borislav Petkov,
H . Peter Anvin, Peter Zijlstra, Brian Gerst
Use ALT_NOT(feature) instead of X86_FEATURE_ALWAYS to avoid patching the
code twice when the feature is present.
Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
arch/x86/include/asm/alternative.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h
index 9542c582d546..f4efce972277 100644
--- a/arch/x86/include/asm/alternative.h
+++ b/arch/x86/include/asm/alternative.h
@@ -181,7 +181,7 @@ static inline int alternatives_text_reserved(void *start, void *end)
/* If @feature is set, patch in @newinstr_yes, otherwise @newinstr_no. */
#define ALTERNATIVE_TERNARY(oldinstr, feature, newinstr_yes, newinstr_no) \
- ALTERNATIVE_2(oldinstr, newinstr_no, X86_FEATURE_ALWAYS, \
+ ALTERNATIVE_2(oldinstr, newinstr_no, ALT_NOT(feature), \
newinstr_yes, feature)
#define ALTERNATIVE_3(oldinsn, newinsn1, feat1, newinsn2, feat2, newinsn3, feat3) \
@@ -386,7 +386,7 @@ static inline int alternatives_text_reserved(void *start, void *end)
/* If @feature is set, patch in @newinstr_yes, otherwise @newinstr_no. */
#define ALTERNATIVE_TERNARY(oldinstr, feature, newinstr_yes, newinstr_no) \
- ALTERNATIVE_2 oldinstr, newinstr_no, X86_FEATURE_ALWAYS, \
+ ALTERNATIVE_2 oldinstr, newinstr_no, ALT_NOT(feature), \
newinstr_yes, feature
#endif /* __ASSEMBLY__ */
--
2.37.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-08 20:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-08 20:14 [PATCH] x86/alternatives: Remove double patching in ALTERNATIVE_TERNARY Brian Gerst
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox