Re: [PATCH v3 2/3] x86/alternative: Use a helper function for patching alternatives

From: Borislav Petkov
Date: Tue Nov 18 2025 - 10:12:29 EST


On Mon, Nov 17, 2025 at 03:45:05PM +0100, Jürgen Groß wrote:
> It doesn't do the patching. That is done in the caller of
> analyze_patch_site().

It doesn't do patch site analysis only either.

> and putting the code to be patched in into the temporary buffer and then it
> is printing the debug info related to the result of the analysis.

This belongs more into the patch_site function, I'd say.

> I can add one other layer doing the split you are asking for: one for gathering
> the information and one for applying relocs and debug printing. But I'd really
> like to keep the final patching in apply_alternatives(), as this makes it very
> clear where the final patching of the code is done.

Fine by me. And I'd like to have clearly separated stages with functions named
accordingly and functions doing *only* one thing and one thing only.

I'm even more fine if you do:

analyze_patch_site();
prep_patch_site();
patch_site();

and have it perfectly clear and separated and borderline trivial.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette