Skip to content

Commit 39208e7

Browse files
aeglbp3tk0v
authored andcommitted
x86,fs/resctrl: Add an architectural hook called for first mount
Enumeration of Intel telemetry events is an asynchronous process involving several mutually dependent drivers added as auxiliary devices during the device_initcall() phase of Linux boot. The process finishes after the probe functions of these drivers completes. But this happens after resctrl_arch_late_init() is executed. Tracing the enumeration process shows that it does complete a full seven seconds before the earliest possible mount of the resctrl file system (when included in /etc/fstab for automatic mount by systemd). Add a hook for use by telemetry event enumeration and initialization and run it once at the beginning of resctrl mount without any locks held. The architecture is responsible for any required locking. Signed-off-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20260105191711.GBaVwON5nZn-uO6Sqg@fat_crate.local
1 parent e37c9a3 commit 39208e7

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,10 @@ static int resctrl_arch_offline_cpu(unsigned int cpu)
726726
return 0;
727727
}
728728

729+
void resctrl_arch_pre_mount(void)
730+
{
731+
}
732+
729733
enum {
730734
RDT_FLAG_CMT,
731735
RDT_FLAG_MBM_TOTAL,

fs/resctrl/rdtgroup.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/fs_parser.h>
1919
#include <linux/sysfs.h>
2020
#include <linux/kernfs.h>
21+
#include <linux/once.h>
2122
#include <linux/resctrl.h>
2223
#include <linux/seq_buf.h>
2324
#include <linux/seq_file.h>
@@ -2785,6 +2786,8 @@ static int rdt_get_tree(struct fs_context *fc)
27852786
struct rdt_resource *r;
27862787
int ret;
27872788

2789+
DO_ONCE_SLEEPABLE(resctrl_arch_pre_mount);
2790+
27882791
cpus_read_lock();
27892792
mutex_lock(&rdtgroup_mutex);
27902793
/*

include/linux/resctrl.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,12 @@ void resctrl_offline_mon_domain(struct rdt_resource *r, struct rdt_domain_hdr *h
514514
void resctrl_online_cpu(unsigned int cpu);
515515
void resctrl_offline_cpu(unsigned int cpu);
516516

517+
/*
518+
* Architecture hook called at beginning of first file system mount attempt.
519+
* No locks are held.
520+
*/
521+
void resctrl_arch_pre_mount(void);
522+
517523
/**
518524
* resctrl_arch_rmid_read() - Read the eventid counter corresponding to rmid
519525
* for this resource and domain.

0 commit comments

Comments
 (0)