Re: [PATCH 1/1] x86/xen: Reset VCPU0 info pointer after shared_info remap

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

 



On 05/07/2018 02:00 PM, van der Linden, Frank wrote:
> Hi Boris,
>
> Thanks for the feedback.
>
> On 5/7/18, 8:13 AM, "Boris Ostrovsky" <boris.ostrovsky@xxxxxxxxxx> wrote:
>
>     > diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
>     > index 6b424da1ce75..c78b3e8fb2e5 100644
>     > --- a/arch/x86/xen/enlighten_hvm.c
>     > +++ b/arch/x86/xen/enlighten_hvm.c
>     > @@ -71,6 +71,19 @@ static void __init xen_hvm_init_mem_mapping(void)
>     >  {
>     >  	early_memunmap(HYPERVISOR_shared_info, PAGE_SIZE);
>     >  	HYPERVISOR_shared_info = __va(PFN_PHYS(shared_info_pfn));
>     > +
>     > +	/*
>     > +	 * The virtual address of the shared_info page has changed, so
>     > +	 * the vcpu_info pointer for VCPU 0 is now stale.
>     
>     Is it "has changed" or "has changed if kaslr is on"?
>
> It's "has changed".  See commit 4ca83dcf4e3bc0c98836dbb97553792ca7ea5429 .  It's a way to make kaslr work, but it's done regardless of whether it's enabled or not.


I completely forgot about this one.


>  
>     > +	 *
>     > +	 * The prepare_boot_cpu callback will re-initialize it via
>     > +	 * xen_vcpu_setup, but we can't rely on that to be called for
>     > +	 * old Xen versions (xen_have_vector_callback == 0).
>     > +	 *
>     > +	 * It is, in any case, bad to have a stale vcpu_info pointer
>     > +	 * so reset it now.
>     > +	 */
>     > +	xen_vcpu_info_reset(0);
>     
>     
>     Why not xen_vcpu_setup(0)?
>     
> Basically, I wanted to be minimally invasive. xen_vcpu_setup does a little more work (tries to do the VCPU placement hypercall), and will be called later in any case. So doing just the basic xen_vcpu_info_reset for VCPU 0 seems like the best way to do it; it just re-iterates what is done for VCPU 0 earlier in boot, which is also a vcpu_info_reset.


OK, fair enough. This should go to stable as well I think (4.12+),
copying them.

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux