On Mon, Sep 05, 2022 at 06:35:17PM +0300, Kirill A. Shutemov wrote: > What about something like this? > > diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h > index 803241dfc473..868d2730884b 100644 > --- a/arch/x86/include/asm/uaccess.h > +++ b/arch/x86/include/asm/uaccess.h > @@ -30,8 +30,10 @@ static inline bool pagefault_disabled(void); > */ > #define untagged_addr(mm, addr) ({ \ > u64 __addr = (__force u64)(addr); \ > - s64 sign = (s64)__addr >> 63; \ > - __addr &= (mm)->context.untag_mask | sign; \ > + if (static_cpu_has(X86_FEATURE_LAM)) { \ > + s64 sign = (s64)__addr >> 63; \ > + __addr &= (mm)->context.untag_mask | sign; \ > + } \ > (__force __typeof__(addr))__addr; \ > }) Well, if you go throught the trouble of adding it, might as well use a regular static branch and only enable it once there's an actual user, no?