Re: [RFC PATCH 31/56] x86/alternative: Prepend nops with retpolines

Peter Zijlstra
2025-10-16T14:07:45Z

On Thu, Oct 16, 2025 at 01:27:53PM +0000, Kaplan, David wrote:

> > Ah, I found it, you freeze everything, which puts it at safe points.
>
> Yes. In fact, I think you were the one who pointed me in that direction :)

Heh, yeah, I remembered talking to you about this, but had forgotten all
details. I quickly checked the cover letter, but found insufficient
detail there, so I went and asked. Then later memory started coming back
and I went looking for it in later patches.

> Despite the freezer though, this patch is necessary in particular
> because stop_machine_nmi() uses an indirect branch to run the handler.
> Which means that while patching is going on, all cores are inside a
> function which is going to return to after the indirect call site.
> And so that needs to be the end of the 5 (or 6) byte sequence.

Yeah, makes sense. But I like I wrote, I think prefix stuffing might be
a better option.