Skip to contentSkip to conversation

x86/cache: Updates for 4.10

GIT PULL Thomas Gleixner 4 participants 5 messages Dec 12, 2016 – Dec 17, 2016

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

Linus,

please pull the latest x86-cache-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-cache-for-linus

This update provides the support for Intel Cache Allocation Technology, a cache partitioning mechanism.

Thanks,

tglx

------------------>
Borislav Petkov (1):
x86/intel_rdt: Add a missing #include

Fenghua Yu (20):
cacheinfo: Introduce cache id
x86/intel_cacheinfo: Enable cache id in cache info x86/cpufeature: Add RDT CPUID feature bits
x86/intel_rdt: Add CONFIG, Makefile, and basic initialization x86/intel_rdt: Add Haswell feature discovery
x86/intel_rdt: Pick up L3/L2 RDT parameters from CPUID
x86/cqm: Share PQR_ASSOC related data between CQM and CAT Documentation, x86: Documentation for Intel resource allocation user interface x86/intel_rdt: Add basic resctrl filesystem support x86/intel_rdt: Add "info" files to resctrl file system x86/intel_rdt: Add mkdir to resctrl file system
x86/intel_rdt: Add tasks files
x86/intel_rdt: Add scheduler hook
MAINTAINERS: Add maintainer for Intel RDT resource allocation x86/intel_rdt: Protect info directory from removal x86/intel_rdt: Reset per cpu closids on unmount
x86/intel_rdt: Update percpu closid immeditately on CPUs affected by changee x86/intel_rdt: Fix setting of closid when adding CPUs to a group x86/intel_rdt: Update task closid immediately on CPU in rmdir and unmount x86/intel_rdt: Call intel_rdt_sched_in() with preemption disabled

He Chen (2):
x86/cpuid: Cleanup cpuid_regs definitions x86/cpuid: Provide get_scattered_cpuid_leaf()

Shaohua Li (3):
x86/intel_rdt: Propagate error in rdt_mount() properly x86/intel_rdt: Export the minimum number of set mask bits in sysfs x86/intel_rdt: Implement show_options() for resctrlfs

Thomas Gleixner (3):
x86/intel_rdt: Add info files to Documentation x86/intel_rdt: Prevent deadlock against hotplug lock x86/intel_rdt: Select KERNFS when enabling INTEL_RDT_A

Tony Luck (4):
Documentation, ABI: Document the new sysfs files for cpu cache ids x86/intel_rdt: Build structures for each resource based on cache topology x86/intel_rdt: Add cpus file
x86/intel_rdt: Add schemata file

 Documentation/ABI/testing/sysfs-devices-system-cpu |   16 +
 Documentation/x86/intel_rdt_ui.txt                 |  214 ++++
 MAINTAINERS                                        |    8 +
 arch/x86/Kconfig                                   |   13 +
 arch/x86/events/intel/cqm.c                        |   23 +-
 arch/x86/events/intel/pt.c                         |   45 +-
 arch/x86/include/asm/cpufeatures.h                 |    4 +
 arch/x86/include/asm/intel_rdt.h                   |  224 ++++
 arch/x86/include/asm/intel_rdt_common.h            |   27 +
 arch/x86/include/asm/processor.h                   |   14 +
 arch/x86/kernel/cpu/Makefile                       |    2 +
 arch/x86/kernel/cpu/intel_cacheinfo.c              |   20 +
 arch/x86/kernel/cpu/intel_rdt.c                    |  403 +++++++
 arch/x86/kernel/cpu/intel_rdt_rdtgroup.c           | 1115 ++++++++++++++++++++
 arch/x86/kernel/cpu/intel_rdt_schemata.c           |  245 +++++
 arch/x86/kernel/cpu/scattered.c                    |   60 +-
 arch/x86/kernel/cpuid.c                            |    4 -
 arch/x86/kernel/process_32.c                       |    4 +
 arch/x86/kernel/process_64.c                       |    4 +
 drivers/base/cacheinfo.c                           |    5 +
 include/linux/cacheinfo.h                          |    3 +
 include/linux/sched.h                              |    3 +
 include/uapi/linux/magic.h                         |    1 +
 23 files changed, 2387 insertions(+), 70 deletions(-)
 create mode 100644 Documentation/x86/intel_rdt_ui.txt
 create mode 100644 arch/x86/include/asm/intel_rdt.h
 create mode 100644 arch/x86/include/asm/intel_rdt_common.h
 create mode 100644 arch/x86/kernel/cpu/intel_rdt.c
 create mode 100644 arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
 create mode 100644 arch/x86/kernel/cpu/intel_rdt_schemata.c
