Skip to content

Commit 7361fac

Browse files
author
Peter Zijlstra
committed
x86/xen: Make set_debugreg() noinstr
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) <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f4afb71 commit 7361fac

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

arch/x86/include/asm/paravirt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static __always_inline unsigned long paravirt_get_debugreg(int reg)
118118
return PVOP_CALL1(unsigned long, cpu.get_debugreg, reg);
119119
}
120120
#define get_debugreg(var, reg) var = paravirt_get_debugreg(reg)
121-
static inline void set_debugreg(unsigned long val, int reg)
121+
static __always_inline void set_debugreg(unsigned long val, int reg)
122122
{
123123
PVOP_VCALL2(cpu.set_debugreg, reg, val);
124124
}

arch/x86/include/asm/xen/hypercall.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ HYPERVISOR_platform_op(struct xen_platform_op *op)
308308
return _hypercall1(int, platform_op, op);
309309
}
310310

311-
static inline int
311+
static __always_inline int
312312
HYPERVISOR_set_debugreg(int reg, unsigned long value)
313313
{
314314
return _hypercall2(int, set_debugreg, reg, value);

arch/x86/kernel/paravirt.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,11 @@ static noinstr unsigned long pv_native_get_debugreg(int regno)
233233
{
234234
return native_get_debugreg(regno);
235235
}
236+
237+
static noinstr void pv_native_set_debugreg(int regno, unsigned long val)
238+
{
239+
native_set_debugreg(regno, val);
240+
}
236241
#endif
237242

238243
enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
@@ -260,7 +265,7 @@ struct paravirt_patch_template pv_ops = {
260265
#ifdef CONFIG_PARAVIRT_XXL
261266
.cpu.cpuid = native_cpuid,
262267
.cpu.get_debugreg = pv_native_get_debugreg,
263-
.cpu.set_debugreg = native_set_debugreg,
268+
.cpu.set_debugreg = pv_native_set_debugreg,
264269
.cpu.read_cr0 = native_read_cr0,
265270
.cpu.write_cr0 = native_write_cr0,
266271
.cpu.write_cr4 = native_write_cr4,
@@ -386,8 +391,6 @@ struct paravirt_patch_template pv_ops = {
386391
};
387392

388393
#ifdef CONFIG_PARAVIRT_XXL
389-
/* At this point, native_get/set_debugreg has real function entries */
390-
NOKPROBE_SYMBOL(native_set_debugreg);
391394
NOKPROBE_SYMBOL(native_load_idt);
392395

393396
void (*paravirt_iret)(void) = native_iret;

arch/x86/xen/enlighten_pv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static void __init xen_init_capabilities(void)
311311
}
312312
}
313313

314-
static void xen_set_debugreg(int reg, unsigned long val)
314+
static noinstr void xen_set_debugreg(int reg, unsigned long val)
315315
{
316316
HYPERVISOR_set_debugreg(reg, val);
317317
}

0 commit comments

Comments
 (0)