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

Re: [Xen-devel] [PATCH v24 04/15] x86/VPMU: Interface for setting PMU mode and flags



On 06/11/2015 11:23 PM, Tian, Kevin wrote:
From: Boris Ostrovsky [mailto:boris.ostrovsky@xxxxxxxxxx]




+
+    case XENPMU_feature_set:
+        if ( pmu_params.val & ~XENPMU_FEATURE_INTEL_BTS )
+            return -EINVAL;
+
+        spin_lock(&vpmu_lock);
+
+        if ( vpmu_count == 0 )
+            vpmu_features = pmu_params.val;
+        else
+        {
+            printk(XENLOG_WARNING "VPMU: Cannot change features while"
+                                  " active VPMUs exist\n");
+            ret = -EBUSY;
+        }

what about setting same features as existing in vpmu_features?
we should do same check as done in mode setting.


Not sure I follow you. There is only one feature currently that we
support --- BTS. And trying to set any other feature will result in
-EINVAL. What is wrong with trying to set the same bit twice? (except
for being pointless)


My point is whether you want to allow setting same bit twice
when active PMUs exist. From above code it's disallowed
w/ check on vpmu_count. However in earlier code handling
vpmu_mode setting, you actually allow setting same mode
twice:

+        if ( (vpmu_count == 0) || (vpmu_mode == pmu_params.val) ||
+             ((vpmu_mode ^ pmu_params.val) ==
+              (XENPMU_MODE_SELF | XENPMU_MODE_HV)) )
+            vpmu_mode = pmu_params.val;

So I thought you may keep the same policy to allow setting
vpmu_features with same bit twice too.

Oh, I see. You are suggesting changing XENPMU_feature_set to

    if ( (vpmu_count == 0) || (vpmu_features == pmu_params.val) )
       vpmu_features = pmu_params.val;

or dropping '|| (vpmu_mode == pmu_params.val)' from XENPMU_mode_set for consistency's sake?

I suppose I can do that, yes.

-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®.