Commit 287f037d authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'x86_cache_for_6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 cache resource control updates from Dave Hansen:
 "These declare the resource control (rectrl) MSRs a bit more normally
  and clean up an unnecessary structure member:

   - Remove unnecessary arch_has_empty_bitmaps structure memory

   - Move rescrtl MSR defines into msr-index.h, like normal MSRs"

* tag 'x86_cache_for_6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/resctrl: Move MSR defines into msr-index.h
  x86/resctrl: Remove arch_has_empty_bitmaps
parents a89ef2aa 97fa21f6
...@@ -4,12 +4,7 @@ ...@@ -4,12 +4,7 @@
#include <linux/bits.h> #include <linux/bits.h>
/* /* CPU model specific register (MSR) numbers. */
* CPU model specific register (MSR) numbers.
*
* Do not add new entries to this file unless the definitions are shared
* between multiple compilation units.
*/
/* x86-64 specific MSRs */ /* x86-64 specific MSRs */
#define MSR_EFER 0xc0000080 /* extended feature register */ #define MSR_EFER 0xc0000080 /* extended feature register */
...@@ -1052,6 +1047,20 @@ ...@@ -1052,6 +1047,20 @@
#define VMX_BASIC_MEM_TYPE_WB 6LLU #define VMX_BASIC_MEM_TYPE_WB 6LLU
#define VMX_BASIC_INOUT 0x0040000000000000LLU #define VMX_BASIC_INOUT 0x0040000000000000LLU
/* Resctrl MSRs: */
/* - Intel: */
#define MSR_IA32_L3_QOS_CFG 0xc81
#define MSR_IA32_L2_QOS_CFG 0xc82
#define MSR_IA32_QM_EVTSEL 0xc8d
#define MSR_IA32_QM_CTR 0xc8e
#define MSR_IA32_PQR_ASSOC 0xc8f
#define MSR_IA32_L3_CBM_BASE 0xc90
#define MSR_IA32_L2_CBM_BASE 0xd10
#define MSR_IA32_MBA_THRTL_BASE 0xd50
/* - AMD: */
#define MSR_IA32_MBA_BW_BASE 0xc0000200
/* MSR_IA32_VMX_MISC bits */ /* MSR_IA32_VMX_MISC bits */
#define MSR_IA32_VMX_MISC_INTEL_PT (1ULL << 14) #define MSR_IA32_VMX_MISC_INTEL_PT (1ULL << 14)
#define MSR_IA32_VMX_MISC_VMWRITE_SHADOW_RO_FIELDS (1ULL << 29) #define MSR_IA32_VMX_MISC_VMWRITE_SHADOW_RO_FIELDS (1ULL << 29)
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/jump_label.h> #include <linux/jump_label.h>
#define IA32_PQR_ASSOC 0x0c8f
/** /**
* struct resctrl_pqr_state - State cache for the PQR MSR * struct resctrl_pqr_state - State cache for the PQR MSR
* @cur_rmid: The cached Resource Monitoring ID * @cur_rmid: The cached Resource Monitoring ID
...@@ -16,8 +14,8 @@ ...@@ -16,8 +14,8 @@
* @default_rmid: The user assigned Resource Monitoring ID * @default_rmid: The user assigned Resource Monitoring ID
* @default_closid: The user assigned cached Class Of Service ID * @default_closid: The user assigned cached Class Of Service ID
* *
* The upper 32 bits of IA32_PQR_ASSOC contain closid and the * The upper 32 bits of MSR_IA32_PQR_ASSOC contain closid and the
* lower 10 bits rmid. The update to IA32_PQR_ASSOC always * lower 10 bits rmid. The update to MSR_IA32_PQR_ASSOC always
* contains both parts, so we need to cache them. This also * contains both parts, so we need to cache them. This also
* stores the user configured per cpu CLOSID and RMID. * stores the user configured per cpu CLOSID and RMID.
* *
...@@ -77,7 +75,7 @@ static void __resctrl_sched_in(void) ...@@ -77,7 +75,7 @@ static void __resctrl_sched_in(void)
if (closid != state->cur_closid || rmid != state->cur_rmid) { if (closid != state->cur_closid || rmid != state->cur_rmid) {
state->cur_closid = closid; state->cur_closid = closid;
state->cur_rmid = rmid; state->cur_rmid = rmid;
wrmsr(IA32_PQR_ASSOC, rmid, closid); wrmsr(MSR_IA32_PQR_ASSOC, rmid, closid);
} }
} }
......
...@@ -575,7 +575,7 @@ static void clear_closid_rmid(int cpu) ...@@ -575,7 +575,7 @@ static void clear_closid_rmid(int cpu)
state->default_rmid = 0; state->default_rmid = 0;
state->cur_closid = 0; state->cur_closid = 0;
state->cur_rmid = 0; state->cur_rmid = 0;
wrmsr(IA32_PQR_ASSOC, 0, 0); wrmsr(MSR_IA32_PQR_ASSOC, 0, 0);
} }
static int resctrl_online_cpu(unsigned int cpu) static int resctrl_online_cpu(unsigned int cpu)
...@@ -828,7 +828,6 @@ static __init void rdt_init_res_defs_intel(void) ...@@ -828,7 +828,6 @@ static __init void rdt_init_res_defs_intel(void)
if (r->rid == RDT_RESOURCE_L3 || if (r->rid == RDT_RESOURCE_L3 ||
r->rid == RDT_RESOURCE_L2) { r->rid == RDT_RESOURCE_L2) {
r->cache.arch_has_sparse_bitmaps = false; r->cache.arch_has_sparse_bitmaps = false;
r->cache.arch_has_empty_bitmaps = false;
r->cache.arch_has_per_cpu_cfg = false; r->cache.arch_has_per_cpu_cfg = false;
r->cache.min_cbm_bits = 1; r->cache.min_cbm_bits = 1;
} else if (r->rid == RDT_RESOURCE_MBA) { } else if (r->rid == RDT_RESOURCE_MBA) {
...@@ -849,7 +848,6 @@ static __init void rdt_init_res_defs_amd(void) ...@@ -849,7 +848,6 @@ static __init void rdt_init_res_defs_amd(void)
if (r->rid == RDT_RESOURCE_L3 || if (r->rid == RDT_RESOURCE_L3 ||
r->rid == RDT_RESOURCE_L2) { r->rid == RDT_RESOURCE_L2) {
r->cache.arch_has_sparse_bitmaps = true; r->cache.arch_has_sparse_bitmaps = true;
r->cache.arch_has_empty_bitmaps = true;
r->cache.arch_has_per_cpu_cfg = true; r->cache.arch_has_per_cpu_cfg = true;
r->cache.min_cbm_bits = 0; r->cache.min_cbm_bits = 0;
} else if (r->rid == RDT_RESOURCE_MBA) { } else if (r->rid == RDT_RESOURCE_MBA) {
......
...@@ -105,8 +105,7 @@ static bool cbm_validate(char *buf, u32 *data, struct rdt_resource *r) ...@@ -105,8 +105,7 @@ static bool cbm_validate(char *buf, u32 *data, struct rdt_resource *r)
return false; return false;
} }
if ((!r->cache.arch_has_empty_bitmaps && val == 0) || if ((r->cache.min_cbm_bits > 0 && val == 0) || val > r->default_ctrl) {
val > r->default_ctrl) {
rdt_last_cmd_puts("Mask out of range\n"); rdt_last_cmd_puts("Mask out of range\n");
return false; return false;
} }
......
...@@ -8,16 +8,6 @@ ...@@ -8,16 +8,6 @@
#include <linux/fs_context.h> #include <linux/fs_context.h>
#include <linux/jump_label.h> #include <linux/jump_label.h>
#define MSR_IA32_L3_QOS_CFG 0xc81
#define MSR_IA32_L2_QOS_CFG 0xc82
#define MSR_IA32_L3_CBM_BASE 0xc90
#define MSR_IA32_L2_CBM_BASE 0xd10
#define MSR_IA32_MBA_THRTL_BASE 0xd50
#define MSR_IA32_MBA_BW_BASE 0xc0000200
#define MSR_IA32_QM_CTR 0x0c8e
#define MSR_IA32_QM_EVTSEL 0x0c8d
#define L3_QOS_CDP_ENABLE 0x01ULL #define L3_QOS_CDP_ENABLE 0x01ULL
#define L2_QOS_CDP_ENABLE 0x01ULL #define L2_QOS_CDP_ENABLE 0x01ULL
......
...@@ -477,7 +477,7 @@ static int pseudo_lock_fn(void *_rdtgrp) ...@@ -477,7 +477,7 @@ static int pseudo_lock_fn(void *_rdtgrp)
* pseudo-locked followed by reading of kernel memory to load it * pseudo-locked followed by reading of kernel memory to load it
* into the cache. * into the cache.
*/ */
__wrmsr(IA32_PQR_ASSOC, rmid_p, rdtgrp->closid); __wrmsr(MSR_IA32_PQR_ASSOC, rmid_p, rdtgrp->closid);
/* /*
* Cache was flushed earlier. Now access kernel memory to read it * Cache was flushed earlier. Now access kernel memory to read it
* into cache region associated with just activated plr->closid. * into cache region associated with just activated plr->closid.
...@@ -513,7 +513,7 @@ static int pseudo_lock_fn(void *_rdtgrp) ...@@ -513,7 +513,7 @@ static int pseudo_lock_fn(void *_rdtgrp)
* Critical section end: restore closid with capacity bitmask that * Critical section end: restore closid with capacity bitmask that
* does not overlap with pseudo-locked region. * does not overlap with pseudo-locked region.
*/ */
__wrmsr(IA32_PQR_ASSOC, rmid_p, closid_p); __wrmsr(MSR_IA32_PQR_ASSOC, rmid_p, closid_p);
/* Re-enable the hardware prefetcher(s) */ /* Re-enable the hardware prefetcher(s) */
wrmsrl(MSR_MISC_FEATURE_CONTROL, saved_msr); wrmsrl(MSR_MISC_FEATURE_CONTROL, saved_msr);
......
...@@ -89,11 +89,12 @@ struct rdt_domain { ...@@ -89,11 +89,12 @@ struct rdt_domain {
/** /**
* struct resctrl_cache - Cache allocation related data * struct resctrl_cache - Cache allocation related data
* @cbm_len: Length of the cache bit mask * @cbm_len: Length of the cache bit mask
* @min_cbm_bits: Minimum number of consecutive bits to be set * @min_cbm_bits: Minimum number of consecutive bits to be set.
* The value 0 means the architecture can support
* zero CBM.
* @shareable_bits: Bitmask of shareable resource with other * @shareable_bits: Bitmask of shareable resource with other
* executing entities * executing entities
* @arch_has_sparse_bitmaps: True if a bitmap like f00f is valid. * @arch_has_sparse_bitmaps: True if a bitmap like f00f is valid.
* @arch_has_empty_bitmaps: True if the '0' bitmap is valid.
* @arch_has_per_cpu_cfg: True if QOS_CFG register for this cache * @arch_has_per_cpu_cfg: True if QOS_CFG register for this cache
* level has CPU scope. * level has CPU scope.
*/ */
...@@ -102,7 +103,6 @@ struct resctrl_cache { ...@@ -102,7 +103,6 @@ struct resctrl_cache {
unsigned int min_cbm_bits; unsigned int min_cbm_bits;
unsigned int shareable_bits; unsigned int shareable_bits;
bool arch_has_sparse_bitmaps; bool arch_has_sparse_bitmaps;
bool arch_has_empty_bitmaps;
bool arch_has_per_cpu_cfg; bool arch_has_per_cpu_cfg;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment