Skip to content

Commit 287f037

Browse files
committed
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
2 parents a89ef2a + 97fa21f commit 287f037

File tree

7 files changed

+25
-31
lines changed

7 files changed

+25
-31
lines changed

arch/x86/include/asm/msr-index.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44

55
#include <linux/bits.h>
66

7-
/*
8-
* CPU model specific register (MSR) numbers.
9-
*
10-
* Do not add new entries to this file unless the definitions are shared
11-
* between multiple compilation units.
12-
*/
7+
/* CPU model specific register (MSR) numbers. */
138

149
/* x86-64 specific MSRs */
1510
#define MSR_EFER 0xc0000080 /* extended feature register */
@@ -1052,6 +1047,20 @@
10521047
#define VMX_BASIC_MEM_TYPE_WB 6LLU
10531048
#define VMX_BASIC_INOUT 0x0040000000000000LLU
10541049

1050+
/* Resctrl MSRs: */
1051+
/* - Intel: */
1052+
#define MSR_IA32_L3_QOS_CFG 0xc81
1053+
#define MSR_IA32_L2_QOS_CFG 0xc82
1054+
#define MSR_IA32_QM_EVTSEL 0xc8d
1055+
#define MSR_IA32_QM_CTR 0xc8e
1056+
#define MSR_IA32_PQR_ASSOC 0xc8f
1057+
#define MSR_IA32_L3_CBM_BASE 0xc90
1058+
#define MSR_IA32_L2_CBM_BASE 0xd10
1059+
#define MSR_IA32_MBA_THRTL_BASE 0xd50
1060+
1061+
/* - AMD: */
1062+
#define MSR_IA32_MBA_BW_BASE 0xc0000200
1063+
10551064
/* MSR_IA32_VMX_MISC bits */
10561065
#define MSR_IA32_VMX_MISC_INTEL_PT (1ULL << 14)
10571066
#define MSR_IA32_VMX_MISC_VMWRITE_SHADOW_RO_FIELDS (1ULL << 29)

arch/x86/include/asm/resctrl.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@
77
#include <linux/sched.h>
88
#include <linux/jump_label.h>
99