Documentation/ABI/testing/sysfs-devices-system-cpu +16 -0
index 498741737055..2a4a423d08e0 100644
@@ -272,6 +272,22 @@ Description:	Parameters for the CPU cache attributes
 				     the modified cache line is written to main
 				     memory only when it is replaced
 
+
+What:		/sys/devices/system/cpu/cpu*/cache/index*/id
+Date:		September 2016
+Contact:	Linux kernel mailing list <[email protected]>
+Description:	Cache id
+
+		The id provides a unique number for a specific instance of
+		a cache of a particular type. E.g. there may be a level
+		3 unified cache on each socket in a server and we may
+		assign them ids 0, 1, 2, ...
+
+		Note that id value can be non-contiguous. E.g. level 1
+		caches typically exist per core, but there may not be a
+		power of two cores on a socket, so these caches may be
+		numbered 0, 1, 2, 3, 4, 5, 8, 9, 10, ...
+
 What:		/sys/devices/system/cpu/cpuX/cpufreq/throttle_stats
 		/sys/devices/system/cpu/cpuX/cpufreq/throttle_stats/turbo_stat
 		/sys/devices/system/cpu/cpuX/cpufreq/throttle_stats/sub_turbo_stat
Documentation/x86/intel_rdt_ui.txt new file +214 -0

214 lines not on this page · raw message

MAINTAINERS +8 -0
index 851b89b9edcb..c6a3d8c86f6f 100644
@@ -10122,6 +10122,14 @@ L:	[email protected]
 S:	Supported
 F:	drivers/infiniband/sw/rdmavt
 
+RDT - RESOURCE ALLOCATION
+M:	Fenghua Yu <[email protected]>
+L:	[email protected]
+S:	Supported
+F:	arch/x86/kernel/cpu/intel_rdt*
+F:	arch/x86/include/asm/intel_rdt*
+F:	Documentation/x86/intel_rdt*
+
 READ-COPY UPDATE (RCU)
 M:	"Paul E. McKenney" <[email protected]>
 M:	Josh Triplett <[email protected]>
arch/x86/Kconfig +13 -0
index bada636d1065..dcca4ec42770 100644
@@ -407,6 +407,19 @@ config GOLDFISH
        def_bool y
        depends on X86_GOLDFISH
 
+config INTEL_RDT_A
+	bool "Intel Resource Director Technology Allocation support"
+	default n
+	depends on X86 && CPU_SUP_INTEL
+	select KERNFS
+	help
+	  Select to enable resource allocation which is a sub-feature of
+	  Intel Resource Director Technology(RDT). More information about
+	  RDT can be found in the Intel x86 Architecture Software
+	  Developer Manual.
+
+	  Say N if unsure.
+
 if X86_32
 config X86_EXTENDED_PLATFORM
 	bool "Support for extended (non-PC) x86 platforms"
arch/x86/events/intel/cqm.c +2 -21
index 8f82b02934fa..0c45cc8e64ba 100644
@@ -7,9 +7,9 @@
 #include <linux/perf_event.h>
 #include <linux/slab.h>
 #include <asm/cpu_device_id.h>
+#include <asm/intel_rdt_common.h>
 #include "../perf_event.h"
 
-#define MSR_IA32_PQR_ASSOC	0x0c8f
 #define MSR_IA32_QM_CTR		0x0c8e
 #define MSR_IA32_QM_EVTSEL	0x0c8d
 
@@ -24,32 +24,13 @@ static unsigned int cqm_l3_scale; /* supposedly cacheline size */
 static bool cqm_enabled, mbm_enabled;
 unsigned int mbm_socket_max;
 
-/**
- * struct intel_pqr_state - State cache for the PQR MSR
- * @rmid:		The cached Resource Monitoring ID
- * @closid:		The cached Class Of Service ID
- * @rmid_usecnt:	The usage counter for rmid
- *
- * The upper 32 bits of MSR_IA32_PQR_ASSOC contain closid and the
- * lower 10 bits rmid. The update to MSR_IA32_PQR_ASSOC always
- * contains both parts, so we need to cache them.
- *
- * The cache also helps to avoid pointless updates if the value does
- * not change.
- */
-struct intel_pqr_state {
-	u32			rmid;
-	u32			closid;
-	int			rmid_usecnt;
-};
-
 /*
  * The cached intel_pqr_state is strictly per CPU and can never be
  * updated from a remote CPU. Both functions which modify the state
  * (intel_cqm_event_start and intel_cqm_event_stop) are called with
  * interrupts disabled, which is sufficient for the protection.
  */
