[PATCH v3 11/15] x86/paravirt: switch iret pvops to ALTERNATIVE

2020-12-17 Thread Juergen Gross via Virtualization
The iret paravirt op is rather special as it is using a jmp instead of a call instruction. Switch it to ALTERNATIVE. Signed-off-by: Juergen Gross --- V3: - use ALTERNATIVE_TERNARY --- arch/x86/include/asm/paravirt.h | 6 +++--- arch/x86/include/asm/paravirt_types.h | 5 +

[PATCH v3 15/15] x86/paravirt: have only one paravirt patch function

2020-12-17 Thread Juergen Gross via Virtualization
There is no need any longer to have different paravirt patch functions for native and Xen. Eliminate native_patch() and rename paravirt_patch_default() to paravirt_patch(). Signed-off-by: Juergen Gross --- V3: - remove paravirt_patch_insns() (kernel test robot) ---

[PATCH v3 05/15] x86: rework arch_local_irq_restore() to not use popf

2020-12-17 Thread Juergen Gross via Virtualization
"popf" is a rather expensive operation, so don't use it for restoring irq flags. Instead test whether interrupts are enabled in the flags parameter and enable interrupts via "sti" in that case. This results in the restore_fl paravirt op to be no longer needed. Suggested-by: Andy Lutomirski

[PATCH v3 13/15] x86/paravirt: add new macros PVOP_ALT* supporting pvops in ALTERNATIVEs

2020-12-17 Thread Juergen Gross via Virtualization
Instead of using paravirt patching for custom code sequences add support for using ALTERNATIVE handling combined with paravirt call patching. Signed-off-by: Juergen Gross --- V3: - drop PVOP_ALT_VCALL() macro --- arch/x86/include/asm/paravirt_types.h | 49 +++ 1 file

[PATCH v3 06/15] x86/paravirt: switch time pvops functions to use static_call()

2020-12-17 Thread Juergen Gross via Virtualization
The time pvops functions are the only ones left which might be used in 32-bit mode and which return a 64-bit value. Switch them to use the static_call() mechanism instead of pvops, as this allows quite some simplification of the pvops implementation. Due to include hell this requires to split

[PATCH v3 10/15] x86/paravirt: simplify paravirt macros

2020-12-17 Thread Juergen Gross via Virtualization
The central pvops call macros PVOP_CALL() and PVOP_VCALL() are looking very similar now. The main differences are using PVOP_VCALL_ARGS or PVOP_CALL_ARGS, which are identical, and the return value handling. So drop PVOP_VCALL_ARGS and instead of PVOP_VCALL() just use

[PATCH v3 14/15] x86/paravirt: switch functions with custom code to ALTERNATIVE

2020-12-17 Thread Juergen Gross via Virtualization
Instead of using paravirt patching for custom code sequences use ALTERNATIVE for the functions with custom code replacements. Instead of patching an ud2 instruction for unpopulated vector entries into the caller site, use a simple function just calling BUG() as a replacement. Signed-off-by:

[PATCH v3 03/15] x86/pv: switch SWAPGS to ALTERNATIVE

2020-12-17 Thread Juergen Gross via Virtualization
SWAPGS is used only for interrupts coming from user mode or for returning to user mode. So there is no reason to use the PARAVIRT framework, as it can easily be replaced by an ALTERNATIVE depending on X86_FEATURE_XENPV. There are several instances using the PV-aware SWAPGS macro in paths which

[PATCH v3 09/15] x86/paravirt: remove no longer needed 32-bit pvops cruft

2020-12-17 Thread Juergen Gross via Virtualization
PVOP_VCALL4() is only used for Xen PV, while PVOP_CALL4() isn't used at all. Keep PVOP_CALL4() for 64 bits due to symmetry reasons. This allows to remove the 32-bit definitions of those macros leading to a substantial simplification of the paravirt macros, as those were the only ones needing

[PATCH v3 04/15] x86/xen: drop USERGS_SYSRET64 paravirt call

2020-12-17 Thread Juergen Gross via Virtualization
USERGS_SYSRET64 is used to return from a syscall via sysret, but a Xen PV guest will nevertheless use the iret hypercall, as there is no sysret PV hypercall defined. So instead of testing all the prerequisites for doing a sysret and then mangling the stack for Xen PV again for doing an iret just

[PATCH v3 00/15] x86: major paravirt cleanup

2020-12-17 Thread Juergen Gross via Virtualization
This is a major cleanup of the paravirt infrastructure aiming at eliminating all custom code patching via paravirt patching. This is achieved by using ALTERNATIVE instead, leading to the ability to give objtool access to the patched in instructions. In order to remove most of the 32-bit special

[PATCH 3/4] x86/pv: switch SWAPGS to ALTERNATIVE

2020-11-16 Thread Juergen Gross via Virtualization
SWAPGS is used only for interrupts coming from user mode or for returning to user mode. So there is no reason to use the PARAVIRT framework, as it can easily be replaced by an ALTERNATIVE depending on X86_FEATURE_XENPV. There are several instances using the PV-aware SWAPGS macro in paths which

[PATCH 4/4] x86/xen: drop USERGS_SYSRET64 paravirt call

