lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250407234032.241215-25-tony.luck@intel.com>
Date: Mon,  7 Apr 2025 16:40:26 -0700
From: Tony Luck <tony.luck@...el.com>
To: Fenghua Yu <fenghuay@...dia.com>,
	Reinette Chatre <reinette.chatre@...el.com>,
	Maciej Wieczor-Retman <maciej.wieczor-retman@...el.com>,
	Peter Newman <peternewman@...gle.com>,
	James Morse <james.morse@....com>,
	Babu Moger <babu.moger@....com>,
	Drew Fustini <dfustini@...libre.com>,
	Dave Martin <Dave.Martin@....com>,
	Anil Keshavamurthy <anil.s.keshavamurthy@...el.com>
Cc: linux-kernel@...r.kernel.org,
	patches@...ts.linux.dev,
	Tony Luck <tony.luck@...el.com>
Subject: [PATCH v3 24/26] x86/resctrl: Final steps to enable RDT_RESOURCE_PERF_PKG

For each of the discovered telemetry events:
 Mark as enabled in the rdt_mon_features bitmap.
 Set the value display type.
 Mark that the event can be read from any CPU.

Because the resource was not marked as enabled during early
initialization no domain discovery and allocation was done.
Do that in the architecture first mount hook.

Signed-off-by: Tony Luck <tony.luck@...el.com>
---
 arch/x86/kernel/cpu/resctrl/core.c      | 14 ++++++++++++++
 arch/x86/kernel/cpu/resctrl/intel_aet.c |  5 +++++
 2 files changed, 19 insertions(+)

diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index 6f5d52a8219b..83da63b24f45 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -756,7 +756,9 @@ static int resctrl_arch_offline_cpu(unsigned int cpu)
 
 void resctrl_arch_mount(void)
 {
+	struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_PERF_PKG].r_resctrl;
 	static bool only_once;
+	int cpu;
 
 	if (only_once)
 		return;
@@ -764,6 +766,18 @@ void resctrl_arch_mount(void)
 
 	if (!intel_aet_get_events())
 		return;
+
+	/*
+	 * Late discovery of telemetry events means the domains for the
+	 * resource were not built. Do that now.
+	 */
+	cpus_read_lock();
+	mutex_lock(&domain_list_lock);
+	r->mon_capable = true;
+	for_each_online_cpu(cpu)
+		domain_add_cpu_mon(cpu, r);
+	mutex_unlock(&domain_list_lock);
+	cpus_read_unlock();
 }
 
 enum {
diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/resctrl/intel_aet.c
index 0bcbac326bee..529f6d49e3a3 100644
--- a/arch/x86/kernel/cpu/resctrl/intel_aet.c
+++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c
@@ -233,9 +233,14 @@ bool intel_aet_get_events(void)
 			continue;
 		for (int i = 0; i < (*tentry)->num_events; i++) {
 			enum resctrl_event_id evtid = (*tentry)->evts[i].evtid;
+			enum resctrl_event_type type;
 
 			evtinfo[evtid].telem_entry = *tentry;
 			evtinfo[evtid].pmt_event = &(*tentry)->evts[i];
+
+			__set_bit(evtid, rdt_mon_features);
+			type = (*tentry)->evts[i].type;
+			resctrl_set_event_attributes(evtid, type, true);
 		}
 	}
 
-- 
2.48.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