aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFenghua Yu <fenghua.yu@intel.com>2017-07-25 18:39:04 -0400
committerThomas Gleixner <tglx@linutronix.de>2017-08-01 16:41:30 -0400
commit0dd2d7494cd818d06a2ae1cd840cd62124a2d25e (patch)
tree9021ddec571d72febd154583ad8dee5d3f9adc6f
parente33026831bdb5f051499fec6a606f79fe1f94cc8 (diff)
x86/intel_rdt: Show bitmask of shareable resource with other executing units
CPUID.(EAX=0x10, ECX=res#):EBX[31:0] reports a bit mask for a resource. Each set bit within the length of the CBM indicates the corresponding unit of the resource allocation may be used by other entities in the platform (e.g. an integrated graphics engine or hardware units outside the processor core and have direct access to the resource). Each cleared bit within the length of the CBM indicates the corresponding allocation unit can be configured to implement a priority-based allocation scheme without interference with other hardware agents in the system. Bits outside the length of the CBM are reserved. More details on the bit mask are described in x86 Software Developer's Manual. The bitmask is shown in "info" directory for each resource. It's up to user to decide how to use the bitmask within a CBM in a partition to share or isolate a resource with other executing units. Suggested-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: ravi.v.shankar@intel.com Cc: peterz@infradead.org Cc: eranian@google.com Cc: ak@linux.intel.com Cc: davidcc@google.com Cc: vikas.shivappa@linux.intel.com Link: http://lkml.kernel.org/r/20170725223904.12996-1-tony.luck@intel.com
-rw-r--r--Documentation/x86/intel_rdt_ui.txt7
-rw-r--r--arch/x86/kernel/cpu/intel_rdt.c2
-rw-r--r--arch/x86/kernel/cpu/intel_rdt.h3
-rw-r--r--arch/x86/kernel/cpu/intel_rdt_rdtgroup.c16
4 files changed, 28 insertions, 0 deletions
diff --git a/Documentation/x86/intel_rdt_ui.txt b/Documentation/x86/intel_rdt_ui.txt
index 76f21e2ac176..4d8848e4e224 100644
--- a/Documentation/x86/intel_rdt_ui.txt
+++ b/Documentation/x86/intel_rdt_ui.txt
@@ -48,6 +48,13 @@ related to allocation:
48"min_cbm_bits": The minimum number of consecutive bits which 48"min_cbm_bits": The minimum number of consecutive bits which
49 must be set when writing a mask. 49 must be set when writing a mask.
50 50
51"shareable_bits": Bitmask of shareable resource with other executing
52 entities (e.g. I/O). User can use this when
53 setting up exclusive cache partitions. Note that
54 some platforms support devices that have their
55 own settings for cache use which can over-ride
56 these bits.
57
51Memory bandwitdh(MB) subdirectory contains the following files 58Memory bandwitdh(MB) subdirectory contains the following files
52with respect to allocation: 59with respect to allocation:
53 60
diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c
index de26aa7971d4..da4f3898d517 100644
--- a/arch/x86/kernel/cpu/intel_rdt.c
+++ b/arch/x86/kernel/cpu/intel_rdt.c
@@ -193,6 +193,7 @@ static inline bool cache_alloc_hsw_probe(void)
193 r->num_closid = 4; 193 r->num_closid = 4;
194 r->default_ctrl = max_cbm; 194 r->default_ctrl = max_cbm;
195 r->cache.cbm_len = 20; 195 r->cache.cbm_len = 20;
196 r->cache.shareable_bits = 0xc0000;
196 r->cache.min_cbm_bits = 2; 197 r->cache.min_cbm_bits = 2;
197 r->alloc_capable = true; 198 r->alloc_capable = true;
198 r->alloc_enabled = true; 199 r->alloc_enabled = true;
@@ -260,6 +261,7 @@ static void rdt_get_cache_alloc_cfg(int idx, struct rdt_resource *r)
260 r->num_closid = edx.split.cos_max + 1; 261 r->num_closid = edx.split.cos_max + 1;
261 r->cache.cbm_len = eax.split.cbm_len + 1; 262 r->cache.cbm_len = eax.split.cbm_len + 1;
262 r->default_ctrl = BIT_MASK(eax.split.cbm_len + 1) - 1; 263 r->default_ctrl = BIT_MASK(eax.split.cbm_len + 1) - 1;
264 r->cache.shareable_bits = ebx & r->default_ctrl;
263 r->data_width = (r->cache.cbm_len + 3) / 4; 265 r->data_width = (r->cache.cbm_len + 3) / 4;
264 r->alloc_capable = true; 266 r->alloc_capable = true;
265 r->alloc_enabled = true; 267 r->alloc_enabled = true;
diff --git a/arch/x86/kernel/cpu/intel_rdt.h b/arch/x86/kernel/cpu/intel_rdt.h
index 94e488af082e..4040bf1a075c 100644
--- a/arch/x86/kernel/cpu/intel_rdt.h
+++ b/arch/x86/kernel/cpu/intel_rdt.h
@@ -227,12 +227,15 @@ struct msr_param {
227 * @cbm_idx_offset: Offset of CBM index. CBM index is computed by: 227 * @cbm_idx_offset: Offset of CBM index. CBM index is computed by:
228 * closid * cbm_idx_multi + cbm_idx_offset 228 * closid * cbm_idx_multi + cbm_idx_offset
229 * in a cache bit mask 229 * in a cache bit mask
230 * @shareable_bits: Bitmask of shareable resource with other
231 * executing entities
230 */ 232 */
231struct rdt_cache { 233struct rdt_cache {
232 unsigned int cbm_len; 234 unsigned int cbm_len;
233 unsigned int min_cbm_bits; 235 unsigned int min_cbm_bits;
234 unsigned int cbm_idx_mult; 236 unsigned int cbm_idx_mult;
235 unsigned int cbm_idx_offset; 237 unsigned int cbm_idx_offset;
238 unsigned int shareable_bits;
236}; 239};
237 240
238/** 241/**
diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
index c24dd067b9c5..2621ae3f07fc 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -596,6 +596,15 @@ static int rdt_min_cbm_bits_show(struct kernfs_open_file *of,
596 return 0; 596 return 0;
597} 597}
598 598
599static int rdt_shareable_bits_show(struct kernfs_open_file *of,
600 struct seq_file *seq, void *v)
601{
602 struct rdt_resource *r = of->kn->parent->priv;
603
604 seq_printf(seq, "%x\n", r->cache.shareable_bits);
605 return 0;
606}
607
599static int rdt_min_bw_show(struct kernfs_open_file *of, 608static int rdt_min_bw_show(struct kernfs_open_file *of,
600 struct seq_file *seq, void *v) 609 struct seq_file *seq, void *v)
601{ 610{
@@ -712,6 +721,13 @@ static struct rftype res_common_files[] = {
712 .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, 721 .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE,
713 }, 722 },
714 { 723 {
724 .name = "shareable_bits",
725 .mode = 0444,
726 .kf_ops = &rdtgroup_kf_single_ops,
727 .seq_show = rdt_shareable_bits_show,
728 .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE,
729 },
730 {
715 .name = "min_bandwidth", 731 .name = "min_bandwidth",
716 .mode = 0444, 732 .mode = 0444,
717 .kf_ops = &rdtgroup_kf_single_ops, 733 .kf_ops = &rdtgroup_kf_single_ops,