Skip to content

Commit d31f338

Browse files
author
CKI KWF Bot
committed
Merge: Update resctrl to upstream 6.17
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1683 Description: Updates for the resctrl file system to work on multiple arches, which facilitates future development. JIRA: https://issues.redhat.com/browse/RHEL-122044 Build Info: 69320879 Tested: Successful platform test results on Intel (intel-birchstream-gnr-cwf-ap-02) system. Signed-off-by: Steve Best <sbest@redhat.com> Approved-by: Phil Auld <pauld@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: David Arcari <darcari@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 968e331 + 7e97c0f commit d31f338

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+9049
-8016
lines changed

Documentation/arch/x86/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ x86-specific Documentation
3232
pti
3333
mds
3434
microcode
35-
resctrl
3635
tsx_async_abort
3736
buslock
3837
usb-legacy-support

Documentation/filesystems/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ Documentation for filesystem implementations.
112112
qnx6
113113
ramfs-rootfs-initramfs
114114
relay
115+
resctrl
115116
romfs
116117
smb/index
117118
spufs/index
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,16 @@ When monitoring is enabled all MON groups will also contain:
384384
Available only with debug option. The identifier used by hardware
385385
for the monitor group. On x86 this is the RMID.
386386

387+
When the "mba_MBps" mount option is used all CTRL_MON groups will also contain:
388+
389+
"mba_MBps_event":
390+
Reading this file shows which memory bandwidth event is used
391+
as input to the software feedback loop that keeps memory bandwidth
392+
below the value specified in the schemata file. Writing the
393+
name of one of the supported memory bandwidth events found in
394+
/sys/fs/resctrl/info/L3_MON/mon_features changes the input
395+
event.
396+
387397
Resource allocation rules
388398
-------------------------
389399

MAINTAINERS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19540,9 +19540,11 @@ M: Fenghua Yu <fenghua.yu@intel.com>
1954019540
M: Reinette Chatre <reinette.chatre@intel.com>
1954119541
L: linux-kernel@vger.kernel.org
1954219542
S: Supported
19543-
F: Documentation/arch/x86/resctrl*
19543+
F: Documentation/filesystems/resctrl.rst
1954419544
F: arch/x86/include/asm/resctrl.h
1954519545
F: arch/x86/kernel/cpu/resctrl/
19546+
F: fs/resctrl/
19547+
F: include/linux/resctrl*.h
1954619548
F: tools/testing/selftests/resctrl/
1954719549

1954819550
READ-COPY UPDATE (RCU)

arch/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,6 +1517,14 @@ config STRICT_MODULE_RWX
15171517
config ARCH_HAS_PHYS_TO_DMA
15181518
bool
15191519

1520+
config ARCH_HAS_CPU_RESCTRL
1521+
bool
1522+
help
1523+
An architecture selects this option to indicate that the necessary
1524+
hooks are provided to support the common memory system usage
1525+
monitoring and control interfaces provided by the 'resctrl'
1526+
filesystem (see RESCTRL_FS).
1527+
15201528
config HAVE_ARCH_COMPILER_H
15211529
bool
15221530
help

arch/x86/Kconfig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,10 @@ config X86_MPPARSE
502502
config X86_CPU_RESCTRL
503503
bool "x86 CPU resource control support"
504504
depends on X86 && (CPU_SUP_INTEL || CPU_SUP_AMD)
505-
select KERNFS
506-
select PROC_CPU_RESCTRL if PROC_FS
505+
depends on MISC_FILESYSTEMS
506+
select ARCH_HAS_CPU_RESCTRL
507+
select RESCTRL_FS
508+
select RESCTRL_FS_PSEUDO_LOCK
507509
help
508510
Enable x86 CPU resource control support.
509511

arch/x86/include/asm/paravirt.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,6 @@ static inline void halt(void)
180180
PVOP_VCALL0(irq.halt);
181181
}
182182