2020-11-16 Thread Juergen Gross via Virtualization
USERGS_SYSRET64 is used to return from a syscall via sysret, but a Xen PV guest will nevertheless use the iret hypercall, as there is no sysret PV hypercall defined. So instead of testing all the prerequisites for doing a sysret and then mangling the stack for Xen PV again for doing an iret just

[PATCH 0/4] x86/xen: do some paravirt cleanup

2020-11-16 Thread Juergen Gross via Virtualization
Eliminate the usergs_sysret64 paravirt call completely and switch the swapgs one to use ALTERNATIVE instead. This requires to fix the IST based exception entries for Xen PV to use the same mechanism as NMI and debug exception already do. Juergen Gross (4): x86/xen: use specific Xen pv interrupt

[PATCH v2 03/12] x86/pv: switch SWAPGS to ALTERNATIVE

2020-11-20 Thread Juergen Gross via Virtualization
SWAPGS is used only for interrupts coming from user mode or for returning to user mode. So there is no reason to use the PARAVIRT framework, as it can easily be replaced by an ALTERNATIVE depending on X86_FEATURE_XENPV. There are several instances using the PV-aware SWAPGS macro in paths which

[PATCH v2 06/12] x86/paravirt: switch time pvops functions to use static_call()

2020-11-20 Thread Juergen Gross via Virtualization
The time pvops functions are the only ones left which might be used in 32-bit mode and which return a 64-bit value. Switch them to use the static_call() mechanism instead of pvops, as this allows quite some simplification of the pvops implementation. Due to include hell this requires to split

[PATCH v2 04/12] x86/xen: drop USERGS_SYSRET64 paravirt call

2020-11-20 Thread Juergen Gross via Virtualization
USERGS_SYSRET64 is used to return from a syscall via sysret, but a Xen PV guest will nevertheless use the iret hypercall, as there is no sysret PV hypercall defined. So instead of testing all the prerequisites for doing a sysret and then mangling the stack for Xen PV again for doing an iret just

[PATCH v2 09/12] x86/paravirt: switch iret pvops to ALTERNATIVE

2020-11-20 Thread Juergen Gross via Virtualization
The iret paravirt op is rather special as it is using a jmp instead of a call instruction. Switch it to ALTERNATIVE. Signed-off-by: Juergen Gross --- arch/x86/include/asm/paravirt.h | 7 --- arch/x86/include/asm/paravirt_types.h | 5 + arch/x86/kernel/asm-offsets.c | 5

[PATCH v2 10/12] x86/paravirt: add new macros PVOP_ALT* supporting pvops in ALTERNATIVEs

2020-11-20 Thread Juergen Gross via Virtualization
Instead of using paravirt patching for custom code sequences add support for using ALTERNATIVE handling combined with paravirt call patching. Signed-off-by: Juergen Gross --- arch/x86/include/asm/paravirt_types.h | 62 +++ 1 file changed, 62 insertions(+) diff --git

[PATCH v2 05/12] x86: rework arch_local_irq_restore() to not use popf

2020-11-20 Thread Juergen Gross via Virtualization
"popf" is a rather expensive operation, so don't use it for restoring irq flags. Instead test whether interrupts are enabled in the flags parameter and enable interrupts via "sti" in that case. This results in the restore_fl paravirt op to be no longer needed. Suggested-by: Andy Lutomirski

[PATCH v2 12/12] x86/paravirt: have only one paravirt patch function

2020-11-20 Thread Juergen Gross via Virtualization
There is no need any longer to have different paravirt patch functions for native and Xen. Eliminate native_patch() and rename paravirt_patch_default() to paravirt_patch(). Signed-off-by: Juergen Gross --- arch/x86/include/asm/paravirt_types.h | 19 +-- arch/x86/kernel/Makefile

[PATCH v2 08/12] x86/paravirt: remove no longer needed 32-bit pvops cruft

2020-11-20 Thread Juergen Gross via Virtualization
PVOP_VCALL4() is only used for Xen PV, while PVOP_CALL4() isn't used at all. Keep PVOP_CALL4() for 64 bits due to symmetry reasons. This allows to remove the 32-bit definitions of those macros leading to a substantial simplification of the paravirt macros, as those were the only ones needing

[PATCH v2 11/12] x86/paravirt: switch functions with custom code to ALTERNATIVE

2020-11-20 Thread Juergen Gross via Virtualization
Instead of using paravirt patching for custom code sequences use ALTERNATIVE for the functions with custom code replacements. Instead of patching an ud2 instruction for unpopulated vector entries into the caller site, use a simple function just calling BUG() as a replacement. Signed-off-by:

[PATCH v2 00/12] x86: major paravirt cleanup

2020-11-20 Thread Juergen Gross via Virtualization
This is a major cleanup of the paravirt infrastructure aiming at eliminating all custom code patching via paravirt patching. This is achieved by using ALTERNATIVE instead, leading to the ability to give objtool access to the patched in instructions. In order to remove most of the 32-bit special

Re: [PATCH 3/6] x86/sev-es: Use __put_user()/__get_user

2021-05-12 Thread Juergen Gross via Virtualization
On 12.05.21 10:04, David Laight wrote: From: Joerg Sent: 12 May 2021 08:55 From: Joerg Roedel The put_user() and get_user() functions do checks on the address which is passed to them. They check whether the address is actually a user-space address and whether its fine to access it. They also

Re: [PATCH 3/6] x86/sev-es: Use __put_user()/__get_user

