Sunil Muthuswamy
2020-Sep-16 21:34 UTC
[EXTERNAL] Re: [PATCH RFC v1 08/18] x86/hyperv: handling hypercall page setup for root
> > On Tue, Sep 15, 2020 at 12:32:29PM +0200, Vitaly Kuznetsov wrote: > > Wei Liu <wei.liu at kernel.org> writes: > > > > > When Linux is running as the root partition, the hypercall page will > > > have already been setup by Hyper-V. Copy the content over to the > > > allocated page. > > > > And we can't setup a new hypercall page by writing something different > > to HV_X64_MSR_HYPERCALL, right? > > > > My understanding is that we can't, but Sunil can maybe correct me.That is correct. For root partition, the hypervisor has already allocated the hypercall page. The root is required to query the page, map it in its address space and wrmsr to enable it. It cannot change the location of the page. For guest, it can allocate and assign the hypercall page. This is covered a bit in the hypervisor TLFS (section 3.13 in TLFS v6), for the guest side. The root side is not covered there, yet.
Vitaly Kuznetsov
2020-Sep-17 11:06 UTC
[EXTERNAL] Re: [PATCH RFC v1 08/18] x86/hyperv: handling hypercall page setup for root
Sunil Muthuswamy <sunilmut at microsoft.com> writes:>> >> On Tue, Sep 15, 2020 at 12:32:29PM +0200, Vitaly Kuznetsov wrote: >> > Wei Liu <wei.liu at kernel.org> writes: >> > >> > > When Linux is running as the root partition, the hypercall page will >> > > have already been setup by Hyper-V. Copy the content over to the >> > > allocated page. >> > >> > And we can't setup a new hypercall page by writing something different >> > to HV_X64_MSR_HYPERCALL, right? >> > >> >> My understanding is that we can't, but Sunil can maybe correct me. > > That is correct. For root partition, the hypervisor has already allocated the > hypercall page. The root is required to query the page, map it in its address > space and wrmsr to enable it. It cannot change the location of the page. For > guest, it can allocate and assign the hypercall page. This is covered a bit in the > hypervisor TLFS (section 3.13 in TLFS v6), for the guest side. The root side is > not covered there, yet.Ok, so it is guaranteed that root partition doesn't have this page in its address space yet, otherwise it could've been used for something else (in case it's just normal memory from its PoV). Please add a comment about this as it is not really obvious. Thanks, -- Vitaly