-static DEFINE_PER_CPU(struct intel_pqr_state, pqr_state);
+DEFINE_PER_CPU(struct intel_pqr_state, pqr_state);
 static struct hrtimer *mbm_timers;
 /**
  * struct sample - mbm event's (local or total) data
arch/x86/events/intel/pt.c +19 -26

63 lines not on this page · raw message

arch/x86/include/asm/cpufeatures.h +4 -0
index a39629206864..90b8c0b185c3 100644
@@ -189,6 +189,9 @@
 
 #define X86_FEATURE_CPB		( 7*32+ 2) /* AMD Core Performance Boost */
 #define X86_FEATURE_EPB		( 7*32+ 3) /* IA32_ENERGY_PERF_BIAS support */
+#define X86_FEATURE_CAT_L3	( 7*32+ 4) /* Cache Allocation Technology L3 */
+#define X86_FEATURE_CAT_L2	( 7*32+ 5) /* Cache Allocation Technology L2 */
+#define X86_FEATURE_CDP_L3	( 7*32+ 6) /* Code and Data Prioritization L3 */
 
 #define X86_FEATURE_HW_PSTATE	( 7*32+ 8) /* AMD HW-PState */
 #define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */
@@ -221,6 +224,7 @@
 #define X86_FEATURE_RTM		( 9*32+11) /* Restricted Transactional Memory */
 #define X86_FEATURE_CQM		( 9*32+12) /* Cache QoS Monitoring */
 #define X86_FEATURE_MPX		( 9*32+14) /* Memory Protection Extension */
+#define X86_FEATURE_RDT_A	( 9*32+15) /* Resource Director Technology Allocation */
 #define X86_FEATURE_AVX512F	( 9*32+16) /* AVX-512 Foundation */
 #define X86_FEATURE_AVX512DQ	( 9*32+17) /* AVX-512 DQ (Double/Quad granular) Instructions */
 #define X86_FEATURE_RDSEED	( 9*32+18) /* The RDSEED instruction */
arch/x86/include/asm/intel_rdt.h new file +224 -0

224 lines not on this page · raw message

arch/x86/include/asm/intel_rdt_common.h new file +27 -0
new file mode 100644
index 000000000000..b31081b89407
@@ -0,0 +1,27 @@
+#ifndef _ASM_X86_INTEL_RDT_COMMON_H
+#define _ASM_X86_INTEL_RDT_COMMON_H
+
+#define MSR_IA32_PQR_ASSOC	0x0c8f
+
+/**
+ * struct intel_pqr_state - State cache for the PQR MSR
+ * @rmid:		The cached Resource Monitoring ID
+ * @closid:		The cached Class Of Service ID
+ * @rmid_usecnt:	The usage counter for rmid
+ *
+ * The upper 32 bits of MSR_IA32_PQR_ASSOC contain closid and the
+ * lower 10 bits rmid. The update to MSR_IA32_PQR_ASSOC always
+ * contains both parts, so we need to cache them.
+ *
+ * The cache also helps to avoid pointless updates if the value does
+ * not change.
+ */
+struct intel_pqr_state {
+	u32			rmid;
+	u32			closid;
+	int			rmid_usecnt;
+};
+
+DECLARE_PER_CPU(struct intel_pqr_state, pqr_state);
+
+#endif /* _ASM_X86_INTEL_RDT_COMMON_H */
arch/x86/include/asm/processor.h +14 -0
index 984a7bf17f6a..e7f8c62701d4 100644
@@ -137,6 +137,17 @@ struct cpuinfo_x86 {
 	u32			microcode;
 };
 
+struct cpuid_regs {
+	u32 eax, ebx, ecx, edx;
+};
+
+enum cpuid_regs_idx {
+	CPUID_EAX = 0,
+	CPUID_EBX,
+	CPUID_ECX,
+	CPUID_EDX,
+};
+
 #define X86_VENDOR_INTEL	0
 #define X86_VENDOR_CYRIX	1
 #define X86_VENDOR_AMD		2