2021-05-12 Thread Juergen Gross via Virtualization
On 12.05.21 10:50, 'Joerg Roedel' wrote: On Wed, May 12, 2021 at 10:16:12AM +0200, Juergen Gross wrote: You want something like xen_safe_[read|write]_ulong(). From a first glance I can't see it, what is the difference between the xen_safe_*_ulong() functions and __get_user()/__put_user()?

Re: [PATCH] bus: Make remove callback return void

2021-07-06 Thread Juergen Gross via Virtualization
On 06.07.21 11:50, Uwe Kleine-König wrote: The driver core ignores the return value of this callback because there is only little it can do when a device disappears. This is the final bit of a long lasting cleanup quest where several buses were converted to also return void from their remove

[PATCH v4 06/15] x86: rework arch_local_irq_restore() to not use popf

2021-01-20 Thread Juergen Gross via Virtualization
"popf" is a rather expensive operation, so don't use it for restoring irq flags. Instead test whether interrupts are enabled in the flags parameter and enable interrupts via "sti" in that case. This results in the restore_fl paravirt op to be no longer needed. Suggested-by: Andy Lutomirski

[PATCH v4 05/15] x86/xen: drop USERGS_SYSRET64 paravirt call

2021-01-20 Thread Juergen Gross via Virtualization
USERGS_SYSRET64 is used to return from a syscall via sysret, but a Xen PV guest will nevertheless use the iret hypercall, as there is no sysret PV hypercall defined. So instead of testing all the prerequisites for doing a sysret and then mangling the stack for Xen PV again for doing an iret just

[PATCH v4 11/15] x86/paravirt: simplify paravirt macros

2021-01-20 Thread Juergen Gross via Virtualization
The central pvops call macros PVOP_CALL() and PVOP_VCALL() are looking very similar now. The main differences are using PVOP_VCALL_ARGS or PVOP_CALL_ARGS, which are identical, and the return value handling. So drop PVOP_VCALL_ARGS and instead of PVOP_VCALL() just use

[PATCH v4 07/15] x86/paravirt: switch time pvops functions to use static_call()

2021-01-20 Thread Juergen Gross via Virtualization
The time pvops functions are the only ones left which might be used in 32-bit mode and which return a 64-bit value. Switch them to use the static_call() mechanism instead of pvops, as this allows quite some simplification of the pvops implementation. Signed-off-by: Juergen Gross --- V4: - drop

[PATCH v4 12/15] x86/paravirt: switch iret pvops to ALTERNATIVE

2021-01-20 Thread Juergen Gross via Virtualization
The iret paravirt op is rather special as it is using a jmp instead of a call instruction. Switch it to ALTERNATIVE. Signed-off-by: Juergen Gross --- V3: - use ALTERNATIVE_TERNARY --- arch/x86/include/asm/paravirt.h | 6 +++--- arch/x86/include/asm/paravirt_types.h | 5 +

[PATCH v4 09/15] x86: add new features for paravirt patching

2021-01-20 Thread Juergen Gross via Virtualization
For being able to switch paravirt patching from special cased custom code sequences to ALTERNATIVE handling some X86_FEATURE_* are needed as new features. This enables to have the standard indirect pv call as the default code and to patch that with the non-Xen custom code sequence via ALTERNATIVE

[PATCH v4 13/15] x86/paravirt: add new macros PVOP_ALT* supporting pvops in ALTERNATIVEs

2021-01-20 Thread Juergen Gross via Virtualization
Instead of using paravirt patching for custom code sequences add support for using ALTERNATIVE handling combined with paravirt call patching. Signed-off-by: Juergen Gross --- V3: - drop PVOP_ALT_VCALL() macro --- arch/x86/include/asm/paravirt_types.h | 49 ++- 1 file

[PATCH v4 14/15] x86/paravirt: switch functions with custom code to ALTERNATIVE

2021-01-20 Thread Juergen Gross via Virtualization
Instead of using paravirt patching for custom code sequences use ALTERNATIVE for the functions with custom code replacements. Instead of patching an ud2 instruction for unpopulated vector entries into the caller site, use a simple function just calling BUG() as a replacement. Simplify the

[PATCH v4 15/15] x86/paravirt: have only one paravirt patch function

2021-01-20 Thread Juergen Gross via Virtualization
There is no need any longer to have different paravirt patch functions for native and Xen. Eliminate native_patch() and rename paravirt_patch_default() to paravirt_patch(). Signed-off-by: Juergen Gross --- V3: - remove paravirt_patch_insns() (kernel test robot) ---

[PATCH v4 04/15] x86/pv: switch SWAPGS to ALTERNATIVE

2021-01-20 Thread Juergen Gross via Virtualization
SWAPGS is used only for interrupts coming from user mode or for returning to user mode. So there is no reason to use the PARAVIRT framework, as it can easily be replaced by an ALTERNATIVE depending on X86_FEATURE_XENPV. There are several instances using the PV-aware SWAPGS macro in paths which

[PATCH v4 00/15] x86: major paravirt cleanup

2021-01-20 Thread Juergen Gross via Virtualization
This is a major cleanup of the paravirt infrastructure aiming at eliminating all custom code patching via paravirt patching. This is achieved by using ALTERNATIVE instead, leading to the ability to give objtool access to the patched in instructions. In order to remove most of the 32-bit special