10-
#define IA32_PQR_ASSOC 0x0c8f
11-
1210
/**
1311
* struct resctrl_pqr_state - State cache for the PQR MSR
1412
* @cur_rmid: The cached Resource Monitoring ID
1513
* @cur_closid: The cached Class Of Service ID
1614
* @default_rmid: The user assigned Resource Monitoring ID
1715
* @default_closid: The user assigned cached Class Of Service ID
1816
*
19-
* The upper 32 bits of IA32_PQR_ASSOC contain closid and the
20-
* lower 10 bits rmid. The update to IA32_PQR_ASSOC always
17+
* The upper 32 bits of MSR_IA32_PQR_ASSOC contain closid and the
18+
* lower 10 bits rmid. The update to MSR_IA32_PQR_ASSOC always
2119
* contains both parts, so we need to cache them. This also
2220
* stores the user configured per cpu CLOSID and RMID.
2321
*
@@ -77,7 +75,7 @@ static void __resctrl_sched_in(void)
7775
if (closid != state->cur_closid || rmid != state->cur_rmid) {
7876
state->cur_closid = closid;
7977
state->cur_rmid = rmid;
80-
wrmsr(IA32_PQR_ASSOC, rmid, closid);
78+
wrmsr(MSR_IA32_PQR_ASSOC, rmid, closid);
8179
}
8280
}
8381

arch/x86/kernel/cpu/resctrl/core.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ static void clear_closid_rmid(int cpu)
575575
state->default_rmid = 0;
576576
state->cur_closid = 0;
577577
state->cur_rmid = 0;
578-
wrmsr(IA32_PQR_ASSOC, 0, 0);
578+
wrmsr(MSR_IA32_PQR_ASSOC, 0, 0);
579579
}
580580

581581
static int resctrl_online_cpu(unsigned int cpu)
@@ -828,7 +828,6 @@ static __init void rdt_init_res_defs_intel(void)
828828
if (r->rid == RDT_RESOURCE_L3 ||
829829
r->rid == RDT_RESOURCE_L2) {
830830
r->cache.arch_has_sparse_bitmaps = false;
831-
r->cache.arch_has_empty_bitmaps = false;
832831
r->cache.arch_has_per_cpu_cfg = false;
833832
r->cache.min_cbm_bits = 1;
834833
} else if (r->rid == RDT_RESOURCE_MBA) {
@@ -849,7 +848,6 @@ static __init void rdt_init_res_defs_amd(void)
849848
if (r->rid == RDT_RESOURCE_L3 ||
850849
r->rid == RDT_RESOURCE_L2) {
851850
r->cache.arch_has_sparse_bitmaps = true;
852-
r->cache.arch_has_empty_bitmaps = true;
853851
r->cache.arch_has_per_cpu_cfg = true;
854852
r->cache.min_cbm_bits = 0;
855853
} else if (r->rid == RDT_RESOURCE_MBA) {

arch/x86/kernel/cpu/resctrl/ctrlmondata.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ static bool cbm_validate(char *buf, u32 *data, struct rdt_resource *r)
105105
return false;
106106
}
107107

108-
if ((!r->cache.arch_has_empty_bitmaps && val == 0) ||
109-
val > r->default_ctrl) {
108+
if ((r->cache.min_cbm_bits > 0 && val == 0) || val > r->default_ctrl) {
110109
rdt_last_cmd_puts("Mask out of range\n");
111110
return false;
112111
}

arch/x86/kernel/cpu/resctrl/internal.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@
88
#include <linux/fs_context.h>
99
#include <linux/jump_label.h>
1010

11-
#define MSR_IA32_L3_QOS_CFG 0xc81
12-
#define MSR_IA32_L2_QOS_CFG 0xc82
13-
#define MSR_IA32_L3_CBM_BASE 0xc90
14-
#define MSR_IA32_L2_CBM_BASE 0xd10
15-
#define MSR_IA32_MBA_THRTL_BASE 0xd50
16-
#define MSR_IA32_MBA_BW_BASE 0xc0000200
17-
18-
#define MSR_IA32_QM_CTR 0x0c8e
19-
#define MSR_IA32_QM_EVTSEL 0x0c8d
20-
2111
#define L3_QOS_CDP_ENABLE 0x01ULL
2212

2313
#define L2_QOS_CDP_ENABLE 0x01ULL

arch/x86/kernel/cpu/resctrl/pseudo_lock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ static int pseudo_lock_fn(void *_rdtgrp)
477477
* pseudo-locked followed by reading of kernel memory to load it
478478
* into the cache.
479479
*/
480-
__wrmsr(IA32_PQR_ASSOC, rmid_p, rdtgrp->closid);
480+
__wrmsr(MSR_IA32_PQR_ASSOC, rmid_p, rdtgrp->closid);
481481
/*
482482
* Cache was flushed earlier. Now access kernel memory to read it
483483
* into cache region associated with just activated plr->closid.
@@ -513,7 +513,7 @@ static int pseudo_lock_fn(void *_rdtgrp)
513513
* Critical section end: restore closid with capacity bitmask that
514514
* does not overlap with pseudo-locked region.
515515
*/
516-
__wrmsr(IA32_PQR_ASSOC, rmid_p, closid_p);
516+
__wrmsr(MSR_IA32_PQR_ASSOC, rmid_p, closid_p);
517517

518518
/* Re-enable the hardware prefetcher(s) */
519519
wrmsrl(MSR_MISC_FEATURE_CONTROL, saved_msr);

include/linux/resctrl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,12 @@ struct rdt_domain {
8989
/**
9090
* struct resctrl_cache - Cache allocation related data
9191
* @cbm_len: Length of the cache bit mask
92-
* @min_cbm_bits: Minimum number of consecutive bits to be set
92+
* @min_cbm_bits: Minimum number of consecutive bits to be set.
93+
* The value 0 means the architecture can support
94+
* zero CBM.
9395
* @shareable_bits: Bitmask of shareable resource with other
9496
* executing entities
9597
* @arch_has_sparse_bitmaps: True if a bitmap like f00f is valid.
96-
* @arch_has_empty_bitmaps: True if the '0' bitmap is valid.
9798
* @arch_has_per_cpu_cfg: True if QOS_CFG register for this cache
9899
* level has CPU scope.
99100
*/
@@ -102,7 +103,6 @@ struct resctrl_cache {
102103
unsigned int min_cbm_bits;
103104
unsigned int shareable_bits;
104105
bool arch_has_sparse_bitmaps;
105-
bool arch_has_empty_bitmaps;
106106
bool arch_has_per_cpu_cfg;
107107
};
108108

0 commit comments

Comments
 (0)