RE: [PATCH v4] hyperv: root partition faults writing to VP ASSIST MSR PAGE

From: Sunil Muthuswamy
Date: Fri Jul 30 2021 - 20:14:40 EST


> hv_common_cpu_die(cpu);
>
> - if (hv_vp_assist_page && hv_vp_assist_page[cpu])
> - wrmsrl(HV_X64_MSR_VP_ASSIST_PAGE, 0);
> + if (hv_vp_assist_page && hv_vp_assist_page[cpu]) {
> + union hv_vp_assist_msr_contents msr = {0};
> + if (hv_root_partition) {
> + /*
> + * For Root partition the VP ASSIST page is mapped to
> + * hypervisor provided page, and thus, we unmap the
> + * page here and nullify it, so that in future we have
> + * correct page address mapped in hv_cpu_init.
> + */
> + memunmap(hv_vp_assist_page[cpu]);
> + hv_vp_assist_page[cpu] = NULL;
> + rdmsrl(HV_X64_MSR_VP_ASSIST_PAGE, msr.as_uint64);

If the vp assist page was previously enabled for root, it will continue to stay enabled
when you 'wrmsr' below. We need to explicitly set the enable bit to 0.

> + }
> + wrmsrl(HV_X64_MSR_VP_ASSIST_PAGE, msr.as_uint64);
> + }