@@ -178,6 +189,9 @@ extern void identify_secondary_cpu(struct cpuinfo_x86 *);
 extern void print_cpu_info(struct cpuinfo_x86 *);
 void print_cpu_msr(struct cpuinfo_x86 *);
 extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
+extern u32 get_scattered_cpuid_leaf(unsigned int level,
+				    unsigned int sub_leaf,
+				    enum cpuid_regs_idx reg);
 extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
 extern void init_amd_cacheinfo(struct cpuinfo_x86 *c);
 
arch/x86/kernel/cpu/Makefile +2 -0
index 4a8697f7d4ef..c9f8c818d104 100644
@@ -34,6 +34,8 @@ obj-$(CONFIG_CPU_SUP_CENTAUR)		+= centaur.o
 obj-$(CONFIG_CPU_SUP_TRANSMETA_32)	+= transmeta.o
 obj-$(CONFIG_CPU_SUP_UMC_32)		+= umc.o
 
+obj-$(CONFIG_INTEL_RDT_A)	+= intel_rdt.o intel_rdt_rdtgroup.o intel_rdt_schemata.o
+
 obj-$(CONFIG_X86_MCE)			+= mcheck/
 obj-$(CONFIG_MTRR)			+= mtrr/
 obj-$(CONFIG_MICROCODE)			+= microcode/
arch/x86/kernel/cpu/intel_cacheinfo.c +20 -0
index de6626c18e42..8dc572085fb4 100644
@@ -153,6 +153,7 @@ struct _cpuid4_info_regs {
 	union _cpuid4_leaf_eax eax;
 	union _cpuid4_leaf_ebx ebx;
 	union _cpuid4_leaf_ecx ecx;
+	unsigned int id;
 	unsigned long size;
 	struct amd_northbridge *nb;
 };
@@ -894,6 +895,8 @@ static void __cache_cpumap_setup(unsigned int cpu, int index,
 static void ci_leaf_init(struct cacheinfo *this_leaf,
 			 struct _cpuid4_info_regs *base)
 {
+	this_leaf->id = base->id;
+	this_leaf->attributes = CACHE_ID;
 	this_leaf->level = base->eax.split.level;
 	this_leaf->type = cache_type_map[base->eax.split.type];
 	this_leaf->coherency_line_size =
@@ -920,6 +923,22 @@ static int __init_cache_level(unsigned int cpu)
 	return 0;
 }
 
+/*
+ * The max shared threads number comes from CPUID.4:EAX[25-14] with input
+ * ECX as cache index. Then right shift apicid by the number's order to get
+ * cache id for this cache node.
+ */
+static void get_cache_id(int cpu, struct _cpuid4_info_regs *id4_regs)
+{
+	struct cpuinfo_x86 *c = &cpu_data(cpu);
+	unsigned long num_threads_sharing;
+	int index_msb;
+
+	num_threads_sharing = 1 + id4_regs->eax.split.num_threads_sharing;
+	index_msb = get_count_order(num_threads_sharing);
+	id4_regs->id = c->apicid >> index_msb;
+}
+
 static int __populate_cache_leaves(unsigned int cpu)
 {
 	unsigned int idx, ret;
@@ -931,6 +950,7 @@ static int __populate_cache_leaves(unsigned int cpu)
 		ret = cpuid4_cache_lookup_regs(idx, &id4_regs);
 		if (ret)
 			return ret;
+		get_cache_id(cpu, &id4_regs);
 		ci_leaf_init(this_leaf++, &id4_regs);
 		__cache_cpumap_setup(cpu, idx, &id4_regs);
 	}
arch/x86/kernel/cpu/intel_rdt.c new file +403 -0

403 lines not on this page · raw message

arch/x86/kernel/cpu/intel_rdt_rdtgroup.c new file +1115 -0

1,115 lines not on this page · raw message

arch/x86/kernel/cpu/intel_rdt_schemata.c new file +245 -0

245 lines not on this page · raw message

arch/x86/kernel/cpu/scattered.c +41 -19

80 lines not on this page · raw message

arch/x86/kernel/cpuid.c +0 -4
index 2836de390f95..9095c80723d6 100644
@@ -46,10 +46,6 @@
 
 static struct class *cpuid_class;
 
-struct cpuid_regs {
-	u32 eax, ebx, ecx, edx;
-};
-
 static void cpuid_smp_cpuid(void *cmd_block)
 {
 	struct cpuid_regs *cmd = (struct cpuid_regs *)cmd_block;
arch/x86/kernel/process_32.c +4 -0
index bd7be8efdc4c..efe7f9fce44e 100644
@@ -54,6 +54,7 @@
 #include <asm/debugreg.h>
 #include <asm/switch_to.h>
 #include <asm/vm86.h>
+#include <asm/intel_rdt.h>
 
 void __show_regs(struct pt_regs *regs, int all)
 {
@@ -299,5 +300,8 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
 
 	this_cpu_write(current_task, next_p);
 
+	/* Load the Intel cache allocation PQR MSR. */
+	intel_rdt_sched_in();
+
 	return prev_p;
 }
arch/x86/kernel/process_64.c +4 -0
index b3760b3c1ca0..acd7d6f507af 100644
@@ -50,6 +50,7 @@
 #include <asm/switch_to.h>
 #include <asm/xen/hypervisor.h>
 #include <asm/vdso.h>
+#include <asm/intel_rdt.h>
 
 __visible DEFINE_PER_CPU(unsigned long, rsp_scratch);
 
@@ -473,6 +474,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
 			loadsegment(ss, __KERNEL_DS);
 	}
 
+	/* Load the Intel cache allocation PQR MSR. */
+	intel_rdt_sched_in();
+
 	return prev_p;
 }
 
