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

Re: [Xen-devel] [PATCH v13 for-xen-4.5 17/21] x86/VPMU: Handle PMU interrupts for PV guests

On 10/13/2014 11:29 AM, Jan Beulich wrote:
On 03.10.14 at 23:40, <boris.ostrovsky@xxxxxxxxxx> wrote:
  int vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content, uint64_t supported)
-    struct vpmu_struct *vpmu = vcpu_vpmu(current);
+    struct vcpu *curr = current;
+    struct vpmu_struct *vpmu = vcpu_vpmu(curr);
if ( !(vpmu_mode & (XENPMU_MODE_SELF | XENPMU_MODE_HV)) )
          return 0;
if ( vpmu->arch_vpmu_ops && vpmu->arch_vpmu_ops->do_wrmsr )
-        return vpmu->arch_vpmu_ops->do_wrmsr(msr, msr_content, supported);
+    {
+        int ret = vpmu->arch_vpmu_ops->do_wrmsr(msr, msr_content, supported);
+        /*
+         * We may have received a PMU interrupt during WRMSR handling
+         * and since do_wrmsr may load VPMU context we should save
+         * (and unload) it again.
+         */
Is this btw true also when do_wrmsr() failed? Or could you not rather
handle ret != 0 before the following if() (or check ret == 0 together
with the other conditions)?

There is indeed no need to save/unload if do_wrmsr() failed but one of conditions in the if() that you refer to (PMU_CACHED bit test) can only happen if do_wrmsr() succeeded because the context could not have been loaded in case of failure.


Xen-devel mailing list



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