diff options
author | Reinette Chatre <reinette.chatre@intel.com> | 2018-06-22 15:42:22 -0700 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2018-06-23 13:03:50 +0200 |
commit | e0bdfe8e36f3fbbdc91e70bf927f743ca23917b0 (patch) | |
tree | 949a5fb1a55cfc5419dd7db042d5329b63288b43 /arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c | |
parent | 018961ae5579016d46ee03587c0ecf673821eedb (diff) | |
download | kernel_replicant_linux-e0bdfe8e36f3fbbdc91e70bf927f743ca23917b0.tar.gz kernel_replicant_linux-e0bdfe8e36f3fbbdc91e70bf927f743ca23917b0.tar.bz2 kernel_replicant_linux-e0bdfe8e36f3fbbdc91e70bf927f743ca23917b0.zip |
x86/intel_rdt: Support creation/removal of pseudo-locked region
The user triggers the creation of a pseudo-locked region when writing a
valid schemata to the schemata file of a resource group in the
pseudo-locksetup mode.
A valid schemata is one that: (1) does not overlap with any other resource
group, (2) does not involve a cache that already contains a pseudo-locked
region within its hierarchy.
After a valid schemata is parsed the system is programmed to associate the
to be pseudo-lock bitmask with the closid associated with the resource
group. With the system set up the pseudo-locked region can be created.
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/8929c3a9e2ba600e79649abe584aa28b8d0ff639.1529706536.git.reinette.chatre@intel.com
Diffstat (limited to 'arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c')
-rw-r--r-- | arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c b/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c index 1ed273220ffa..6f4c0002b2c1 100644 --- a/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c +++ b/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c @@ -143,9 +143,26 @@ int parse_cbm(void *_data, struct rdt_resource *r, struct rdt_domain *d) return -EINVAL; } + /* + * Cannot set up more than one pseudo-locked region in a cache + * hierarchy. + */ + if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP && + rdtgroup_pseudo_locked_in_hierarchy(d)) { + rdt_last_cmd_printf("pseudo-locked region in hierarchy\n"); + return -EINVAL; + } + if (!cbm_validate(data->buf, &cbm_val, r)) return -EINVAL; + if ((rdtgrp->mode == RDT_MODE_EXCLUSIVE || + rdtgrp->mode == RDT_MODE_SHAREABLE) && + rdtgroup_cbm_overlaps_pseudo_locked(d, cbm_val)) { + rdt_last_cmd_printf("CBM overlaps with pseudo-locked region\n"); + return -EINVAL; + } + /* * The CBM may not overlap with the CBM of another closid if * either is exclusive. @@ -199,6 +216,21 @@ next: data.rdtgrp = rdtgrp; if (r->parse_ctrlval(&data, r, d)) return -EINVAL; + if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) { + /* + * In pseudo-locking setup mode and just + * parsed a valid CBM that should be + * pseudo-locked. Only one locked region per + * resource group and domain so just do + * the required initialization for single + * region and return. + */ + rdtgrp->plr->r = r; + rdtgrp->plr->d = d; + rdtgrp->plr->cbm = d->new_ctrl; + d->plr = rdtgrp->plr; + return 0; + } goto next; } } @@ -322,6 +354,16 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of, goto out; } + if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) { + /* + * If pseudo-locking fails we keep the resource group in + * mode RDT_MODE_PSEUDO_LOCKSETUP with its class of service + * active and updated for just the domain the pseudo-locked + * region was requested for. + */ + ret = rdtgroup_pseudo_lock_create(rdtgrp); + } + out: rdtgroup_kn_unlock(of->kn); return ret ?: nbytes; |