Re: [PATCH] x86/paravirt: Fix build PARAVIRT_XXL=y without XEN_PV

From: Lai Jiangshan
Date: Fri Nov 19 2021 - 20:23:47 EST


On Fri, Nov 19, 2021 at 6:20 PM Kirill A. Shutemov <kirill@xxxxxxxxxxxxx> wrote:

> > It is part of what CONFIG_PARAVIRT_XXL was designed for to enable
> > pv-aware INTERRUPT_RETURN.
>
> That's very vague statement.
>
> Could you elaborate on what is wrong with proposed fix?
>

Although CONFIG_PARAVIRT_XXL is enabled only when XEN, but they are
separated configs. There is no wrong with the patch, but it is not
justified to narrow the scope of INTERRUPT_RETURN.

How about:

diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index cebec95a7124..4459f853f77b 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -746,10 +746,16 @@ extern void default_banner(void);
#define PARA_SITE(ptype, ops) _PVSITE(ptype, ops, .quad, 8)
#define PARA_INDIRECT(addr) *addr(%rip)

+#ifdef CONFIG_XEN_PV
+#define XEN_IRET "jmp xen_iret;"
+#else
+#define XEN_IRET ""
+#endif
+
#define INTERRUPT_RETURN \
ANNOTATE_RETPOLINE_SAFE; \
ALTERNATIVE_TERNARY("jmp *paravirt_iret(%rip);", \
- X86_FEATURE_XENPV, "jmp xen_iret;", "jmp native_iret;")
+ X86_FEATURE_XENPV, XEN_IRET, "jmp native_iret;")

#ifdef CONFIG_DEBUG_ENTRY
.macro PARA_IRQ_save_fl

And in the patch, INTERRUPT_RETURN is moved at the definition
of SWAPGS, but SWAPGS is going to be removed:

https://lore.kernel.org/lkml/20211026143436.19071-2-jiangshanlai@xxxxxxxxx/