x86/xen: Make set_debugreg() noinstr
authorPeter Zijlstra <peterz@infradead.org>
Thu, 24 Jun 2021 09:41:16 +0000 (11:41 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 17 Sep 2021 11:14:39 +0000 (13:14 +0200)
vmlinux.o: warning: objtool: pv_ops[2]: xen_set_debugreg
vmlinux.o: warning: objtool: pv_ops[2]: native_set_debugreg
vmlinux.o: warning: objtool: exc_debug()+0x3b: call to pv_ops[2]() leaves .noinstr.text section

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20210624095148.687755639@infradead.org
arch/x86/include/asm/paravirt.h
arch/x86/include/asm/xen/hypercall.h
arch/x86/kernel/paravirt.c
arch/x86/xen/enlighten_pv.c

index f48465c66c31ddad47a49bc18cf5acc3844c0368..34da790ac429ef30ea6cc87a92704f3717e06546 100644 (file)
@@ -118,7 +118,7 @@ static __always_inline unsigned long paravirt_get_debugreg(int reg)
        return PVOP_CALL1(unsigned long, cpu.get_debugreg, reg);
 }
 #define get_debugreg(var, reg) var = paravirt_get_debugreg(reg)
-static inline void set_debugreg(unsigned long val, int reg)
+static __always_inline void set_debugreg(unsigned long val, int reg)
 {
        PVOP_VCALL2(cpu.set_debugreg, reg, val);
 }
index af9220258d82369ce9864590895fc9ee8587ec2a..990b8aa179c8d275f012e6ada177072d8265aee5 100644 (file)
@@ -308,7 +308,7 @@ HYPERVISOR_platform_op(struct xen_platform_op *op)
        return _hypercall1(int, platform_op, op);
 }
 
-static inline int
+static __always_inline int
 HYPERVISOR_set_debugreg(int reg, unsigned long value)
 {
        return _hypercall2(int, set_debugreg, reg, value);
index 8af526c41b3421c44fda4c513276091be2c01d98..cdaf8624ea1b451606d7c1db25299fbd7490825c 100644 (file)
@@ -233,6 +233,11 @@ static noinstr unsigned long pv_native_get_debugreg(int regno)
 {
        return native_get_debugreg(regno);
 }
+
+static noinstr void pv_native_set_debugreg(int regno, unsigned long val)
+{
+       native_set_debugreg(regno, val);
+}
 #endif
 
 enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
@@ -260,7 +265,7 @@ struct paravirt_patch_template pv_ops = {
 #ifdef CONFIG_PARAVIRT_XXL
        .cpu.cpuid              = native_cpuid,
        .cpu.get_debugreg       = pv_native_get_debugreg,
-       .cpu.set_debugreg       = native_set_debugreg,
+       .cpu.set_debugreg       = pv_native_set_debugreg,
        .cpu.read_cr0           = native_read_cr0,
        .cpu.write_cr0          = native_write_cr0,
        .cpu.write_cr4          = native_write_cr4,
@@ -386,8 +391,6 @@ struct paravirt_patch_template pv_ops = {
 };
 
 #ifdef CONFIG_PARAVIRT_XXL
-/* At this point, native_get/set_debugreg has real function entries */
-NOKPROBE_SYMBOL(native_set_debugreg);
 NOKPROBE_SYMBOL(native_load_idt);
 
 void (*paravirt_iret)(void) = native_iret;
index 273e1fa8537c3c65572c945db9ea256f3e06091c..2b1a8ba7162901fd5ee6b12ce359eb100792dc16 100644 (file)
@@ -311,7 +311,7 @@ static void __init xen_init_capabilities(void)
        }
 }
 
-static void xen_set_debugreg(int reg, unsigned long val)
+static noinstr void xen_set_debugreg(int reg, unsigned long val)
 {
        HYPERVISOR_set_debugreg(reg, val);
 }