[PATCH v4 07/15] x86/paravirt: switch time pvops functions to use static_call()

2021-01-20 Thread Juergen Gross via Virtualization
The time pvops functions are the only ones left which might be used in 32-bit mode and which return a 64-bit value. Switch them to use the static_call() mechanism instead of pvops, as this allows quite some simplification of the pvops implementation. Signed-off-by: Juergen Gross --- V4: - drop

[PATCH v4 10/15] x86/paravirt: remove no longer needed 32-bit pvops cruft

2021-01-20 Thread Juergen Gross via Virtualization
PVOP_VCALL4() is only used for Xen PV, while PVOP_CALL4() isn't used at all. Keep PVOP_CALL4() for 64 bits due to symmetry reasons. This allows to remove the 32-bit definitions of those macros leading to a substantial simplification of the paravirt macros, as those were the only ones needing

[PATCH v4 15/15] x86/paravirt: have only one paravirt patch function

2021-01-20 Thread Juergen Gross via Virtualization
There is no need any longer to have different paravirt patch functions for native and Xen. Eliminate native_patch() and rename paravirt_patch_default() to paravirt_patch(). Signed-off-by: Juergen Gross --- V3: - remove paravirt_patch_insns() (kernel test robot) ---

[PATCH v4 14/15] x86/paravirt: switch functions with custom code to ALTERNATIVE

2021-01-20 Thread Juergen Gross via Virtualization
Instead of using paravirt patching for custom code sequences use ALTERNATIVE for the functions with custom code replacements. Instead of patching an ud2 instruction for unpopulated vector entries into the caller site, use a simple function just calling BUG() as a replacement. Simplify the

[PATCH v4 12/15] x86/paravirt: switch iret pvops to ALTERNATIVE

2021-01-20 Thread Juergen Gross via Virtualization
The iret paravirt op is rather special as it is using a jmp instead of a call instruction. Switch it to ALTERNATIVE. Signed-off-by: Juergen Gross --- V3: - use ALTERNATIVE_TERNARY --- arch/x86/include/asm/paravirt.h | 6 +++--- arch/x86/include/asm/paravirt_types.h | 5 +

[PATCH v4 00/15] x86: major paravirt cleanup

