Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Tony Luck and committed by
Borislav Petkov (AMD)
39208e73 e37c9a3d

+13
+4
arch/x86/kernel/cpu/resctrl/core.c
··· 726 726 return 0; 727 727 } 728 728 729 + void resctrl_arch_pre_mount(void) 730 + { 731 + } 732 + 729 733 enum { 730 734 RDT_FLAG_CMT, 731 735 RDT_FLAG_MBM_TOTAL,
+3
fs/resctrl/rdtgroup.c
··· 18 18 #include <linux/fs_parser.h> 19 19 #include <linux/sysfs.h> 20 20 #include <linux/kernfs.h> 21 + #include <linux/once.h> 21 22 #include <linux/resctrl.h> 22 23 #include <linux/seq_buf.h> 23 24 #include <linux/seq_file.h> ··· 2785 2784 struct rdt_l3_mon_domain *dom; 2786 2785 struct rdt_resource *r; 2787 2786 int ret; 2787 + 2788 + DO_ONCE_SLEEPABLE(resctrl_arch_pre_mount); 2788 2789 2789 2790 cpus_read_lock(); 2790 2791 mutex_lock(&rdtgroup_mutex);
+6
include/linux/resctrl.h
··· 514 514 void resctrl_online_cpu(unsigned int cpu); 515 515 void resctrl_offline_cpu(unsigned int cpu); 516 516 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 + 517 523 /** 518 524 * resctrl_arch_rmid_read() - Read the eventid counter corresponding to rmid 519 525 * for this resource and domain.