Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1696642

[PATCH] x86/intel_rdt: Show bitmask of shareable resource with other executing units

From "Luck, Tony" <tony.luck@intel.com>
Newsgroups linux.kernel
Subject [PATCH] x86/intel_rdt: Show bitmask of shareable resource with other executing units
Date 2017-07-26 00:40 +0200
Message-ID <u7gEG-op-29@gated-at.bofh.it> (permalink)
References <u7fpf-86t-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Fenghua Yu <fenghua.yu@intel.com>

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

[This is the "patch from Reinette" mentioned in part 00/28 of the series
 to add RDT monitoring "Cqm3 patch series").  It's been sitting around
 here for a while, but isn't really a part of that series, just a general
 improvement to RDT/CAT. Applies on top of the 28 parts because it uses the
 new structure names and methods to create a file in RDT directories]

 Documentation/x86/intel_rdt_ui.txt       |  7 +++++++
 arch/x86/kernel/cpu/intel_rdt.c          |  2 ++
 arch/x86/kernel/cpu/intel_rdt.h          |  3 +++
 arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 16 ++++++++++++++++
 4 files changed, 28 insertions(+)

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:
 "min_cbm_bits": 	The minimum number of consecutive bits which
 			must be set when writing a mask.
 
+"shareable_bits":	Bitmask of shareable resource with other executing
+			entities (e.g. I/O). User can use this when
+			setting up exclusive cache partitions. Note that
+			some platforms support devices that have their
+			own settings for cache use which can over-ride
+			these bits.
+
 Memory bandwitdh(MB) subdirectory contains the following files
 with respect to allocation:
 
diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c
index b906e0e3eb57..91917c18a8c2 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)
 		r->num_closid = 4;
 		r->default_ctrl = max_cbm;
 		r->cache.cbm_len = 20;
+		r->cache.shareable_bits = 0xc0000;
 		r->cache.min_cbm_bits = 2;
 		r->alloc_capable = true;
 		r->alloc_enabled = true;
@@ -260,6 +261,7 @@ static void rdt_get_cache_alloc_config(int idx, struct rdt_resource *r)
 	r->num_closid = edx.split.cos_max + 1;
 	r->cache.cbm_len = eax.split.cbm_len + 1;
 	r->default_ctrl = BIT_MASK(eax.split.cbm_len + 1) - 1;
+	r->cache.shareable_bits = ebx & r->default_ctrl;
 	r->data_width = (r->cache.cbm_len + 3) / 4;
 	r->alloc_capable = true;
 	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 {
  * @cbm_idx_offset:	Offset of CBM index. CBM index is computed by:
  *			closid * cbm_idx_multi + cbm_idx_offset
  *			in a cache bit mask
+ * @shareable_bits:	Bitmask of shareable resource with other
+ *			executing entities
  */
 struct rdt_cache {
 	unsigned int	cbm_len;
 	unsigned int	min_cbm_bits;
 	unsigned int	cbm_idx_mult;
 	unsigned int	cbm_idx_offset;
+	unsigned int	shareable_bits;
 };
 
 /**
diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
index 8266ef61dd99..83c126be83bf 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,
 	return 0;
 }
 
+static int rdt_shareable_bits_show(struct kernfs_open_file *of,
+				   struct seq_file *seq, void *v)
+{
+	struct rdt_resource *r = of->kn->parent->priv;
+
+	seq_printf(seq, "%x\n", r->cache.shareable_bits);
+	return 0;
+}
+
 static int rdt_min_bw_show(struct kernfs_open_file *of,
 			     struct seq_file *seq, void *v)
 {
@@ -712,6 +721,13 @@ static struct rftype res_common_files[] = {
 		.fflags		= RF_CTRL_INFO | RFTYPE_RES_CACHE,
 	},
 	{
+		.name		= "shareable_bits",
+		.mode		= 0444,
+		.kf_ops		= &rdtgroup_kf_single_ops,
+		.seq_show	= rdt_shareable_bits_show,
+		.fflags		= RF_CTRL_INFO | RFTYPE_RES_CACHE,
+	},
+	{
 		.name		= "min_bandwidth",
 		.mode		= 0444,
 		.kf_ops		= &rdtgroup_kf_single_ops,
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/28 V2] Cqm3 patch series(along with MBM support) Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-07-25 23:20 +0200
  [PATCH 03/28] x86/intel_rdt: Introduce a common compile option for RDT Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-07-25 23:20 +0200
  [PATCH 05/28] x86/intel_rdt: Mark rdt_root and closid_alloc as static Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-07-25 23:20 +0200
  [PATCH 07/28] x86/intel_rdt: make rdt_resources_all more readable Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-07-25 23:20 +0200
  [PATCH 04/28] x86/intel_rdt: Change file names to accommodate RDT monitor code Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-07-25 23:20 +0200
  [PATCH 21/28] x86/intel_rdt/cqm: Add rmdir support Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-07-25 23:20 +0200
  [PATCH 06/28] x86/intel_rdt: Cleanup namespace to support RDT monitoring Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-07-25 23:20 +0200
  [PATCH 14/28] x86/intel_rdt: Change closid type from int to u32 Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-07-25 23:20 +0200
  [PATCH 20/28] x86/intel_rdt: Separate the ctrl bits from rmdir Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-07-25 23:20 +0200
  [PATCH 22/28] x86/intel_rdt/cqm: Add mount,umount support Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-07-25 23:20 +0200
  [PATCH 09/28] x86/intel_rdt/cqm: Add RMID(Resource monitoring ID) management Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-07-25 23:20 +0200
  [PATCH 16/28] x86/intel_rdt: Prepare to add RDT monitor cpus file support Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-07-25 23:20 +0200
  [PATCH 13/28] x86/intel_rdt/cqm: Add mkdir support for RDT monitoring Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-07-25 23:20 +0200
  [PATCH] x86/intel_rdt: Show bitmask of shareable resource with other executing units "Luck, Tony" <tony.luck@intel.com> - 2017-07-26 00:40 +0200
  [RFC PATCH] Add "-f" and "-F" flags to watch a "/sys? style file (single number) "Luck, Tony" <tony.luck@intel.com> - 2017-07-26 00:50 +0200

csiph-web