drivers/base/cacheinfo.c +5 -0
index e9fd32e91668..00a9688043f4 100644
@@ -233,6 +233,7 @@ static ssize_t file_name##_show(struct device *dev,		\
 	return sprintf(buf, "%u\n", this_leaf->object);		\
 }
 
+show_one(id, id);
 show_one(level, level);
 show_one(coherency_line_size, coherency_line_size);
 show_one(number_of_sets, number_of_sets);
@@ -314,6 +315,7 @@ static ssize_t write_policy_show(struct device *dev,
 	return n;
 }
 
+static DEVICE_ATTR_RO(id);
 static DEVICE_ATTR_RO(level);
 static DEVICE_ATTR_RO(type);
 static DEVICE_ATTR_RO(coherency_line_size);
@@ -327,6 +329,7 @@ static DEVICE_ATTR_RO(shared_cpu_list);
 static DEVICE_ATTR_RO(physical_line_partition);
 
 static struct attribute *cache_default_attrs[] = {
+	&dev_attr_id.attr,
 	&dev_attr_type.attr,
 	&dev_attr_level.attr,
 	&dev_attr_shared_cpu_map.attr,
@@ -350,6 +353,8 @@ cache_default_attrs_is_visible(struct kobject *kobj,
 	const struct cpumask *mask = &this_leaf->shared_cpu_map;
 	umode_t mode = attr->mode;
 
+	if ((attr == &dev_attr_id.attr) && (this_leaf->attributes & CACHE_ID))
+		return mode;
 	if ((attr == &dev_attr_type.attr) && this_leaf->type)
 		return mode;
 	if ((attr == &dev_attr_level.attr) && this_leaf->level)
include/linux/cacheinfo.h +3 -0
index 2189935075b4..0bcbb674da9d 100644
@@ -18,6 +18,7 @@ enum cache_type {
 
 /**
  * struct cacheinfo - represent a cache leaf node
+ * @id: This cache's id. It is unique among caches with the same (type, level).
  * @type: type of the cache - data, inst or unified
  * @level: represents the hierarchy in the multi-level cache
  * @coherency_line_size: size of each cache line usually representing
@@ -44,6 +45,7 @@ enum cache_type {
  * keeping, the remaining members form the core properties of the cache
  */
 struct cacheinfo {
+	unsigned int id;
 	enum cache_type type;
 	unsigned int level;
 	unsigned int coherency_line_size;
@@ -61,6 +63,7 @@ struct cacheinfo {
 #define CACHE_WRITE_ALLOCATE	BIT(3)
 #define CACHE_ALLOCATE_POLICY_MASK	\
 	(CACHE_READ_ALLOCATE | CACHE_WRITE_ALLOCATE)
+#define CACHE_ID		BIT(4)
 
 	struct device_node *of_node;
 	bool disable_sysfs;
include/linux/sched.h +3 -0
index 348f51b0ec92..c8f4152e7265 100644
@@ -1791,6 +1791,9 @@ struct task_struct {
 	/* cg_list protected by css_set_lock and tsk->alloc_lock */
 	struct list_head cg_list;
 #endif
+#ifdef CONFIG_INTEL_RDT_A
+	int closid;
+#endif
 #ifdef CONFIG_FUTEX
 	struct robust_list_head __user *robust_list;
 #ifdef CONFIG_COMPAT
include/uapi/linux/magic.h +1 -0
index 9bd559472c92..e230af2e6855 100644
@@ -57,6 +57,7 @@
 #define CGROUP_SUPER_MAGIC	0x27e0eb
 #define CGROUP2_SUPER_MAGIC	0x63677270
 
+#define RDTGROUP_SUPER_MAGIC	0x7655821
 
 #define STACK_END_MAGIC		0x57AC6E9D
 
#1 lore raw
Quoted 3 lines · Thomas Gleixner

This update provides the support for Intel Cache Allocation Technology, a cache partitioning mechanism.

Ugh, this is some funky stuff. And it's entirely x86-specific, with a rather odd special filesystem interface.

It looks pretty self-contained (good), but it also looks majorly strange. I will have to think about this. What are the main/expected users?

Linus

maintainer
#2 lore raw
Quoted 5 lines · Linus Torvalds
Quoted 3 lines · Thomas Gleixner

This update provides the support for Intel Cache Allocation Technology, a cache partitioning mechanism.

Quoted 8 lines

Ugh, this is some funky stuff. And it's entirely x86-specific, with a rather odd special filesystem interface.

It looks pretty self-contained (good), but it also looks majorly strange. I will have to think about this. What are the main/expected users?

From what I know its aimed at two groups of users:

Firstly the Virtual Machine usecase, where, by assigning cache masks to individual VMs you avoid one highly active VM trashing the cache of another.

Secondly the Real-Time usecase, where we can assign cache slices to individual CPUs such that we can better isolate RT and !RT workloads running on the same cache domain (socket).

#3 lore raw
In reply to Linus Torvalds
Quoted 4 lines · Linus Torvalds
Quoted 3 lines · Thomas Gleixner

This update provides the support for Intel Cache Allocation Technology, a cache partitioning mechanism.

Sorry for being terse in the pull request.

Quoted 2 lines

Ugh, this is some funky stuff. And it's entirely x86-specific, with a rather odd special filesystem interface.

Yes. The interface is odd, but the hardware interface of that CAT stuff is odd as well.

We tried hard to come up with an abstraction, but that only allows rather simple partitioning, but no way of sharing and dealing with the per package nature of this mechanism.

In the end we decided to expose the allocation bitmaps directly so all combinations of the hardware can be utilized.

There are two ways of associating a cache partition:

- Task

A task can be added to a resource group. It uses the cache partition associated to the group.

- CPU

All tasks which are not member of a resource group use the group to which the CPU they are running on is associated with.

That allows for simple CPU based partitioning schemes.

Quoted 3 lines

It looks pretty self-contained (good), but it also looks majorly strange. I will have to think about this. What are the main/expected users?

- Virtualization so a VM can only trash only the associated part of the cash w/o disturbing others

- Real-Time systems to seperate RT and general workloads.

- Latency sensitive enterprise workloads

- In theory this also can be used to protect against cache side channel attacks.

Thanks,

tglx

#4 lore raw
Quoted 9 lines · Thomas Gleixner
Quoted 3 lines · Linus Torvalds

On Mon, Dec 12, 2016 at 1:53 AM, Thomas Gleixner <[email protected]> wrote:
Ugh, this is some funky stuff. And it's entirely x86-specific, with a rather odd special filesystem interface.

Yes. The interface is odd, but the hardware interface of that CAT stuff is odd as well.

Quoted 6 lines

We tried hard to come up with an abstraction, but that only allows rather simple partitioning, but no way of sharing and dealing with the per package nature of this mechanism.

In the end we decided to expose the allocation bitmaps directly so all combinations of the hardware can be utilized.

Note that there are going to be more resources that can be controlled using the same mechanism (PQR_ASSOC.CLOSID indexes into an array of resource specific MSRs that specify how much of the resource is available to the current process). Next one should be along fairly soon. Keep an eye on chapter 17 in volume 3 of the SDM.

The code changes for this next resource involve new validation functions (the resource isn't a cache, and the MSRs for it aren't bitmasks). But I think it extends nicely.

-Tony