Re: [patch 3/3] x86/paravirt: Replace paravirt patch asm magic

From: Ingo Molnar
Date: Thu Apr 25 2019 - 05:20:56 EST



* Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> > I think these open-coded hexa versions are somewhat fragile as well, how
> > about putting these into a .S file and controlling the sections in an LTO
> > safe manner there?
> >
> > That will also allow us to write proper asm, and global labels can be
> > used to extract the patchlets and their length?
>
> While I'm not fan either; I think that will be worse still, because it
> splits the information over multiple files.

Yeah, so that's a drawback of the .S files.

> The advantage of this form is that it is clear how long the instructions
> are, which is important for the patching. These immediates have to be
> shorter than 5 bytes because they overwrite the CALL/JMP to the paravirt
> function.
>
> /me eyes .cpu_usergs_sysret64 and goes wtf..

I just posted a patch that adds an assert to detect too large patching
attempt: we'd silently ignore them before, which isn't healthy.

With the two patches I now like the .c version better.

Thomas, want me to organize all these changes, or do you want to?
1
Thanks,

Ingo