2021-01-20 Thread Juergen Gross via Virtualization
[Resend due to all the Cc:'s missing] This is a major cleanup of the paravirt infrastructure aiming at eliminating all custom code patching via paravirt patching. This is achieved by using ALTERNATIVE instead, leading to the ability to give objtool access to the patched in instructions. In

[PATCH v4 05/15] x86/xen: drop USERGS_SYSRET64 paravirt call

2021-01-20 Thread Juergen Gross via Virtualization
USERGS_SYSRET64 is used to return from a syscall via sysret, but a Xen PV guest will nevertheless use the iret hypercall, as there is no sysret PV hypercall defined. So instead of testing all the prerequisites for doing a sysret and then mangling the stack for Xen PV again for doing an iret just

[PATCH v4 11/15] x86/paravirt: simplify paravirt macros

2021-01-20 Thread Juergen Gross via Virtualization
The central pvops call macros PVOP_CALL() and PVOP_VCALL() are looking very similar now. The main differences are using PVOP_VCALL_ARGS or PVOP_CALL_ARGS, which are identical, and the return value handling. So drop PVOP_VCALL_ARGS and instead of PVOP_VCALL() just use

[PATCH v4 06/15] x86: rework arch_local_irq_restore() to not use popf

2021-01-20 Thread Juergen Gross via Virtualization
"popf" is a rather expensive operation, so don't use it for restoring irq flags. Instead test whether interrupts are enabled in the flags parameter and enable interrupts via "sti" in that case. This results in the restore_fl paravirt op to be no longer needed. Suggested-by: Andy Lutomirski

[PATCH v4 04/15] x86/pv: switch SWAPGS to ALTERNATIVE

2021-01-20 Thread Juergen Gross via Virtualization
SWAPGS is used only for interrupts coming from user mode or for returning to user mode. So there is no reason to use the PARAVIRT framework, as it can easily be replaced by an ALTERNATIVE depending on X86_FEATURE_XENPV. There are several instances using the PV-aware SWAPGS macro in paths which

[PATCH v4 13/15] x86/paravirt: add new macros PVOP_ALT* supporting pvops in ALTERNATIVEs

2021-01-20 Thread Juergen Gross via Virtualization
Instead of using paravirt patching for custom code sequences add support for using ALTERNATIVE handling combined with paravirt call patching. Signed-off-by: Juergen Gross --- V3: - drop PVOP_ALT_VCALL() macro --- arch/x86/include/asm/paravirt_types.h | 49 ++- 1 file

[PATCH v4 09/15] x86: add new features for paravirt patching

2021-01-20 Thread Juergen Gross via Virtualization
For being able to switch paravirt patching from special cased custom code sequences to ALTERNATIVE handling some X86_FEATURE_* are needed as new features. This enables to have the standard indirect pv call as the default code and to patch that with the non-Xen custom code sequence via ALTERNATIVE

[PATCH v7 12/14] x86/paravirt: add new macros PVOP_ALT* supporting pvops in ALTERNATIVEs

2021-03-11 Thread Juergen Gross via Virtualization
Instead of using paravirt patching for custom code sequences add support for using ALTERNATIVE handling combined with paravirt call patching. Signed-off-by: Juergen Gross Acked-by: Peter Zijlstra (Intel) --- V3: - drop PVOP_ALT_VCALL() macro --- arch/x86/include/asm/paravirt_types.h | 49

[PATCH v7 13/14] x86/paravirt: switch functions with custom code to ALTERNATIVE

2021-03-11 Thread Juergen Gross via Virtualization
Instead of using paravirt patching for custom code sequences use ALTERNATIVE for the functions with custom code replacements. Instead of patching an ud2 instruction for unpopulated vector entries into the caller site, use a simple function just calling BUG() as a replacement. Simplify the

[PATCH v7 10/14] x86/paravirt: simplify paravirt macros

2021-03-11 Thread Juergen Gross via Virtualization
The central pvops call macros PVOP_CALL() and PVOP_VCALL() are looking very similar now. The main differences are using PVOP_VCALL_ARGS or PVOP_CALL_ARGS, which are identical, and the return value handling. So drop PVOP_VCALL_ARGS and instead of PVOP_VCALL() just use

[PATCH v7 09/14] x86/paravirt: remove no longer needed 32-bit pvops cruft

2021-03-11 Thread Juergen Gross via Virtualization
PVOP_VCALL4() is only used for Xen PV, while PVOP_CALL4() isn't used at all. Keep PVOP_CALL4() for 64 bits due to symmetry reasons. This allows to remove the 32-bit definitions of those macros leading to a substantial simplification of the paravirt macros, as those were the only ones needing

[PATCH v7 04/14] x86/paravirt: switch time pvops functions to use static_call()

2021-03-11 Thread Juergen Gross via Virtualization
The time pvops functions are the only ones left which might be used in 32-bit mode and which return a 64-bit value. Switch them to use the static_call() mechanism instead of pvops, as this allows quite some simplification of the pvops implementation. Signed-off-by: Juergen Gross Acked-by: Peter

[PATCH v7 11/14] x86/paravirt: switch iret pvops to ALTERNATIVE

2021-03-11 Thread Juergen Gross via Virtualization
The iret paravirt op is rather special as it is using a jmp instead of a call instruction. Switch it to ALTERNATIVE. Signed-off-by: Juergen Gross Acked-by: Peter Zijlstra (Intel) --- V3: - use ALTERNATIVE_TERNARY --- arch/x86/include/asm/paravirt.h | 6 +++---

[PATCH v7 00/14] x86: major paravirt cleanup

2021-03-11 Thread Juergen Gross via Virtualization
This is a major cleanup of the paravirt infrastructure aiming at eliminating all custom code patching via paravirt patching. This is achieved by using ALTERNATIVE instead, leading to the ability to give objtool access to the patched in instructions. In order to remove most of the 32-bit special

[PATCH v7 08/14] x86: add new features for paravirt patching

2021-03-11 Thread Juergen Gross via Virtualization
For being able to switch paravirt patching from special cased custom code sequences to ALTERNATIVE handling some X86_FEATURE_* are needed as new features. This enables to have the standard indirect pv call as the default code and to patch that with the non-Xen custom code sequence via ALTERNATIVE

[PATCH v6 07/12] x86/paravirt: remove no longer needed 32-bit pvops cruft

2021-03-09 Thread Juergen Gross via Virtualization
PVOP_VCALL4() is only used for Xen PV, while PVOP_CALL4() isn't used at all. Keep PVOP_CALL4() for 64 bits due to symmetry reasons. This allows to remove the 32-bit definitions of those macros leading to a substantial simplification of the paravirt macros, as those were the only ones needing

[PATCH v6 02/12] x86/paravirt: switch time pvops functions to use static_call()

2021-03-09 Thread Juergen Gross via Virtualization
The time pvops functions are the only ones left which might be used in 32-bit mode and which return a 64-bit value. Switch them to use the static_call() mechanism instead of pvops, as this allows quite some simplification of the pvops implementation. Signed-off-by: Juergen Gross Acked-by: Peter

[PATCH v6 08/12] x86/paravirt: simplify paravirt macros

2021-03-09 Thread Juergen Gross via Virtualization
The central pvops call macros PVOP_CALL() and PVOP_VCALL() are looking very similar now. The main differences are using PVOP_VCALL_ARGS or PVOP_CALL_ARGS, which are identical, and the return value handling. So drop PVOP_VCALL_ARGS and instead of PVOP_VCALL() just use

[PATCH v6 09/12] x86/paravirt: switch iret pvops to ALTERNATIVE

2021-03-09 Thread Juergen Gross via Virtualization
The iret paravirt op is rather special as it is using a jmp instead of a call instruction. Switch it to ALTERNATIVE. Signed-off-by: Juergen Gross Acked-by: Peter Zijlstra (Intel) --- V3: - use ALTERNATIVE_TERNARY --- arch/x86/include/asm/paravirt.h | 6 +++---

[PATCH v6 12/12] x86/paravirt: have only one paravirt patch function

2021-03-09 Thread Juergen Gross via Virtualization
There is no need any longer to have different paravirt patch functions for native and Xen. Eliminate native_patch() and rename paravirt_patch_default() to paravirt_patch(). Signed-off-by: Juergen Gross Acked-by: Peter Zijlstra (Intel) --- V3: - remove paravirt_patch_insns() (kernel test robot)

[PATCH v6 06/12] x86: add new features for paravirt patching

2021-03-09 Thread Juergen Gross via Virtualization
For being able to switch paravirt patching from special cased custom code sequences to ALTERNATIVE handling some X86_FEATURE_* are needed as new features. This enables to have the standard indirect pv call as the default code and to patch that with the non-Xen custom code sequence via ALTERNATIVE

[PATCH v6 11/12] x86/paravirt: switch functions with custom code to ALTERNATIVE

2021-03-09 Thread Juergen Gross via Virtualization
Instead of using paravirt patching for custom code sequences use ALTERNATIVE for the functions with custom code replacements. Instead of patching an ud2 instruction for unpopulated vector entries into the caller site, use a simple function just calling BUG() as a replacement. Simplify the

[PATCH v6 10/12] x86/paravirt: add new macros PVOP_ALT* supporting pvops in ALTERNATIVEs

2021-03-09 Thread Juergen Gross via Virtualization
Instead of using paravirt patching for custom code sequences add support for using ALTERNATIVE handling combined with paravirt call patching. Signed-off-by: Juergen Gross Acked-by: Peter Zijlstra (Intel) --- V3: - drop PVOP_ALT_VCALL() macro --- arch/x86/include/asm/paravirt_types.h | 49

[PATCH v6 00/12] x86: major paravirt cleanup

2021-03-09 Thread Juergen Gross via Virtualization
This is a major cleanup of the paravirt infrastructure aiming at eliminating all custom code patching via paravirt patching. This is achieved by using ALTERNATIVE instead, leading to the ability to give objtool access to the patched in instructions. In order to remove most of the 32-bit special

[PATCH v5 12/12] x86/paravirt: have only one paravirt patch function

2021-03-08 Thread Juergen Gross via Virtualization
There is no need any longer to have different paravirt patch functions for native and Xen. Eliminate native_patch() and rename paravirt_patch_default() to paravirt_patch(). Signed-off-by: Juergen Gross --- V3: - remove paravirt_patch_insns() (kernel test robot) ---

[PATCH v5 06/12] x86: add new features for paravirt patching

2021-03-08 Thread Juergen Gross via Virtualization
For being able to switch paravirt patching from special cased custom code sequences to ALTERNATIVE handling some X86_FEATURE_* are needed as new features. This enables to have the standard indirect pv call as the default code and to patch that with the non-Xen custom code sequence via ALTERNATIVE

[PATCH v5 02/12] x86/paravirt: switch time pvops functions to use static_call()

2021-03-08 Thread Juergen Gross via Virtualization
The time pvops functions are the only ones left which might be used in 32-bit mode and which return a 64-bit value. Switch them to use the static_call() mechanism instead of pvops, as this allows quite some simplification of the pvops implementation. Signed-off-by: Juergen Gross --- V4: - drop

[PATCH v5 11/12] x86/paravirt: switch functions with custom code to ALTERNATIVE

2021-03-08 Thread Juergen Gross via Virtualization
Instead of using paravirt patching for custom code sequences use ALTERNATIVE for the functions with custom code replacements. Instead of patching an ud2 instruction for unpopulated vector entries into the caller site, use a simple function just calling BUG() as a replacement. Simplify the

[PATCH v5 10/12] x86/paravirt: add new macros PVOP_ALT* supporting pvops in ALTERNATIVEs

2021-03-08 Thread Juergen Gross via Virtualization
Instead of using paravirt patching for custom code sequences add support for using ALTERNATIVE handling combined with paravirt call patching. Signed-off-by: Juergen Gross --- V3: - drop PVOP_ALT_VCALL() macro --- arch/x86/include/asm/paravirt_types.h | 49 ++- 1 file

[PATCH v5 09/12] x86/paravirt: switch iret pvops to ALTERNATIVE

2021-03-08 Thread Juergen Gross via Virtualization
The iret paravirt op is rather special as it is using a jmp instead of a call instruction. Switch it to ALTERNATIVE. Signed-off-by: Juergen Gross --- V3: - use ALTERNATIVE_TERNARY --- arch/x86/include/asm/paravirt.h | 6 +++--- arch/x86/include/asm/paravirt_types.h | 5 +

[PATCH v5 00/12] x86: major paravirt cleanup

2021-03-08 Thread Juergen Gross via Virtualization
This is a major cleanup of the paravirt infrastructure aiming at eliminating all custom code patching via paravirt patching. This is achieved by using ALTERNATIVE instead, leading to the ability to give objtool access to the patched in instructions. In order to remove most of the 32-bit special

[PATCH v5 08/12] x86/paravirt: simplify paravirt macros

2021-03-08 Thread Juergen Gross via Virtualization
The central pvops call macros PVOP_CALL() and PVOP_VCALL() are looking very similar now. The main differences are using PVOP_VCALL_ARGS or PVOP_CALL_ARGS, which are identical, and the return value handling. So drop PVOP_VCALL_ARGS and instead of PVOP_VCALL() just use

[PATCH v5 07/12] x86/paravirt: remove no longer needed 32-bit pvops cruft

2021-03-08 Thread Juergen Gross via Virtualization
PVOP_VCALL4() is only used for Xen PV, while PVOP_CALL4() isn't used at all. Keep PVOP_CALL4() for 64 bits due to symmetry reasons. This allows to remove the 32-bit definitions of those macros leading to a substantial simplification of the paravirt macros, as those were the only ones needing

Re: [PATCH v6 42/76] x86/sev-es: Setup early #VC handler

2021-09-05 Thread Juergen Gross via Virtualization
On 04.09.21 11:39, Lai Jiangshan wrote: @@ -363,6 +370,33 @@ SYM_CODE_START_LOCAL(early_idt_handler_common) jmp restore_regs_and_return_to_kernel SYM_CODE_END(early_idt_handler_common) +#ifdef CONFIG_AMD_MEM_ENCRYPT +/* + * VC Exception handler used during very early boot. The + *

[PATCH v2 2/2] x86/xen: switch initial pvops IRQ functions to dummy ones

2021-09-22 Thread Juergen Gross via Virtualization
The initial pvops functions handling irq flags will only ever be called before interrupts are being enabled. So make the __init and switch them to be dummy functions: - xen_save_fl() can always return 0 - xen_irq_disable() is a nop - xen_irq_enable() can BUG() Add some generic paravirt functions

[PATCH v2 0/2] x86/xen: simplify irq pvops

2021-09-22 Thread Juergen Gross via Virtualization
The pvops function for Xen PV guests handling the interrupt flag are much more complex than needed. With the supported Xen hypervisor versions they can be simplified a lot, especially by removing the need for disabling preemption. Juergen Gross (2): x86/xen: remove xen_have_vcpu_info_placement

Re: [PATCH] x86/paravirt: use %rip-relative addressing in hook calls

2021-10-05 Thread Juergen Gross via Virtualization
On 30.09.21 14:40, Jan Beulich via Virtualization wrote: While using a plain (constant) address works, its use needlessly invokes a SIB addressing mode, making every call site one byte larger than necessary. Instead of using an "i" constraint with address-of operator and a 'c' operand modifier,

Re: [PATCH v2 2/2] x86/xen: switch initial pvops IRQ functions to dummy ones

2021-09-22 Thread Juergen Gross via Virtualization
On 22.09.21 23:49, Boris Ostrovsky wrote: On 9/22/21 6:31 AM, Juergen Gross wrote: The initial pvops functions handling irq flags will only ever be called before interrupts are being enabled. So make the __init and switch them to be dummy functions: What are you making __init? Oh, sorry,

Re: [PATCH] x86/paravirt: use %rip-relative addressing in hook calls

2021-11-23 Thread Juergen Gross via Virtualization
On 23.11.21 10:29, Jan Beulich wrote: On 05.10.2021 09:43, Juergen Gross wrote: On 30.09.21 14:40, Jan Beulich via Virtualization wrote: While using a plain (constant) address works, its use needlessly invokes a SIB addressing mode, making every call site one byte larger than necessary.

Re: [PATCH v3 3/3] MAINTAINERS: Mark VMware mailing list entries as email aliases

2021-11-11 Thread Juergen Gross via Virtualization
On 10.11.21 21:09, Srivatsa S. Bhat wrote: From: Srivatsa S. Bhat (VMware) VMware mailing lists in the MAINTAINERS file are private lists meant for VMware-internal review/notification for patches to the respective subsystems. Anyone can post to these addresses, but there is no public read

[PATCH v3 2/2] x86/xen: switch initial pvops IRQ functions to dummy ones

2021-10-28 Thread Juergen Gross via Virtualization
The initial pvops functions handling irq flags will only ever be called before interrupts are being enabled. So switch them to be dummy functions: - xen_save_fl() can always return 0 - xen_irq_disable() is a nop - xen_irq_enable() can BUG() Add some generic paravirt functions for that purpose.

[PATCH v3 0/2] x86/xen: simplify irq pvops

2021-10-28 Thread Juergen Gross via Virtualization
The pvops function for Xen PV guests handling the interrupt flag are much more complex than needed. With the supported Xen hypervisor versions they can be simplified a lot, especially by removing the need for disabling preemption. Juergen Gross (2): x86/xen: remove xen_have_vcpu_info_placement

Re: [PATCH 1/2] MAINTAINERS: Update maintainers for paravirt ops and VMware hypervisor interface

2021-11-08 Thread Juergen Gross via Virtualization
On 08.11.21 21:29, Srivatsa S. Bhat wrote: From: Srivatsa S. Bhat (VMware) Deep has decided to transfer maintainership of the VMware hypervisor interface to Srivatsa, and the joint-maintainership of paravirt ops in the Linux kernel to Srivatsa and Alexey. Update the MAINTAINERS file to reflect

Re: [PATCH 2/2] MAINTAINERS: Mark VMware mailing list entries as private

2021-11-08 Thread Juergen Gross via Virtualization
On 08.11.21 21:30, Srivatsa S. Bhat wrote: From: Srivatsa S. Bhat (VMware) VMware mailing lists in the MAINTAINERS file are private lists meant for VMware-internal review/notification for patches to the respective subsystems. So, in an earlier discussion [1][2], it was recommended to mark them

Which tree for paravirt related patches?

2021-11-03 Thread Juergen Gross via Virtualization
A recent patch modifying the core paravirt-ops functionality is highlighting some missing MAINTAINERS information for PARAVIRT_OPS: there is no information which tree is to be used for taking those patches per default. In the past this was mostly handled by the tip tree, and I think this is fine.

Re: [PATCH] x86/paravirt: use %rip-relative addressing in hook calls

2022-01-10 Thread Juergen Gross via Virtualization
On 23.11.21 10:52, Juergen Gross via Virtualization wrote: On 23.11.21 10:29, Jan Beulich wrote: On 05.10.2021 09:43, Juergen Gross wrote: On 30.09.21 14:40, Jan Beulich via Virtualization wrote: While using a plain (constant) address works, its use needlessly invokes a SIB addressing mode

Re: [PATCH V2 03/11] perf/x86: Add support for TSC in nanoseconds as a perf event clock

2022-03-07 Thread Juergen Gross via Virtualization
On 07.03.22 11:38, Peter Zijlstra wrote: On Mon, Mar 07, 2022 at 11:06:46AM +0100, Juergen Gross wrote: diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index 4420499f7bb4..a1f179ed39bf 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c @@ -145,6

Re: [PATCH V2 03/11] perf/x86: Add support for TSC in nanoseconds as a perf event clock

2022-03-07 Thread Juergen Gross via Virtualization
On 07.03.22 10:50, Peter Zijlstra wrote: On Fri, Mar 04, 2022 at 08:27:45PM +0200, Adrian Hunter wrote: On 04/03/2022 15:41, Peter Zijlstra wrote: On Mon, Feb 14, 2022 at 01:09:06PM +0200, Adrian Hunter wrote: Currently, when Intel PT is used within a VM guest, it is not possible to make use

[PATCH 0/3] xen: cleanup and fix lazy mode handling

2023-09-13 Thread Juergen Gross via Virtualization
This small series is cleaning up Xen lazy mode handling by removing unused stuff and moving purely Xen-specific code away from general kernel code. The last patch is fixing a regression which was introduced in the 6.6 merge window. Juergen Gross (3): arm/xen: remove lazy mode related

[PATCH 2/3] x86/xen: move paravirt lazy code

2023-09-13 Thread Juergen Gross via Virtualization
Only Xen is using the paravirt lazy mode code, so it can be moved to Xen specific sources. This allows to make some of the functions static or to merge them into their only call sites. While at it do a rename from "paravirt" to "xen" for all moved specifiers. No functional change.

Re: [PATCH 2/3] x86/xen: move paravirt lazy code

2023-09-13 Thread Juergen Gross via Virtualization
On 13.09.23 15:26, Steven Rostedt wrote: On Wed, 13 Sep 2023 13:38:27 +0200 Juergen Gross wrote: diff --git a/include/trace/events/xen.h b/include/trace/events/xen.h index 44a3f565264d..0577f0cdd231 100644 --- a/include/trace/events/xen.h +++ b/include/trace/events/xen.h @@ -6,26 +6,26 @@

[PATCH v2 3/4] x86/paravirt: switch mixed paravirt/alternative calls to alternative_2

2023-10-16 Thread Juergen Gross via Virtualization
Instead of stacking alternative and paravirt patching, use the new ALT_FLAG_CALL flag to switch those mixed calls to pure alternative handling. This eliminates the need to be careful regarding the sequence of alternative and paravirt patching. For call depth tracking callthunks_setup() needs to

[PATCH v2 4/4] x86/paravirt: remove no longer needed paravirt patching code

2023-10-16 Thread Juergen Gross via Virtualization
Now that paravirt is using the alternatives patching infrastructure, remove the paravirt patching code. Signed-off-by: Juergen Gross --- arch/x86/include/asm/paravirt.h | 18 arch/x86/include/asm/paravirt_types.h | 40 arch/x86/include/asm/text-patching.h | 12

[PATCH v2 0/4] x86/paravirt: Get rid of paravirt patching

2023-10-16 Thread Juergen Gross via Virtualization
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

[PATCH v2 1/4] x86/paravirt: move some functions and defines to alternative

2023-10-16 Thread Juergen Gross via Virtualization
As a preparation for replacing paravirt patching completely by alternative patching, move some backend functions and #defines to alternative code and header. Signed-off-by: Juergen Gross Acked-by: Peter Zijlstra (Intel) --- arch/x86/include/asm/alternative.h| 16

Re: [PATCH v2 3/4] x86/paravirt: switch mixed paravirt/alternative calls to alternative_2

2023-10-16 Thread Juergen Gross via Virtualization
On 16.10.23 16:29, Peter Zijlstra wrote: On Mon, Oct 16, 2023 at 02:39:32PM +0200, Juergen Gross wrote: Instead of stacking alternative and paravirt patching, use the new ALT_FLAG_CALL flag to switch those mixed calls to pure alternative handling. This eliminates the need to be careful

Re: [PATCH v3 1/5] x86/paravirt: move some functions and defines to alternative

2023-10-25 Thread Juergen Gross via Virtualization
On 25.10.23 12:34, Borislav Petkov wrote: On Thu, Oct 19, 2023 at 11:15:16AM +0200, Juergen Gross wrote: +/* Low-level backend functions usable from alternative code replacements. */ +DEFINE_ASM_FUNC(x86_nop, "", .entry.text); +EXPORT_SYMBOL_GPL(x86_nop); This is all x86 code so you don't

  1   2   >