x86/intel_rdt: Resctrl files reflect pseudo-locked information
authorReinette Chatre <reinette.chatre@intel.com>
Fri, 22 Jun 2018 22:42:23 +0000 (15:42 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 23 Jun 2018 11:03:50 +0000 (13:03 +0200)
Information about resources as well as resource groups are contained in a
variety of resctrl files. Now that pseudo-locked regions can be created the
files can be updated to present appropriate information to the user.

Update the resource group's schemata file to show only the information of
the pseudo-locked region.

Update the resource group's size file to show the size in bytes of only the
pseudo-locked region.

Update the bit_usage file to use the letter 'P' for all pseudo-locked
regions.

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/5ece82869b651c2178b278e00bca959f7626b6e9.1529706536.git.reinette.chatre@intel.com
arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c

index 6f4c0002b2c11412a005b1b8670c3683be14a2a3..af358ca0516057c8fa7945272867afd737125654 100644 (file)
@@ -402,6 +402,9 @@ int rdtgroup_schemata_show(struct kernfs_open_file *of,
                if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) {
                        for_each_alloc_enabled_rdt_resource(r)
                                seq_printf(s, "%s:uninitialized\n", r->name);
+               } else if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) {
+                       seq_printf(s, "%s:%d=%x\n", rdtgrp->plr->r->name,
+                                  rdtgrp->plr->d->id, rdtgrp->plr->cbm);
                } else {
                        closid = rdtgrp->closid;
                        for_each_alloc_enabled_rdt_resource(r) {
index d3fb7bd8cbba3ecf5fe622869bf5adc03b51f188..f301919ae9b263f6c4dcebd1a3eda044babd91d8 100644 (file)
@@ -771,14 +771,16 @@ static int rdt_shareable_bits_show(struct kernfs_open_file *of,
  *   H - currently used by hardware only but available for software use
  *   S - currently used and shareable by software only
  *   E - currently used exclusively by one resource group
+ *   P - currently pseudo-locked by one resource group
  */
 static int rdt_bit_usage_show(struct kernfs_open_file *of,
                              struct seq_file *seq, void *v)
 {
        struct rdt_resource *r = of->kn->parent->priv;
-       u32 sw_shareable, hw_shareable, exclusive;
+       u32 sw_shareable = 0, hw_shareable = 0;
+       u32 exclusive = 0, pseudo_locked = 0;
        struct rdt_domain *dom;
-       int i, hwb, swb, excl;
+       int i, hwb, swb, excl, psl;
        enum rdtgrp_mode mode;
        bool sep = false;
        u32 *ctrl;
@@ -803,12 +805,15 @@ static int rdt_bit_usage_show(struct kernfs_open_file *of,
                        case RDT_MODE_EXCLUSIVE:
                                exclusive |= *ctrl;
                                break;
+                       case RDT_MODE_PSEUDO_LOCKSETUP:
                        /*
-                        * Temporarily handle pseudo-locking enums
-                        * to silence compile warnings until handling
-                        * added in later patches.
+                        * RDT_MODE_PSEUDO_LOCKSETUP is possible
+                        * here but not included since the CBM
+                        * associated with this CLOSID in this mode
+                        * is not initialized and no task or cpu can be
+                        * assigned this CLOSID.
                         */
-                       case RDT_MODE_PSEUDO_LOCKSETUP:
+                               break;
                        case RDT_MODE_PSEUDO_LOCKED:
                        case RDT_NUM_MODES:
                                WARN(1,
@@ -817,9 +822,11 @@ static int rdt_bit_usage_show(struct kernfs_open_file *of,
                        }
                }
                for (i = r->cache.cbm_len - 1; i >= 0; i--) {
+                       pseudo_locked = dom->plr ? dom->plr->cbm : 0;
                        hwb = test_bit(i, (unsigned long *)&hw_shareable);
                        swb = test_bit(i, (unsigned long *)&sw_shareable);
                        excl = test_bit(i, (unsigned long *)&exclusive);
+                       psl = test_bit(i, (unsigned long *)&pseudo_locked);
                        if (hwb && swb)
                                seq_putc(seq, 'X');
                        else if (hwb && !swb)
@@ -828,6 +835,8 @@ static int rdt_bit_usage_show(struct kernfs_open_file *of,
                                seq_putc(seq, 'S');
                        else if (excl)
                                seq_putc(seq, 'E');
+                       else if (psl)
+                               seq_putc(seq, 'P');
                        else /* Unused bits remain */
                                seq_putc(seq, '0');
                }
@@ -1147,6 +1156,15 @@ static int rdtgroup_size_show(struct kernfs_open_file *of,
                return -ENOENT;
        }
 
+       if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) {
+               seq_printf(s, "%*s:", max_name_width, rdtgrp->plr->r->name);
+               size = rdtgroup_cbm_to_size(rdtgrp->plr->r,
+                                           rdtgrp->plr->d,
+                                           rdtgrp->plr->cbm);
+               seq_printf(s, "%d=%u\n", rdtgrp->plr->d->id, size);
+               goto out;
+       }
+
        for_each_alloc_enabled_rdt_resource(r) {
                seq_printf(s, "%*s:", max_name_width, r->name);
                list_for_each_entry(d, &r->domains, list) {
@@ -1164,6 +1182,7 @@ static int rdtgroup_size_show(struct kernfs_open_file *of,
                seq_putc(s, '\n');
        }
 
+out:
        rdtgroup_kn_unlock(of->kn);
 
        return 0;