[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] x86/traps: use only one stub function for l/cstar
And place it into .text.cold. Requested-by: Jan Beulich <jbeulich@xxxxxxxx> Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- xen/arch/x86/x86_64/traps.c | 20 +++++++++----------- xen/include/xen/init.h | 1 + 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c index 4d506e2c18..55d60fedcd 100644 --- a/xen/arch/x86/x86_64/traps.c +++ b/xen/arch/x86/x86_64/traps.c @@ -298,19 +298,13 @@ static unsigned int write_stub_trampoline( } DEFINE_PER_CPU(struct stubs, stubs); - -#ifdef CONFIG_PV void lstar_enter(void); void cstar_enter(void); -#else -static inline void lstar_enter(void) -{ - panic("%s called\n", __func__); -} -static inline void cstar_enter(void) +#ifndef CONFIG_PV +static void __cold lcstar_enter(void) { - panic("%s called\n", __func__); + panic("lstar/cstar\n"); } #endif /* CONFIG_PV */ @@ -334,7 +328,9 @@ void subarch_percpu_traps_init(void) wrmsrl(MSR_LSTAR, stub_va); offset = write_stub_trampoline(stub_page + (stub_va & ~PAGE_MASK), stub_va, stack_bottom, - (unsigned long)lstar_enter); + IS_ENABLED(CONFIG_PV) ? + (unsigned long)lstar_enter : + (unsigned long)lcstar_enter); stub_va += offset; if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL || @@ -352,7 +348,9 @@ void subarch_percpu_traps_init(void) wrmsrl(MSR_CSTAR, stub_va); offset += write_stub_trampoline(stub_page + (stub_va & ~PAGE_MASK), stub_va, stack_bottom, - (unsigned long)cstar_enter); + IS_ENABLED(CONFIG_PV) ? + (unsigned long)cstar_enter : + (unsigned long)lcstar_enter); /* Don't consume more than half of the stub space here. */ ASSERT(offset <= STUB_BUF_SIZE / 2); diff --git a/xen/include/xen/init.h b/xen/include/xen/init.h index db06c76fdf..c6b453adfe 100644 --- a/xen/include/xen/init.h +++ b/xen/include/xen/init.h @@ -9,6 +9,7 @@ */ #define __init __text_section(".init.text") #define __exit __text_section(".exit.text") +#define __cold __text_section(".text.cold") #define __initdata __section(".init.data") #define __initconst __section(".init.rodata") #define __initconstrel __section(".init.rodata.rel") -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |