x86/alternatives: Remove double patching in ALTERNATIVE_TERNARY
PATCH 1/1 x86/alternatives: Remove double patching in ALTERNATIVE_TERNARY
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 <[email protected]>
--- arch/x86/include/asm/alternative.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/alternative.h +2 -2
@@ -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__ */
Signature · 1 line
2.37.3