x86/intel_rdt: Introduce the Cache Pseudo-Locking modes
authorReinette Chatre <reinette.chatre@intel.com>
Fri, 22 Jun 2018 22:42:08 +0000 (15:42 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 23 Jun 2018 11:03:45 +0000 (13:03 +0200)
The two modes used to manage Cache Pseudo-Locked regions are introduced.  A
resource group is assigned "pseudo-locksetup" mode when the user indicates
that this resource group will be used for a Cache Pseudo-Locked
region. When the Cache Pseudo-Locked region has been set up successfully
after the user wrote the requested schemata to the "schemata" file, then
the mode will automatically changed to "pseudo-locked".  The user is not
able to modify the mode to "pseudo-locked" by writing "pseudo-locked" to
the "mode" file directly.

Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: fenghua.yu@intel.com
Cc: tony.luck@intel.com
Cc: vikas.shivappa@linux.intel.com
Cc: gavin.hindman@intel.com
Cc: jithu.joseph@intel.com
Cc: dave.hansen@intel.com
Cc: hpa@zytor.com
Link: https://lkml.kernel.org/r/98d6ca129bbe7dd0932d1fcfeb3cbb65f29a8d9d.1529706536.git.reinette.chatre@intel.com
arch/x86/kernel/cpu/intel_rdt.h
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c

index ed20e91c28edb3ee14d83a2dd3e2839be7fd4133..7b872f2cc294ce418e3ff3c0fbb8febd3945874b 100644 (file)
@@ -84,15 +84,25 @@ enum rdt_group_type {
  * enum rdtgrp_mode - Mode of a RDT resource group
  * @RDT_MODE_SHAREABLE: This resource group allows sharing of its allocations
  * @RDT_MODE_EXCLUSIVE: No sharing of this resource group's allocations allowed
+ * @RDT_MODE_PSEUDO_LOCKSETUP: Resource group will be used for Pseudo-Locking
+ * @RDT_MODE_PSEUDO_LOCKED: No sharing of this resource group's allocations
+ *                          allowed AND the allocations are Cache Pseudo-Locked
  *
  * The mode of a resource group enables control over the allowed overlap
  * between allocations associated with different resource groups (classes
  * of service). User is able to modify the mode of a resource group by
  * writing to the "mode" resctrl file associated with the resource group.
+ *
+ * The "shareable", "exclusive", and "pseudo-locksetup" modes are set by
+ * writing the appropriate text to the "mode" file. A resource group enters
+ * "pseudo-locked" mode after the schemata is written while the resource
+ * group is in "pseudo-locksetup" mode.
  */
 enum rdtgrp_mode {
        RDT_MODE_SHAREABLE = 0,
        RDT_MODE_EXCLUSIVE,
+       RDT_MODE_PSEUDO_LOCKSETUP,
+       RDT_MODE_PSEUDO_LOCKED,
 
        /* Must be last */
        RDT_NUM_MODES,
index cde0f4114d4ed44ef18d38e57aa6ec3f03319d15..fef92b939f0f232dfd73a32423e4fa5583260033 100644 (file)
@@ -161,8 +161,10 @@ enum rdtgrp_mode rdtgroup_mode_by_closid(int closid)
 }
 
 static const char * const rdt_mode_str[] = {
-       [RDT_MODE_SHAREABLE]    = "shareable",
-       [RDT_MODE_EXCLUSIVE]    = "exclusive",
+       [RDT_MODE_SHAREABLE]            = "shareable",
+       [RDT_MODE_EXCLUSIVE]            = "exclusive",
+       [RDT_MODE_PSEUDO_LOCKSETUP]     = "pseudo-locksetup",
+       [RDT_MODE_PSEUDO_LOCKED]        = "pseudo-locked",
 };
 
 /**
@@ -759,6 +761,13 @@ static int rdt_bit_usage_show(struct kernfs_open_file *of,
                        case RDT_MODE_EXCLUSIVE:
                                exclusive |= *ctrl;
                                break;
+                       /*
+                        * Temporarily handle pseudo-locking enums
+                        * to silence compile warnings until handling
+                        * added in later patches.
+                        */
+                       case RDT_MODE_PSEUDO_LOCKSETUP:
+                       case RDT_MODE_PSEUDO_LOCKED:
                        case RDT_NUM_MODES:
                                WARN(1,
                                     "invalid mode for closid %d\n", i);