]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86,fs/resctrl: Add an architectural hook called for first mount
authorTony Luck <tony.luck@intel.com>
Thu, 8 Jan 2026 17:42:25 +0000 (09:42 -0800)
committerBorislav Petkov (AMD) <bp@alien8.de>
Fri, 9 Jan 2026 15:36:34 +0000 (16:36 +0100)
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
arch/x86/kernel/cpu/resctrl/core.c
fs/resctrl/rdtgroup.c
include/linux/resctrl.h

index 9222eee7ce07014615aaf4be06e50044c9c7f7b8..a2b7f869b4b0e3ac819c5227127a6cf614569a6c 100644 (file)
@@ -726,6 +726,10 @@ static int resctrl_arch_offline_cpu(unsigned int cpu)
        return 0;
 }
 
+void resctrl_arch_pre_mount(void)
+{
+}
+
 enum {
        RDT_FLAG_CMT,
        RDT_FLAG_MBM_TOTAL,
index 771e40f02ba64120de1e47b49870e8e5c16dcfc1..0e3b8bcf4e53e84c6c9ea82ab37a51946d254272 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/fs_parser.h>
 #include <linux/sysfs.h>
 #include <linux/kernfs.h>
+#include <linux/once.h>
 #include <linux/resctrl.h>
 #include <linux/seq_buf.h>
 #include <linux/seq_file.h>
@@ -2785,6 +2786,8 @@ static int rdt_get_tree(struct fs_context *fc)
        struct rdt_resource *r;
        int ret;
 
+       DO_ONCE_SLEEPABLE(resctrl_arch_pre_mount);
+
        cpus_read_lock();
        mutex_lock(&rdtgroup_mutex);
        /*
index c43526cdf304f2117daa51887f0bb4740a616809..2f938a5a16f81d407a2a583cd7f516750c033ce0 100644 (file)
@@ -514,6 +514,12 @@ void resctrl_offline_mon_domain(struct rdt_resource *r, struct rdt_domain_hdr *h
 void resctrl_online_cpu(unsigned int cpu);
 void resctrl_offline_cpu(unsigned int cpu);
 
+/*
+ * Architecture hook called at beginning of first file system mount attempt.
+ * No locks are held.
+ */
+void resctrl_arch_pre_mount(void);
+
 /**
  * resctrl_arch_rmid_read() - Read the eventid counter corresponding to rmid
  *                           for this resource and domain.