Re: [patch V5 09/38] x86/entry: Switch XEN/PV hypercall entry to IDTENTRY

From: Boris Ostrovsky
Date: Thu May 14 2020 - 12:25:53 EST


On 5/12/20 5:01 PM, Thomas Gleixner wrote:
> Convert the XEN/PV hypercall to IDTENTRY:
>
> - Emit the ASM stub with DECLARE_IDTENTRY
> - Remove the ASM idtentry in 64bit
> - Remove the open coded ASM entry code in 32bit
> - Remove the old prototypes
>
> The handler stubs need to stay in ASM code as it needs corner case handling
> and adjustment of the stack pointer.
>
> Provide a new C function which invokes the entry/exit handling and calls
> into the XEN handler on the interrupt stack.
>
> The exit code is slightly different from the regular idtentry_exit() on
> non-preemptible kernels. If the hypercall is preemptible and need_resched()
> is set then XEN provides a preempt hypercall scheduling function. Add it as
> conditional path to __idtentry_exit() so the function can be reused.
>
> __idtentry_exit() is forced inlined so on the regular idtentry_exit() path
> the extra condition is optimized out by the compiler.
>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
> Cc: Juergen Gross <jgross@xxxxxxxx>
> ---
> V5: Move DECLARE_PER_CPU(bool, xen_in_preemptible_hcall) out of ifdeffery
> to avoid #ifdeffery in idtentry_exit().
> Convert to the reworked stack switching helper
> Fixed up the XEN callback initialization (Boris O.)
> ---
> arch/x86/entry/common.c | 57 ++++++++++++++++++++++++++++++++++++++--
> arch/x86/entry/entry_32.S | 17 ++++++-----
> arch/x86/entry/entry_64.S | 22 ++++-----------
> arch/x86/include/asm/idtentry.h | 13 +++++++++
> arch/x86/xen/setup.c | 4 ++
> arch/x86/xen/smp_pv.c | 3 +-
> arch/x86/xen/xen-asm_32.S | 12 ++++----
> arch/x86/xen/xen-asm_64.S | 2 -
> arch/x86/xen/xen-ops.h | 1
> drivers/xen/preempt.c | 2 -
> include/xen/xen-ops.h | 7 +++-
> 11 files changed, 103 insertions(+), 37 deletions(-)


Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>