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

Re: [Xen-devel] [PATCH v8 15/19] x86/VPMU: Merge vpmu_rdmsr and vpmu_wrmsr



On 07/29/2014 03:46 AM, Jan Beulich wrote:
On 01.07.14 at 16:37, <boris.ostrovsky@xxxxxxxxxx> wrote:

@@ -99,13 +99,21 @@ int vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
      if ( !(vpmu_mode & XENPMU_MODE_ON) )
          return 0;
- if ( vpmu->arch_vpmu_ops && vpmu->arch_vpmu_ops->do_wrmsr )
+    ASSERT((rw == VPMU_MSR_READ) || (rw == VPMU_MSR_WRITE));
+
+    if ( vpmu->arch_vpmu_ops )
      {
-        int ret = vpmu->arch_vpmu_ops->do_wrmsr(msr, msr_content);
+        int ret;
+ if ( (rw == VPMU_MSR_READ) && vpmu->arch_vpmu_ops->do_rdmsr )
+            ret = vpmu->arch_vpmu_ops->do_rdmsr(msr, msr_content);
+        else if ( vpmu->arch_vpmu_ops->do_wrmsr )
+            ret = vpmu->arch_vpmu_ops->do_wrmsr(msr, *msr_content);
This won't do what you intend if rw == VPMU_MSR_READ but there's
no ->do_rdmsr handler.

Right.

I was actually thinking about dropping checks for ops altogether (everywhere) and adding nop ops when needed (I think cpuid is the only one).

But if I do this it will be sometime later.


-boris


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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