183-
extern noinstr void pv_native_wbinvd(void);
184-
185-
static __always_inline void wbinvd(void)
186-
{
187-
PVOP_ALT_VCALL0(cpu.wbinvd, "wbinvd", ALT_NOT_XEN);
188-
}
189-
190183
static inline u64 paravirt_read_msr(unsigned msr)
191184
{
192185
return PVOP_CALL1(u64, cpu.read_msr, msr);

arch/x86/include/asm/paravirt_types.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ struct pv_cpu_ops {
8686
void (*update_io_bitmap)(void);
8787
#endif
8888

89-
void (*wbinvd)(void);
90-
9189
/* cpuid emulation, mostly so that caps bits can be disabled */
9290
void (*cpuid)(unsigned int *eax, unsigned int *ebx,
9391
unsigned int *ecx, unsigned int *edx);

arch/x86/include/asm/resctrl.h

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
#ifdef CONFIG_X86_CPU_RESCTRL
66

7-
#include <linux/sched.h>
87
#include <linux/jump_label.h>
8+
#include <linux/percpu.h>
9+
#include <linux/resctrl_types.h>
10+
#include <linux/sched.h>
911

1012
/*
1113
* This value can never be a valid CLOSID, and is used when mapping a
@@ -40,6 +42,7 @@ DECLARE_PER_CPU(struct resctrl_pqr_state, pqr_state);
4042

4143
extern bool rdt_alloc_capable;
4244
extern bool rdt_mon_capable;
45+
extern unsigned int rdt_mon_features;
4346

4447
DECLARE_STATIC_KEY_FALSE(rdt_enable_key);
4548
DECLARE_STATIC_KEY_FALSE(rdt_alloc_enable_key);
@@ -79,6 +82,21 @@ static inline void resctrl_arch_disable_mon(void)
7982
static_branch_dec_cpuslocked(&rdt_enable_key);
8083
}
8184

85+
static inline bool resctrl_arch_is_llc_occupancy_enabled(void)
86+
{
87+
return (rdt_mon_features & (1 << QOS_L3_OCCUP_EVENT_ID));
88+
}
89+
90+
static inline bool resctrl_arch_is_mbm_total_enabled(void)
91+
{
92+
return (rdt_mon_features & (1 << QOS_L3_MBM_TOTAL_EVENT_ID));
93+
}
94+
95+
static inline bool resctrl_arch_is_mbm_local_enabled(void)
96+
{
97+
return (rdt_mon_features & (1 << QOS_L3_MBM_LOCAL_EVENT_ID));
98+
}
99+
82100
/*
83101
* __resctrl_sched_in() - Writes the task's CLOSid/RMID to IA32_PQR_MSR
84102
*
@@ -96,8 +114,8 @@ static inline void resctrl_arch_disable_mon(void)
96114
static inline void __resctrl_sched_in(struct task_struct *tsk)
97115
{
98116
struct resctrl_pqr_state *state = this_cpu_ptr(&pqr_state);
99-
u32 closid = state->default_closid;
100-
u32 rmid = state->default_rmid;
117+
u32 closid = READ_ONCE(state->default_closid);
118+
u32 rmid = READ_ONCE(state->default_rmid);
101119
u32 tmp;
102120

103121
/*
@@ -132,6 +150,13 @@ static inline unsigned int resctrl_arch_round_mon_val(unsigned int val)
132150
return val * scale;
133151
}
134152

153+
static inline void resctrl_arch_set_cpu_default_closid_rmid(int cpu, u32 closid,
154+
u32 rmid)
155+
{
156+
WRITE_ONCE(per_cpu(pqr_state.default_closid, cpu), closid);
157+
WRITE_ONCE(per_cpu(pqr_state.default_rmid, cpu), rmid);
158+
}
159+
135160
static inline void resctrl_arch_set_closid_rmid(struct task_struct *tsk,
136161
u32 closid, u32 rmid)
137162
{
@@ -150,7 +175,7 @@ static inline bool resctrl_arch_match_rmid(struct task_struct *tsk, u32 ignored,
150175
return READ_ONCE(tsk->rmid) == rmid;
151176
}
152177

153-
static inline void resctrl_sched_in(struct task_struct *tsk)
178+
static inline void resctrl_arch_sched_in(struct task_struct *tsk)
154179
{
155180
if (static_branch_likely(&rdt_enable_key))
156181
__resctrl_sched_in(tsk);
@@ -169,20 +194,22 @@ static inline u32 resctrl_arch_rmid_idx_encode(u32 ignored, u32 rmid)
169194

170195
/* x86 can always read an rmid, nothing needs allocating */
171196
struct rdt_resource;
172-
static inline void *resctrl_arch_mon_ctx_alloc(struct rdt_resource *r, int evtid)
197+
static inline void *resctrl_arch_mon_ctx_alloc(struct rdt_resource *r,
198+
enum resctrl_event_id evtid)
173199
{
174200
might_sleep();
175201
return NULL;
176-
};
202+
}
177203

178-
static inline void resctrl_arch_mon_ctx_free(struct rdt_resource *r, int evtid,
179-
void *ctx) { };
204+
static inline void resctrl_arch_mon_ctx_free(struct rdt_resource *r,
205+
enum resctrl_event_id evtid,
206+
void *ctx) { }
180207

181208
void resctrl_cpu_detect(struct cpuinfo_x86 *c);
182209

183210
#else
184211

185-
static inline void resctrl_sched_in(struct task_struct *tsk) {}
212+
static inline void resctrl_arch_sched_in(struct task_struct *tsk) {}
186213
static inline void resctrl_cpu_detect(struct cpuinfo_x86 *c) {}
187214

188215
#endif /* CONFIG_X86_CPU_RESCTRL */

arch/x86/include/asm/special_insns.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static inline void wrpkru(u32 pkru)
115115
}
116116
#endif
117117

118-
static __always_inline void native_wbinvd(void)
118+
static __always_inline void wbinvd(void)
119119
{
120120
asm volatile("wbinvd": : :"memory");
121121
}
@@ -167,12 +167,6 @@ static inline void __write_cr4(unsigned long x)
167167
{
168168
native_write_cr4(x);
169169
}
170-
171-
static __always_inline void wbinvd(void)
172-
{
173-
native_wbinvd();
174-
}
175-
176170
#endif /* CONFIG_PARAVIRT_XXL */
177171

178172
static __always_inline void clflush(volatile void *__p)

0 commit comments

Comments
 (0)