[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] x86/traps: use only one stub function for l/cstar



>>> On 08.11.18 at 18:08, <wei.liu2@xxxxxxxxxx> wrote:
> --- 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 */

While I'd be fine with this, ...

> @@ -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);

... to be honest I dislike this. Why not have a single star_enter()
function with lstar_enter and cstar_enter being #define-s to it?

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.