[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aKWfYo8lKmcHE14a@lx-t490>
Date: Wed, 20 Aug 2025 12:11:46 +0200
From: "Ahmed S. Darwish" <darwi@...utronix.de>
To: Marcos Del Sol Vives <marcos@...a.pet>
Cc: linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, Brian Gerst <brgerst@...il.com>,
Uros Bizjak <ubizjak@...il.com>, Ard Biesheuvel <ardb@...nel.org>,
David Kaplan <david.kaplan@....com>, Kees Cook <kees@...nel.org>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Andrew Cooper <andrew.cooper3@...rix.com>,
Oleg Nesterov <oleg@...hat.com>, "Xin Li (Intel)" <xin@...or.com>,
Sabyrzhan Tasbolatov <snovitoll@...il.com>
Subject: Re: [PATCH] x86: add hintable NOPs emulation
On Wed, 20 Aug 2025, Marcos Del Sol Vives wrote:
>
> But I think the kernel should let the user know the binaries they're
> running are having some performance penalty due to this emulation, in case
> they want to recompile without the offending flags.
>
> Without the logging, they'd be in the dark and might get confused on why
> their programs are running slower than on other machines.
>
Not convinced; especially all the extra 'thread_struct' noise.
>
> I originally did that, but then realized it was not possible due to
> "handle_hnop" depending on the conditionally-available "hnop_warn" flag.
>
Please do:
#ifdef CONFIG_X86_HNOP_EMU
static bool handle_hnop(struct pt_regs *regs)
{
// Reference 'hnop_warn' as much as you like
}
#else
static bool handle_hnop(struct pt_regs *regs)
{
return false;
}
# endif
Then this ugliness:
static inline void handle_invalid_op(struct pt_regs *regs)
{
#ifdef CONFIG_X86_HNOP_EMU
if (user_mode(regs) && handle_hnop(regs))
return;
#endif
...
}
can become normal code:
static inline void handle_invalid_op(struct pt_regs *regs)
{
if (user_mode(regs) && handle_hnop(regs))
return;
...
}
Good luck,
--
Ahmed S. Darwish
Linutronix GmbH
Powered by blists - more mailing lists