Skip to content

Commit 279f225

Browse files
James Morsebp3tk0v
authored andcommitted
x86/resctrl: Move pseudo lock prototypes to include/linux/resctrl.h
The resctrl pseudo-lock feature allows an architecture to allocate data into particular cache portions, which are then treated as reserved to avoid that data ever being evicted. Setting this up is deeply architecture specific as it involves disabling prefetchers etc. It is not possible to support this kind of feature on arm64. Risc-V is assumed to be the same. The prototypes for the architecture code were added to x86's asm/resctrl.h, with other architectures able to provide stubs for their architecture. This forces other architectures to provide identical stubs. Move the prototypes and stubs to linux/resctrl.h, and switch between them using the existing Kconfig symbol. Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Reviewed-by: Fenghua Yu <fenghuay@nvidia.com> Tested-by: Fenghua Yu <fenghuay@nvidia.com> Tested-by: Babu Moger <babu.moger@amd.com> Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> Tested-by: Tony Luck <tony.luck@intel.com> Link: https://lore.kernel.org/20250515165855.31452-20-james.morse@arm.com
1 parent 272ed1c commit 279f225

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

arch/x86/include/asm/resctrl.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,6 @@ static inline void resctrl_arch_mon_ctx_free(struct rdt_resource *r,
205205
enum resctrl_event_id evtid,
206206
void *ctx) { }
207207

208-
u64 resctrl_arch_get_prefetch_disable_bits(void);
209-
int resctrl_arch_pseudo_lock_fn(void *_plr);
210-
int resctrl_arch_measure_cycles_lat_fn(void *_plr);
211-
int resctrl_arch_measure_l2_residency(void *_plr);
212-
int resctrl_arch_measure_l3_residency(void *_plr);
213208
void resctrl_cpu_detect(struct cpuinfo_x86 *c);
214209

215210
#else

include/linux/resctrl.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,4 +534,17 @@ extern unsigned int resctrl_rmid_realloc_limit;
534534
int resctrl_init(void);
535535
void resctrl_exit(void);
536536

537+
#ifdef CONFIG_RESCTRL_FS_PSEUDO_LOCK
538+
u64 resctrl_arch_get_prefetch_disable_bits(void);
539+
int resctrl_arch_pseudo_lock_fn(void *_plr);
540+
int resctrl_arch_measure_cycles_lat_fn(void *_plr);
541+
int resctrl_arch_measure_l2_residency(void *_plr);
542+
int resctrl_arch_measure_l3_residency(void *_plr);
543+
#else
544+
static inline u64 resctrl_arch_get_prefetch_disable_bits(void) { return 0; }
545+
static inline int resctrl_arch_pseudo_lock_fn(void *_plr) { return 0; }
546+
static inline int resctrl_arch_measure_cycles_lat_fn(void *_plr) { return 0; }
547+
static inline int resctrl_arch_measure_l2_residency(void *_plr) { return 0; }
548+
static inline int resctrl_arch_measure_l3_residency(void *_plr) { return 0; }
549+
#endif /* CONFIG_RESCTRL_FS_PSEUDO_LOCK */
537550
#endif /* _RESCTRL_H */

0 commit comments

Comments
 (0)