Re: [PATCH] x86: add hintable NOPs emulation

From: Ahmed S. Darwish
Date: Wed Aug 20 2025 - 06:31:15 EST


On Wed, 20 Aug 2025, Ahmed S. Darwish wrote:
>
> 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
>

And as previously suggested: remove the ugly hnop_warn stuff from
'thread_struct', then you can even just do:

static bool handle_hnop(struct pt_regs *regs)
{
if (!IS_ENABLED(CONFIG_X86_HNOP_EMU))
return false;

pr_warn_once("%s[%d] Emulating hintable NOP\n"
"This warning will not be repeated; even for other binaries\n"
current->comm, task_pid_nr(current));

...
}

And everything else will fit quietly in place.

--
Ahmed S. Darwish
Linutronix GmbH