mbox series

[RFC,0/3] x86/paravirt: Get rid of paravirt patching

Message ID 20230608140333.4083-1-jgross@suse.com (mailing list archive)
Headers show
Series x86/paravirt: Get rid of paravirt patching | expand

Message

Jürgen Groß June 8, 2023, 2:03 p.m. UTC
This is a small series getting rid of paravirt patching by switching
completely to alternative patching for the same functionality.

The basic idea is to add the capability to switch from indirect to
direct calls via a special alternative patching option.

This removes _some_ of the paravirt macro maze, but most of it needs
to stay due to the need of hiding the call instructions from the
compiler in order to avoid needless register save/restore.

What is going away is the nasty stacking of alternative and paravirt
patching and (of course) the special .parainstructions linker section.

I have tested the series on bare metal and as Xen PV domain to still
work.

RFC because I'm quite sure there will be some objtool work needed
(at least removing the specific paravirt handling).

Juergen Gross (3):
  x86/paravirt: move some functions and defines to alternative
  x86/alternative: add indirect call patching
  x86/paravirt: switch mixed paravirt/alternative calls to alternative_2

 arch/x86/include/asm/alternative.h        | 26 +++++-
 arch/x86/include/asm/paravirt.h           | 39 ++-------
 arch/x86/include/asm/paravirt_types.h     | 68 +++-------------
 arch/x86/include/asm/qspinlock_paravirt.h |  4 +-
 arch/x86/include/asm/text-patching.h      | 12 ---
 arch/x86/kernel/alternative.c             | 99 +++++++++++------------
 arch/x86/kernel/callthunks.c              | 17 ++--
 arch/x86/kernel/kvm.c                     |  4 +-
 arch/x86/kernel/module.c                  | 20 ++---
 arch/x86/kernel/paravirt.c                | 54 ++-----------
 arch/x86/kernel/vmlinux.lds.S             | 13 ---
 arch/x86/tools/relocs.c                   |  2 +-
 arch/x86/xen/irq.c                        |  2 +-
 13 files changed, 111 insertions(+), 249 deletions(-)

Comments

Jürgen Groß July 10, 2023, 12:29 p.m. UTC | #1
Any comments?

On 08.06.23 16:03, Juergen Gross wrote:
> This is a small series getting rid of paravirt patching by switching
> completely to alternative patching for the same functionality.
> 
> The basic idea is to add the capability to switch from indirect to
> direct calls via a special alternative patching option.
> 
> This removes _some_ of the paravirt macro maze, but most of it needs
> to stay due to the need of hiding the call instructions from the
> compiler in order to avoid needless register save/restore.
> 
> What is going away is the nasty stacking of alternative and paravirt
> patching and (of course) the special .parainstructions linker section.
> 
> I have tested the series on bare metal and as Xen PV domain to still
> work.
> 
> RFC because I'm quite sure there will be some objtool work needed
> (at least removing the specific paravirt handling).
> 
> Juergen Gross (3):
>    x86/paravirt: move some functions and defines to alternative
>    x86/alternative: add indirect call patching
>    x86/paravirt: switch mixed paravirt/alternative calls to alternative_2
> 
>   arch/x86/include/asm/alternative.h        | 26 +++++-
>   arch/x86/include/asm/paravirt.h           | 39 ++-------
>   arch/x86/include/asm/paravirt_types.h     | 68 +++-------------
>   arch/x86/include/asm/qspinlock_paravirt.h |  4 +-
>   arch/x86/include/asm/text-patching.h      | 12 ---
>   arch/x86/kernel/alternative.c             | 99 +++++++++++------------
>   arch/x86/kernel/callthunks.c              | 17 ++--
>   arch/x86/kernel/kvm.c                     |  4 +-
>   arch/x86/kernel/module.c                  | 20 ++---
>   arch/x86/kernel/paravirt.c                | 54 ++-----------
>   arch/x86/kernel/vmlinux.lds.S             | 13 ---
>   arch/x86/tools/relocs.c                   |  2 +-
>   arch/x86/xen/irq.c                        |  2 +-
>   13 files changed, 111 insertions(+), 249 deletions(-)
>
Jürgen Groß Aug. 24, 2023, 9:01 a.m. UTC | #2
PING!

On 10.07.23 14:29, Juergen Gross wrote:
> Any comments?
> 
> On 08.06.23 16:03, Juergen Gross wrote:
>> This is a small series getting rid of paravirt patching by switching
>> completely to alternative patching for the same functionality.
>>
>> The basic idea is to add the capability to switch from indirect to
>> direct calls via a special alternative patching option.
>>
>> This removes _some_ of the paravirt macro maze, but most of it needs
>> to stay due to the need of hiding the call instructions from the
>> compiler in order to avoid needless register save/restore.
>>
>> What is going away is the nasty stacking of alternative and paravirt
>> patching and (of course) the special .parainstructions linker section.
>>
>> I have tested the series on bare metal and as Xen PV domain to still
>> work.
>>
>> RFC because I'm quite sure there will be some objtool work needed
>> (at least removing the specific paravirt handling).
>>
>> Juergen Gross (3):
>>    x86/paravirt: move some functions and defines to alternative
>>    x86/alternative: add indirect call patching
>>    x86/paravirt: switch mixed paravirt/alternative calls to alternative_2
>>
>>   arch/x86/include/asm/alternative.h        | 26 +++++-
>>   arch/x86/include/asm/paravirt.h           | 39 ++-------
>>   arch/x86/include/asm/paravirt_types.h     | 68 +++-------------
>>   arch/x86/include/asm/qspinlock_paravirt.h |  4 +-
>>   arch/x86/include/asm/text-patching.h      | 12 ---
>>   arch/x86/kernel/alternative.c             | 99 +++++++++++------------
>>   arch/x86/kernel/callthunks.c              | 17 ++--
>>   arch/x86/kernel/kvm.c                     |  4 +-
>>   arch/x86/kernel/module.c                  | 20 ++---
>>   arch/x86/kernel/paravirt.c                | 54 ++-----------
>>   arch/x86/kernel/vmlinux.lds.S             | 13 ---
>>   arch/x86/tools/relocs.c                   |  2 +-
>>   arch/x86/xen/irq.c                        |  2 +-
>>   13 files changed, 111 insertions(+), 249 deletions(-)
>>
>