From nobody Mon Feb 9 08:54:32 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B1CC1D54D8 for ; Fri, 21 Mar 2025 23:16:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598982; cv=none; b=o5Qv7eds3wYNfVdytxQpM/q8EcpSpQ7oSmCJL6csRknbuaDF1SOK9AwWJlK7KyZNfM0IBtXk0L+2g/vBVNHZ7f2Yd36HTOG5POaj8leAbmPZRdw25S7qW24I/8vo35BNIKckwwWH5mFxeGBoaZWKUifEiqy7edeG9xT0v0Egmvc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598982; c=relaxed/simple; bh=tYZ1FbeM8OZ/TWZgv1s5cxOJKU9ePb/qzpnBJ1zSw5g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mudGGWp/FimxbfMO/KJf381Q0KWNekM7hEDJip9AzcMsnKVKfjFi7E1lXRzO9d3+XRv4tJiFjJiJurzStDSNKSPfgQjaQUVKjxpPBUM/DWKISkS+VfcXI+2NgBVt7rD9sQvNItKw4K+P4TR0EAUsEO6Bkh3BkdWuDHHYUkDD3uc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=cFhkGAmX; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="cFhkGAmX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742598981; x=1774134981; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tYZ1FbeM8OZ/TWZgv1s5cxOJKU9ePb/qzpnBJ1zSw5g=; b=cFhkGAmXLVpbDhzJluLQU3SuWAm+fh5bTl/q1O3UfZAuNXFRMtxLFo26 QGj2yqy3eVo/Ci0seZYsHt1lK9XRWKgaTlJf8ekgAGl7fJT2GFQ2Xx0CU KLEttNNYuPMJhC5pFzqquoVF1FNIGv3g94FZI/SKRQ7wPHxQMNHuWWlVC oZeoGvBSyEDQCatxR9yyFuEdi/6s+mDdCkK1/jE2zqlZQIpJdBAzCnpO5 WcLoyGHtAhurNYzbnOIEYubloUTmFXYzh6fBbZZcuVkfPw2A/OXWETRN9 ZvaqFak5nfdlNLRWx9R/1DGJXPL+Om4VMinJ9y1maTIl1QtfmquyV//jn w==; X-CSE-ConnectionGUID: 9ecSPPf8TgKc+VfMflA/rA== X-CSE-MsgGUID: Nj8xvZKBS9qVvXH7Dj5t5w== X-IronPort-AV: E=McAfee;i="6700,10204,11380"; a="43604546" X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="43604546" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:19 -0700 X-CSE-ConnectionGUID: E6qkJL7+ThKDKg8hccO/1Q== X-CSE-MsgGUID: vTQN5B0xT0aP+RutRW4EFA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="128354289" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:19 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v2 01/16] x86/rectrl: Fake OOBMSM interface Date: Fri, 21 Mar 2025 16:15:51 -0700 Message-ID: <20250321231609.57418-2-tony.luck@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250321231609.57418-1-tony.luck@intel.com> References: <20250321231609.57418-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Real version is coming soon ... this is here so the remaining parts will build (and run ... assuming a 2 socket system that supports RDT monitoring ... only missing part is that the event counters just report fixed values). Real version of this would just add the INTEL_AET_RESCTRL Kconfig option with dependency checks on INTEL_VSEC=3Dy && INTEL_AET_TELEMETRY=3Dy && INTEL_AET_DISCOVERY=3Dy Just for RFC discussion. Signed-off-by: Tony Luck --- .../cpu/resctrl/fake_intel_aet_features.h | 73 +++++++++++++++++++ .../cpu/resctrl/fake_intel_aet_features.c | 65 +++++++++++++++++ arch/x86/Kconfig | 1 + arch/x86/kernel/cpu/resctrl/Makefile | 1 + drivers/platform/x86/intel/pmt/Kconfig | 3 + 5 files changed, 143 insertions(+) create mode 100644 arch/x86/kernel/cpu/resctrl/fake_intel_aet_features.h create mode 100644 arch/x86/kernel/cpu/resctrl/fake_intel_aet_features.c diff --git a/arch/x86/kernel/cpu/resctrl/fake_intel_aet_features.h b/arch/x= 86/kernel/cpu/resctrl/fake_intel_aet_features.h new file mode 100644 index 000000000000..c835c4108abc --- /dev/null +++ b/arch/x86/kernel/cpu/resctrl/fake_intel_aet_features.h @@ -0,0 +1,73 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +/* Bits stolen from OOBMSM VSEC discovery code */ + +enum pmt_feature_id { + FEATURE_INVALID =3D 0x0, + FEATURE_PER_CORE_PERF_TELEM =3D 0x1, + FEATURE_PER_CORE_ENV_TELEM =3D 0x2, + FEATURE_PER_RMID_PERF_TELEM =3D 0x3, + FEATURE_ACCEL_TELEM =3D 0x4, + FEATURE_UNCORE_TELEM =3D 0x5, + FEATURE_CRASH_LOG =3D 0x6, + FEATURE_PETE_LOG =3D 0x7, + FEATURE_TPMI_CTRL =3D 0x8, + FEATURE_RESERVED =3D 0x9, + FEATURE_TRACING =3D 0xA, + FEATURE_PER_RMID_ENERGY_TELEM =3D 0xB, + FEATURE_MAX =3D 0xB, +}; + +/** + * struct oobmsm_plat_info - Platform information for a device instance + * @cdie_mask: Mask of all compute dies in the partition + * @package_id: CPU Package id + * @partition: Package partition id when multiple VSEC PCI devices p= er package + * @segment: PCI segment ID + * @bus_number: PCI bus number + * @device_number: PCI device number + * @function_number: PCI function number + * + * Structure to store platform data for a OOBMSM device instance. + */ +struct oobmsm_plat_info { + u16 cdie_mask; + u8 package_id; + u8 partition; + u8 segment; + u8 bus_number; + u8 device_number; + u8 function_number; +}; + +enum oobmsm_supplier_type { + OOBMSM_SUP_PLAT_INFO, + OOBMSM_SUP_DISC_INFO, + OOBMSM_SUP_S3M_SIMICS, + OOBMSM_SUP_TYPE_MAX +}; + +struct oobmsm_mapping_supplier { + struct device *supplier_dev[OOBMSM_SUP_TYPE_MAX]; + struct oobmsm_plat_info plat_info; + unsigned long features; +}; + +struct telemetry_region { + struct oobmsm_plat_info plat_info; + void __iomem *addr; + size_t size; + u32 guid; + u32 num_rmids; +}; + +struct pmt_feature_group { + enum pmt_feature_id id; + int count; + struct kref kref; + struct telemetry_region regions[]; +}; + +struct pmt_feature_group *intel_pmt_get_regions_by_feature(enum pmt_featur= e_id id); + +void intel_pmt_put_feature_group(struct pmt_feature_group *feature_group); diff --git a/arch/x86/kernel/cpu/resctrl/fake_intel_aet_features.c b/arch/x= 86/kernel/cpu/resctrl/fake_intel_aet_features.c new file mode 100644 index 000000000000..b537068d99fb --- /dev/null +++ b/arch/x86/kernel/cpu/resctrl/fake_intel_aet_features.c @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include +#include +#include +#include "fake_intel_aet_features.h" +#include +#include + +#include "internal.h" + +#define ENERGY_QWORDS ((576 * 2) + 3) +#define PERF_QWORDS ((576 * 7) + 3) + +static long pg[4 * ENERGY_QWORDS + 2 * PERF_QWORDS]; + +static int __init fill(void) +{ + u64 val =3D 0; + + for (int i =3D 0; i < sizeof(pg); i +=3D sizeof(val)) { + pg[i / sizeof(val)] =3D BIT_ULL(63) + val; + val++; + } + return 0; +} +device_initcall(fill); + +#define PKG_REGION(_entry, _guid, _addr, _pkg) \ + [_entry] =3D { .guid =3D _guid, .addr =3D (void __iomem *)_addr, .plat_in= fo =3D { .package_id =3D _pkg }} + +static struct pmt_feature_group fake_energy =3D { + .count =3D 4, + .regions =3D { + PKG_REGION(0, 0x26696143, &pg[0 * ENERGY_QWORDS], 0), + PKG_REGION(1, 0x26696143, &pg[1 * ENERGY_QWORDS], 0), + PKG_REGION(2, 0x26696143, &pg[2 * ENERGY_QWORDS], 1), + PKG_REGION(3, 0x26696143, &pg[3 * ENERGY_QWORDS], 1) + } +}; + +static struct pmt_feature_group fake_perf =3D { + .count =3D 2, + .regions =3D { + PKG_REGION(0, 0x26557651, &pg[4 * ENERGY_QWORDS + 0 * PERF_QWORDS], 0), + PKG_REGION(1, 0x26557651, &pg[4 * ENERGY_QWORDS + 1 * PERF_QWORDS], 1) + } +}; + +struct pmt_feature_group * +intel_pmt_get_regions_by_feature(enum pmt_feature_id id) +{ + switch (id) { + case FEATURE_PER_RMID_ENERGY_TELEM: + return &fake_energy; + case FEATURE_PER_RMID_PERF_TELEM: + return &fake_perf; + default: + return ERR_PTR(-ENOENT); + } + return ERR_PTR(-ENOENT); +} + +void intel_pmt_put_feature_group(struct pmt_feature_group *feature_group) +{ +} diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index ea29d22a621f..6112cb6cad05 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -504,6 +504,7 @@ config X86_CPU_RESCTRL bool "x86 CPU resource control support" depends on X86 && (CPU_SUP_INTEL || CPU_SUP_AMD) depends on MISC_FILESYSTEMS + select INTEL_AET_RESCTRL if X86_64 select ARCH_HAS_CPU_RESCTRL select RESCTRL_FS select RESCTRL_FS_PSEUDO_LOCK diff --git a/arch/x86/kernel/cpu/resctrl/Makefile b/arch/x86/kernel/cpu/res= ctrl/Makefile index 909be78ec6da..2c3b09f95127 100644 --- a/arch/x86/kernel/cpu/resctrl/Makefile +++ b/arch/x86/kernel/cpu/resctrl/Makefile @@ -2,6 +2,7 @@ obj-$(CONFIG_X86_CPU_RESCTRL) +=3D core.o rdtgroup.o monitor.o obj-$(CONFIG_X86_CPU_RESCTRL) +=3D ctrlmondata.o obj-$(CONFIG_RESCTRL_FS_PSEUDO_LOCK) +=3D pseudo_lock.o +obj-$(CONFIG_INTEL_AET_RESCTRL) +=3D fake_intel_aet_features.o =20 # To allow define_trace.h's recursive include: CFLAGS_pseudo_lock.o =3D -I$(src) diff --git a/drivers/platform/x86/intel/pmt/Kconfig b/drivers/platform/x86/= intel/pmt/Kconfig index e916fc966221..6d3b1f64efe9 100644 --- a/drivers/platform/x86/intel/pmt/Kconfig +++ b/drivers/platform/x86/intel/pmt/Kconfig @@ -38,3 +38,6 @@ config INTEL_PMT_CRASHLOG =20 To compile this driver as a module, choose M here: the module will be called intel_pmt_crashlog. + +config INTEL_AET_RESCTRL + bool --=20 2.48.1 From nobody Mon Feb 9 08:54:32 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 776771EB5F4 for ; Fri, 21 Mar 2025 23:16:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598983; cv=none; b=knZkcaYQESMssMZ/yK2hvXNg2BgPLWOIomiWP6MPFG1rMiPfbX4xSHc2RAu669iNR8PuQ58B23v4KHP8qiWgw2TFqbOAi4q9C4RWUYHa70hNjI9rTJFDgfwCTJBkDS/cbv8zELRiYJRhMUuGWa/eVrYt/dnSeIWU84iaIFJS2I4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598983; c=relaxed/simple; bh=DzasePM7tlqahns372BpzcFD3OacTZVKVfYZqFTn7rk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GMoS0v/kDOzJHG7pj9WZ+Oyu8tcCOilDTJXWwSJ9SgDR+KOGVY3rv5P/9XeZ27rsegGG3wNkIupO6x1CQT2UHp8c1QLrGM6k+rjb8vwR207Qeobvlj068xfzD9zu298hPpUTlRupf61yCgJvfpBoI9j8ifZIlJPBotydNvzNwjk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=JEiiLq7C; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JEiiLq7C" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742598982; x=1774134982; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DzasePM7tlqahns372BpzcFD3OacTZVKVfYZqFTn7rk=; b=JEiiLq7CgOZfpNOhEjaixFYUhfI/HbqDmzRMElgMTg96dg5q3nns+giM hz1bqP9KhAeDKAuId7vkESgNLThsm2agCsc/8InFp0A/h2lX2ZayIGlzj 5bIExg4xfVm3BQY4VjK5a3ZDP9TjTKos+baf6nqMEP3c1a1bjBhD3BS2s WKHCxh8fjOYL6N5qETVNKyI9Ejllfvvl09MPDcN3QvCC4x1C4c2jSQOBb iZmUEeXYburBpklzcAZMz+Jrc/VZ8mAY1PkGAWk9/zyZ8Eq3ba2HfjYw7 k0U5YqxxM7VNXCNCWWT+RLR1xigVIKI8q/LApn40dbynHgOPq+IXe96Pd Q==; X-CSE-ConnectionGUID: zpul890LQXel9QydOb15AQ== X-CSE-MsgGUID: t0HSL490Tj+ml9Ujsm/AZA== X-IronPort-AV: E=McAfee;i="6700,10204,11380"; a="43604553" X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="43604553" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:20 -0700 X-CSE-ConnectionGUID: An+4wk0QR+6U3BzbDpUG+w== X-CSE-MsgGUID: wLSEA3+ZQYe4EZknD8Ywfg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="128354292" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:19 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v2 02/16] x86/resctrl: Move L3 initialization out of domain_add_cpu_mon() Date: Fri, 21 Mar 2025 16:15:52 -0700 Message-ID: <20250321231609.57418-3-tony.luck@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250321231609.57418-1-tony.luck@intel.com> References: <20250321231609.57418-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" To prepare for additional types of monitoring domains, move all the L3 specific initialization into a helper function. Signed-off-by: Tony Luck --- arch/x86/kernel/cpu/resctrl/core.c | 52 +++++++++++++++++------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index 6ed0d4f5d6a3..4205aeb4f979 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -492,33 +492,12 @@ static void domain_add_cpu_ctrl(int cpu, struct rdt_r= esource *r) } } =20 -static void domain_add_cpu_mon(int cpu, struct rdt_resource *r) +static void setup_l3_mon_domain(int cpu, int id, struct rdt_resource *r, s= truct list_head *add_pos) { - int id =3D get_domain_id_from_scope(cpu, r->mon_scope); - struct list_head *add_pos =3D NULL; struct rdt_hw_mon_domain *hw_dom; - struct rdt_domain_hdr *hdr; struct rdt_mon_domain *d; int err; =20 - lockdep_assert_held(&domain_list_lock); - - if (id < 0) { - pr_warn_once("Can't find monitor domain id for CPU:%d scope:%d for resou= rce %s\n", - cpu, r->mon_scope, r->name); - return; - } - - hdr =3D resctrl_find_domain(&r->mon_domains, id, &add_pos); - if (hdr) { - if (WARN_ON_ONCE(hdr->type !=3D RESCTRL_MON_DOMAIN)) - return; - d =3D container_of(hdr, struct rdt_mon_domain, hdr); - - cpumask_set_cpu(cpu, &d->hdr.cpu_mask); - return; - } - hw_dom =3D kzalloc_node(sizeof(*hw_dom), GFP_KERNEL, cpu_to_node(cpu)); if (!hw_dom) return; @@ -551,6 +530,35 @@ static void domain_add_cpu_mon(int cpu, struct rdt_res= ource *r) } } =20 +static void domain_add_cpu_mon(int cpu, struct rdt_resource *r) +{ + int id =3D get_domain_id_from_scope(cpu, r->mon_scope); + struct list_head *add_pos =3D NULL; + struct rdt_domain_hdr *hdr; + + lockdep_assert_held(&domain_list_lock); + + if (id < 0) { + pr_warn_once("Can't find monitor domain id for CPU:%d scope:%d for resou= rce %s\n", + cpu, r->mon_scope, r->name); + return; + } + + hdr =3D resctrl_find_domain(&r->mon_domains, id, &add_pos); + if (hdr) { + cpumask_set_cpu(cpu, &hdr->cpu_mask); + return; + } + + switch (r->rid) { + case RDT_RESOURCE_L3: + setup_l3_mon_domain(cpu, id, r, add_pos); + break; + default: + WARN_ON_ONCE(1); + } +} + static void domain_add_cpu(int cpu, struct rdt_resource *r) { if (r->alloc_capable) --=20 2.48.1 From nobody Mon Feb 9 08:54:32 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97C881EF0AD for ; Fri, 21 Mar 2025 23:16:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598983; cv=none; b=T+7AKXrrRz44WwMlBe9/F3jecjScda9dvGZG/3N/XDltkeRLWbDlwRjS0FdL2bc/ry8VfMU3zl/aj15T5/4qQpyXZfp2iMW076wKVVh2aeZUvjBlbCcFW/vBQUtjRvVW4TRyvUFdy1Db9uw355Qhu7vcd8klxJOY5uX0DESNDkw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598983; c=relaxed/simple; bh=YCXtwg87wrCU4Z3jRnxVIPQ1BGoTPXu4jvx/PIVRynY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NBa3YR107cOzQQy5ho7MC9dp7pzQQsIsXR5uYqJ2Ds8CFFqQ8r2y1Pb5GENRjKCFbkGUKwVjcpm+/D/pydklkBp3VdMUxJv05zmYCVFl9l54i9bxvlSLmCXTtGOZskZyKegl4uZFMbQxxaadC04827dKGbfU9UennYsYJSoYDM0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ZwGh4y5C; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZwGh4y5C" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742598982; x=1774134982; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YCXtwg87wrCU4Z3jRnxVIPQ1BGoTPXu4jvx/PIVRynY=; b=ZwGh4y5C1ZubiNLxfS8rbi9FGf/21kkeuHVDg6B2nT9wXGAgc/W9FMC9 P0LtQ8IqWZBkZ1Ea8JaWYMtcjw8fAiHi1YSZqVkAqyooQMbRUzUZJgL43 xTSDUWjRUNDpt+Dqv+uDaJvzqELOya9NnZ7seJOmNL+LrE/CLnDAf04kG HD6DesibXNBXnNc/Fn2HVYaZii/8eHdzEwXidAYIpHzoP6VDTcgGWsF+W xhkch8HNIj3/+LjJPjnDTnF97slF11GuVefzEIERE11D1WjMCDMNPEKe6 fQOugUcG0Q0L/Tc6IwhTOAjjTee+fsmATiWGMt/StPwxfgzg9uB7izhM0 A==; X-CSE-ConnectionGUID: CK9A/YZNSuSirWSC78UuEA== X-CSE-MsgGUID: oKCBwwBIR9uprkkDIx/38w== X-IronPort-AV: E=McAfee;i="6700,10204,11380"; a="43604560" X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="43604560" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:20 -0700 X-CSE-ConnectionGUID: 3iblysPaRZG09d87E0qmzg== X-CSE-MsgGUID: p5MJigCbS2e4I2kH1VG6eg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="128354295" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:20 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v2 03/16] x86/resctrl: Refactor domain_remove_cpu_mon() ready for new domain types Date: Fri, 21 Mar 2025 16:15:53 -0700 Message-ID: <20250321231609.57418-4-tony.luck@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250321231609.57418-1-tony.luck@intel.com> References: <20250321231609.57418-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Different types of domains require different actions when the last CPU in the domain is removed. Refactor to make it easy to add new actions for new types of domains. Signed-off-by: Tony Luck --- arch/x86/kernel/cpu/resctrl/core.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index 4205aeb4f979..3c343d0d18fb 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -635,20 +635,21 @@ static void domain_remove_cpu_mon(int cpu, struct rdt= _resource *r) return; } =20 - if (WARN_ON_ONCE(hdr->type !=3D RESCTRL_MON_DOMAIN)) + cpumask_clear_cpu(cpu, &hdr->cpu_mask); + if (!cpumask_empty(&hdr->cpu_mask)) return; =20 d =3D container_of(hdr, struct rdt_mon_domain, hdr); - hw_dom =3D resctrl_to_arch_mon_dom(d); =20 - cpumask_clear_cpu(cpu, &d->hdr.cpu_mask); - if (cpumask_empty(&d->hdr.cpu_mask)) { + switch (r->rid) { + case RDT_RESOURCE_L3: + hw_dom =3D resctrl_to_arch_mon_dom(d); + resctrl_offline_mon_domain(r, d); - list_del_rcu(&d->hdr.list); + list_del_rcu(&hdr->list); synchronize_rcu(); mon_domain_free(hw_dom); - - return; + break; } } =20 --=20 2.48.1 From nobody Mon Feb 9 08:54:32 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAF7022CBE8 for ; Fri, 21 Mar 2025 23:16:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598984; cv=none; b=qJ1+00L4Vpk4lzN6RmMmJwL4rwiP9QoYJel8IwryHgP2v/KdpIaKrstwWbz3+ar0qUJPc6MeRdNJZEsbdOrNdG1dfW/UZNNl5isvTa734K0Qv30CiraGBv0a3rOkZZT2VX3uBKIZ1pqL6Dce9Q8NTQvWMSFgvV1SHCpRr3D926U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598984; c=relaxed/simple; bh=2qZebPO1celI5zXnc6tbjafYOt8jb+LOhGBb2yIgT8Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=R8Hwwv+ybsoa+PhZRFgt7ic4ib8hBXYkM3t8s1AhpYkn2BI9hImfEjiK/9bTQqtwhiwJJ/Jg/3wJJv3MouPtpzPXiZsFksKfh7jmrg1TBC8Zaq6jAEX7jkOi4yNL5GYUBWbCZJ4WqhodE2qmvaaRmAYGTfTWjI4h3ovNNLMIBQQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=D/HVgH7j; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="D/HVgH7j" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742598983; x=1774134983; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2qZebPO1celI5zXnc6tbjafYOt8jb+LOhGBb2yIgT8Y=; b=D/HVgH7je7Dnvyk9UXnTnvgZB/fP1+dWPjRx3x+9NV2gvhwiIEU1FNHE 4EUX7HSmAY8pbmoRzK5IRP9KmG4/Q29kYNed5HxHv7B33132ZMKza0PGX kKoZ+q16bh4ITKfI0CnyDK+BbhLe0ROuQPHKaEeIiPiXImRd/PhZjLoeF M9DZ6tfuFlD2OicAvRrwqwnq4EcTTH9onw2/GGfOJXrUxI+nHEEmVuvE4 nqklIXdQkKVSqYz3iNfhXisLZfJQ3cS+D5C6IUWwJeXJtUJ2TcUC1ShXE gCu3dYEcGBZo/rOz8YjMX7Za2p2DqiOjZH2J4zu+jdJAgrIcw6u9+AviD g==; X-CSE-ConnectionGUID: fsO5xNTORwer59cbcnMH6Q== X-CSE-MsgGUID: uDjtnp4YSjyLgh/NF0mlAA== X-IronPort-AV: E=McAfee;i="6700,10204,11380"; a="43604567" X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="43604567" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:20 -0700 X-CSE-ConnectionGUID: c4+AXNINQrqB1sn5JSfXdA== X-CSE-MsgGUID: mXtpd9feSFu+lObkuxo2kw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="128354298" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:20 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v2 04/16] x86/resctrl: Change generic monitor functions to use struct rdt_domain_hdr Date: Fri, 21 Mar 2025 16:15:54 -0700 Message-ID: <20250321231609.57418-5-tony.luck@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250321231609.57418-1-tony.luck@intel.com> References: <20250321231609.57418-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Functions that don't need the internal details of the rdt_mon_domain can operate on just the rdt_domain_hdr. Signed-off-by: Tony Luck --- include/linux/resctrl.h | 2 +- arch/x86/kernel/cpu/resctrl/core.c | 2 +- fs/resctrl/rdtgroup.c | 57 +++++++++++++++++++----------- 3 files changed, 39 insertions(+), 22 deletions(-) diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 5c7c8bf2c47f..25c3ee78de3d 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -413,7 +413,7 @@ int resctrl_arch_update_one(struct rdt_resource *r, str= uct rdt_ctrl_domain *d, u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_ctrl_domain= *d, u32 closid, enum resctrl_conf_type type); int resctrl_online_ctrl_domain(struct rdt_resource *r, struct rdt_ctrl_dom= ain *d); -int resctrl_online_mon_domain(struct rdt_resource *r, struct rdt_mon_domai= n *d); +int resctrl_online_mon_domain(struct rdt_resource *r, struct rdt_domain_hd= r *hdr); void resctrl_offline_ctrl_domain(struct rdt_resource *r, struct rdt_ctrl_d= omain *d); void resctrl_offline_mon_domain(struct rdt_resource *r, struct rdt_mon_dom= ain *d); void resctrl_online_cpu(unsigned int cpu); diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index 3c343d0d18fb..c316268b4442 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -522,7 +522,7 @@ static void setup_l3_mon_domain(int cpu, int id, struct= rdt_resource *r, struct =20 list_add_tail_rcu(&d->hdr.list, add_pos); =20 - err =3D resctrl_online_mon_domain(r, d); + err =3D resctrl_online_mon_domain(r, &d->hdr); if (err) { list_del_rcu(&d->hdr.list); synchronize_rcu(); diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 234ec9dbe5b3..dbfb7d3bc3bc 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -3048,7 +3048,7 @@ static void mon_rmdir_one_subdir(struct rdtgroup *rdt= grp, char *name, char *subn * when last domain being summed is removed. */ static void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r, - struct rdt_mon_domain *d) + struct rdt_domain_hdr *hdr) { struct rdtgroup *prgrp, *crgrp; char subname[32]; @@ -3056,9 +3056,15 @@ static void rmdir_mondata_subdir_allrdtgrp(struct rd= t_resource *r, char name[32]; =20 snc_mode =3D r->mon_scope =3D=3D RESCTRL_L3_NODE; - sprintf(name, "mon_%s_%02d", r->name, snc_mode ? d->ci->id : d->hdr.id); - if (snc_mode) - sprintf(subname, "mon_sub_%s_%02d", r->name, d->hdr.id); + if (snc_mode) { + struct rdt_mon_domain *d; + + d =3D container_of(hdr, struct rdt_mon_domain, hdr); + sprintf(name, "mon_%s_%02d", r->name, d->ci->id); + sprintf(subname, "mon_sub_%s_%02d", r->name, hdr->id); + } else { + sprintf(name, "mon_%s_%02d", r->name, hdr->id); + } =20 list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) { mon_rmdir_one_subdir(prgrp, name, subname); @@ -3068,11 +3074,12 @@ static void rmdir_mondata_subdir_allrdtgrp(struct r= dt_resource *r, } } =20 -static int mon_add_all_files(struct kernfs_node *kn, struct rdt_mon_domain= *d, +static int mon_add_all_files(struct kernfs_node *kn, struct rdt_domain_hdr= *hdr, struct rdt_resource *r, struct rdtgroup *prgrp, bool do_sum) { struct rmid_read rr =3D {0}; + struct rdt_mon_domain *d; struct mon_data *priv; struct mon_evt *mevt; int ret; @@ -3080,6 +3087,8 @@ static int mon_add_all_files(struct kernfs_node *kn, = struct rdt_mon_domain *d, if (WARN_ON(list_empty(&r->evt_list))) return -EPERM; =20 + d =3D container_of(hdr, struct rdt_mon_domain, hdr); + list_for_each_entry(mevt, &r->evt_list, list) { priv =3D mon_get_default_kn_priv(r, d, mevt, prgrp, do_sum); if (WARN_ON_ONCE(!priv)) @@ -3089,7 +3098,7 @@ static int mon_add_all_files(struct kernfs_node *kn, = struct rdt_mon_domain *d, if (ret) return ret; =20 - if (!do_sum && resctrl_is_mbm_event(mevt->evtid)) + if (r->rid =3D=3D RDT_RESOURCE_L3 && !do_sum && resctrl_is_mbm_event(mev= t->evtid)) mon_event_read(&rr, r, d, prgrp, &d->hdr.cpu_mask, mevt->evtid, true); } =20 @@ -3097,10 +3106,11 @@ static int mon_add_all_files(struct kernfs_node *kn= , struct rdt_mon_domain *d, } =20 static int mkdir_mondata_subdir(struct kernfs_node *parent_kn, - struct rdt_mon_domain *d, + struct rdt_domain_hdr *hdr, struct rdt_resource *r, struct rdtgroup *prgrp) { struct kernfs_node *kn, *ckn; + struct rdt_mon_domain *d; char name[32]; bool snc_mode; int ret =3D 0; @@ -3108,7 +3118,12 @@ static int mkdir_mondata_subdir(struct kernfs_node *= parent_kn, lockdep_assert_held(&rdtgroup_mutex); =20 snc_mode =3D r->mon_scope =3D=3D RESCTRL_L3_NODE; - sprintf(name, "mon_%s_%02d", r->name, snc_mode ? d->ci->id : d->hdr.id); + if (snc_mode) { + d =3D container_of(hdr, struct rdt_mon_domain, hdr); + sprintf(name, "mon_%s_%02d", r->name, d->ci->id); + } else { + sprintf(name, "mon_%s_%02d", r->name, hdr->id); + } kn =3D kernfs_find_and_get(parent_kn, name); if (kn) { /* @@ -3124,7 +3139,7 @@ static int mkdir_mondata_subdir(struct kernfs_node *p= arent_kn, ret =3D rdtgroup_kn_set_ugid(kn); if (ret) goto out_destroy; - ret =3D mon_add_all_files(kn, d, r, prgrp, snc_mode); + ret =3D mon_add_all_files(kn, hdr, r, prgrp, snc_mode); if (ret) goto out_destroy; } @@ -3141,7 +3156,7 @@ static int mkdir_mondata_subdir(struct kernfs_node *p= arent_kn, if (ret) goto out_destroy; =20 - ret =3D mon_add_all_files(ckn, d, r, prgrp, false); + ret =3D mon_add_all_files(ckn, hdr, r, prgrp, false); if (ret) goto out_destroy; } @@ -3159,7 +3174,7 @@ static int mkdir_mondata_subdir(struct kernfs_node *p= arent_kn, * and "monitor" groups with given domain id. */ static void mkdir_mondata_subdir_allrdtgrp(struct rdt_resource *r, - struct rdt_mon_domain *d) + struct rdt_domain_hdr *hdr) { struct kernfs_node *parent_kn; struct rdtgroup *prgrp, *crgrp; @@ -3170,17 +3185,17 @@ static void mkdir_mondata_subdir_allrdtgrp(struct r= dt_resource *r, * so that mon_get_default_kn_priv() can find the allocated structure * on subsequent calls. */ - mkdir_mondata_subdir(kn_mondata, d, r, &rdtgroup_default); + mkdir_mondata_subdir(kn_mondata, hdr, r, &rdtgroup_default); =20 list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) { parent_kn =3D prgrp->mon.mon_data_kn; if (prgrp !=3D &rdtgroup_default) - mkdir_mondata_subdir(parent_kn, d, r, prgrp); + mkdir_mondata_subdir(parent_kn, hdr, r, prgrp); =20 head =3D &prgrp->mon.crdtgrp_list; list_for_each_entry(crgrp, head, mon.crdtgrp_list) { parent_kn =3D crgrp->mon.mon_data_kn; - mkdir_mondata_subdir(parent_kn, d, r, crgrp); + mkdir_mondata_subdir(parent_kn, hdr, r, crgrp); } } } @@ -3189,14 +3204,14 @@ static int mkdir_mondata_subdir_alldom(struct kernf= s_node *parent_kn, struct rdt_resource *r, struct rdtgroup *prgrp) { - struct rdt_mon_domain *dom; + struct rdt_domain_hdr *hdr; int ret; =20 /* Walking r->domains, ensure it can't race with cpuhp */ lockdep_assert_cpus_held(); =20 - list_for_each_entry(dom, &r->mon_domains, hdr.list) { - ret =3D mkdir_mondata_subdir(parent_kn, dom, r, prgrp); + list_for_each_entry(hdr, &r->mon_domains, list) { + ret =3D mkdir_mondata_subdir(parent_kn, hdr, r, prgrp); if (ret) return ret; } @@ -4055,7 +4070,7 @@ void resctrl_offline_mon_domain(struct rdt_resource *= r, struct rdt_mon_domain *d * per domain monitor data directories. */ if (resctrl_mounted && resctrl_arch_mon_capable()) - rmdir_mondata_subdir_allrdtgrp(r, d); + rmdir_mondata_subdir_allrdtgrp(r, &d->hdr); =20 if (resctrl_is_mbm_enabled()) cancel_delayed_work(&d->mbm_over); @@ -4137,10 +4152,12 @@ int resctrl_online_ctrl_domain(struct rdt_resource = *r, struct rdt_ctrl_domain *d return err; } =20 -int resctrl_online_mon_domain(struct rdt_resource *r, struct rdt_mon_domai= n *d) +int resctrl_online_mon_domain(struct rdt_resource *r, struct rdt_domain_hd= r *hdr) { + struct rdt_mon_domain *d; int err; =20 + d =3D container_of(hdr, struct rdt_mon_domain, hdr); mutex_lock(&rdtgroup_mutex); =20 err =3D domain_setup_mon_state(r, d); @@ -4163,7 +4180,7 @@ int resctrl_online_mon_domain(struct rdt_resource *r,= struct rdt_mon_domain *d) * If resctrl is mounted, add per domain monitor data directories. */ if (resctrl_mounted && resctrl_arch_mon_capable()) - mkdir_mondata_subdir_allrdtgrp(r, d); + mkdir_mondata_subdir_allrdtgrp(r, hdr); =20 out_unlock: mutex_unlock(&rdtgroup_mutex); --=20 2.48.1 From nobody Mon Feb 9 08:54:32 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FE2A230BDF for ; Fri, 21 Mar 2025 23:16:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598986; cv=none; b=mQjezaiCi53Cw8b0UhXXldQSveyGqSpRhqfTXSdWyrn9pdsBiMYisisHYydc7h+ela4zDH5VBYesjwxJOCXDYAwqcf5bEYhV4AW0Bjbeyy8Iujbpy4gnpVvHTEjJtdx6AugCK8Ptj0Qe1MoDTr61l/lLcNUbyeAUFGaQcJhRe/k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598986; c=relaxed/simple; bh=9ieO6iCh64QmqQgaoWo0R5eNrTtSK9vtOxFM7AICgeE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qj6wJ5nXOdyo3JgfsWfR1CAjSY3mhCazviMq3O+nU6XaUZuHYT1Cko6Xyl/CL/bX4/htbXt8ws6QMMDpmiLoktjf7iqYoBkG8Wx+RanfpZEHJBgMgnhlJcueqbJxNHrZNuvB7vQH0omYLJ/9lxEfIYbsN5r9LyX4XbD0zgVRAI8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=TNG/Ydcc; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TNG/Ydcc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742598984; x=1774134984; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9ieO6iCh64QmqQgaoWo0R5eNrTtSK9vtOxFM7AICgeE=; b=TNG/YdccxiwUquGZAZm49RZ346zw9QurQOlf93nEvW1gWwPh1iPdFlC3 msH0e8YJeZ4w52+jIa1/SkmgVjEUSDLS8srPIzdJViYGCfDzUiJ5x1Lub udfLPaI/YkMhDiBu7BmolMkPIyne5DWKuIcaBQ09YEdSmBdJZQHU+OFPk 1JOghJDBR0a2TXNtN9GAI8GFfW9csItK3mjangLs7NHQWsaPWeGiENDAX W9I8ixUzSK+dymCAO3A7ayw0QQprxW8rvJOXt57/aPmLj9Z9RTxv93OpB sn5yLImWOGxrTVW+L810ebCnN+ez4AMpwLAcAz0XN67wjZo+js+vwDQ0s Q==; X-CSE-ConnectionGUID: x/x8nQR7TMC3EuvEK6DdCQ== X-CSE-MsgGUID: IsMVDXw2Qbeigm59nZEu8A== X-IronPort-AV: E=McAfee;i="6700,10204,11380"; a="43604574" X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="43604574" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:21 -0700 X-CSE-ConnectionGUID: IwGcQ+W4TIuzrrdoSM8c5w== X-CSE-MsgGUID: veRMWfJXT7yXN6DpwUziAw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="128354302" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:21 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v2 05/16] x86/resctrl: Add and initialize rdt_resource for package scope core monitor Date: Fri, 21 Mar 2025 16:15:55 -0700 Message-ID: <20250321231609.57418-6-tony.luck@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250321231609.57418-1-tony.luck@intel.com> References: <20250321231609.57418-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" New resource for monitoring core events reported at package level. Signed-off-by: Tony Luck --- include/linux/resctrl.h | 1 + include/linux/resctrl_types.h | 1 + fs/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/core.c | 11 +++++++++++ fs/resctrl/rdtgroup.c | 2 ++ 5 files changed, 17 insertions(+) diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 25c3ee78de3d..6c895ec220fe 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -233,6 +233,7 @@ enum resctrl_scope { RESCTRL_L2_CACHE =3D 2, RESCTRL_L3_CACHE =3D 3, RESCTRL_L3_NODE, + RESCTRL_PACKAGE, }; =20 /** diff --git a/include/linux/resctrl_types.h b/include/linux/resctrl_types.h index a7faf2cd5406..8f967e03af5a 100644 --- a/include/linux/resctrl_types.h +++ b/include/linux/resctrl_types.h @@ -39,6 +39,7 @@ enum resctrl_res_level { RDT_RESOURCE_L2, RDT_RESOURCE_MBA, RDT_RESOURCE_SMBA, + RDT_RESOURCE_INTEL_AET, =20 /* Must be the last */ RDT_NUM_RESOURCES, diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h index ec3863d18f68..3a100007301d 100644 --- a/fs/resctrl/internal.h +++ b/fs/resctrl/internal.h @@ -240,6 +240,8 @@ struct rdtgroup { =20 #define RFTYPE_DEBUG BIT(10) =20 +#define RFTYPE_RES_PKG BIT(11) + #define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) =20 #define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index c316268b4442..c8cc3104f56c 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -99,6 +99,15 @@ struct rdt_hw_resource rdt_resources_all[RDT_NUM_RESOURC= ES] =3D { .schema_fmt =3D RESCTRL_SCHEMA_RANGE, }, }, + [RDT_RESOURCE_INTEL_AET] =3D + { + .r_resctrl =3D { + .rid =3D RDT_RESOURCE_INTEL_AET, + .name =3D "PKG", + .mon_scope =3D RESCTRL_PACKAGE, + .mon_domains =3D mon_domain_init(RDT_RESOURCE_INTEL_AET), + }, + }, }; =20 u32 resctrl_arch_system_num_rmid_idx(void) @@ -430,6 +439,8 @@ static int get_domain_id_from_scope(int cpu, enum resct= rl_scope scope) return get_cpu_cacheinfo_id(cpu, scope); case RESCTRL_L3_NODE: return cpu_to_node(cpu); + case RESCTRL_PACKAGE: + return topology_physical_package_id(cpu); default: break; } diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index dbfb7d3bc3bc..a90291f57330 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2179,6 +2179,8 @@ static unsigned long fflags_from_resource(struct rdt_= resource *r) case RDT_RESOURCE_MBA: case RDT_RESOURCE_SMBA: return RFTYPE_RES_MB; + case RDT_RESOURCE_INTEL_AET: + return RFTYPE_RES_PKG; } =20 return WARN_ON_ONCE(1); --=20 2.48.1 From nobody Mon Feb 9 08:54:32 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 408F2230BEF for ; Fri, 21 Mar 2025 23:16:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598984; cv=none; b=ePGMbQyDoGeTBWGuA95DkaaFsNVeNgTkjH/4d2hHxJCZ6l5SsP2YqRRj1F/RzY8iftAsMgbCzuAz8xdcQMG+j+ucq7VUiVZyXAePda6wBRyDA0O0vuJlK8w3Zf11cQpTar+QVTM+ptOfWVkmyUIzHLAcc5h8/uCllrN40OsIPcA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598984; c=relaxed/simple; bh=bE1sllvr9lOs6GOzkJd2hz5aTdVvawCduXr1ml5IkQM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fOMxd5XBMw6GJT2HQcn8amy18RbvSxXbMwRu6m5E0g/DU1s7bNfs3s/DLHU4mkvnW8I+8aoKScKjmWroiqESvqhuDX9ufmEVbNPllXACU1/pPaUdVwQa7B9HBEnK/Z9/dZBu75K3N6EI93W7YlknSXRZlQcbtfrVafSUMWcmPWA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Ts68x1jL; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ts68x1jL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742598984; x=1774134984; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bE1sllvr9lOs6GOzkJd2hz5aTdVvawCduXr1ml5IkQM=; b=Ts68x1jLS4lUIcTyGR5uahxD7Xl0JFAQn7pimeF8NTEedzosrlAqiQ4o pkU8NUVOHm8lhPsizEJkVFtxYIAtXF0UHs12pQvVvQ0RWPXorzPnip7Jl F++DDU8EWfKee8lgEIiLe4O1dQmxKz3sQXQLIlq0fi46vEWFjndMqiQKw XC7w9RdlRTJwjyT+IdNJthuq0dnJ2aakr5ae1iqwmh8eluta9usDz1aL1 Qy5NlHTks7XMgA/FQbtVTKzU/jF9XuQK9i1DEEraekzJInH+2cQx66eX4 +4HzLFM/IY6Uc45bGzxcfqbDMe6YdLmH32irc3HX2nBt5UA2L5DujQWfg w==; X-CSE-ConnectionGUID: 8jDyGVT8SS+IXfnHSN1shQ== X-CSE-MsgGUID: rcTYoAPrTKOxnbFZGRxg5Q== X-IronPort-AV: E=McAfee;i="6700,10204,11380"; a="43604581" X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="43604581" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:21 -0700 X-CSE-ConnectionGUID: 6O3yoI/pSFGxYQgRWOUHcQ== X-CSE-MsgGUID: yQPjjR9FR7O99WQORDqyVg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="128354306" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:21 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v2 06/16] x86/resctrl: Prepare for resource specific event ids Date: Fri, 21 Mar 2025 16:15:56 -0700 Message-ID: <20250321231609.57418-7-tony.luck@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250321231609.57418-1-tony.luck@intel.com> References: <20250321231609.57418-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Event ids ought to be specific to each resource. Keep enum resctrl_event_id for event ids in the RDT_RESOURCE_L3. But change the type in generic areas to unsigned int so that new resources can have their own event ids. Signed-off-by: Tony Luck --- fs/resctrl/internal.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h index 3a100007301d..422f36573db7 100644 --- a/fs/resctrl/internal.h +++ b/fs/resctrl/internal.h @@ -69,13 +69,13 @@ static inline struct rdt_fs_context *rdt_fc2context(str= uct fs_context *fc) =20 /** * struct mon_evt - Entry in the event list of a resource - * @evtid: event id + * @evtid: per resource event id * @name: name of the event * @configurable: true if the event is configurable * @list: entry in &rdt_resource->evt_list */ struct mon_evt { - enum resctrl_event_id evtid; + unsigned int evtid; char *name; bool configurable; struct list_head list; @@ -84,7 +84,7 @@ struct mon_evt { /** * struct mon_data - Monitoring details for each event file. * @rid: Resource id associated with the event file. - * @evtid: Event id associated with the event file. + * @evtid: Per resource event id associated with the event file. * @sum: Set when event must be summed across multiple * domains. * @domid: When @sum is zero this is the domain to which @@ -97,7 +97,7 @@ struct mon_evt { */ struct mon_data { unsigned int rid; - enum resctrl_event_id evtid; + unsigned int evtid; unsigned int sum; unsigned int domid; }; @@ -124,7 +124,7 @@ struct rmid_read { struct rdtgroup *rgrp; struct rdt_resource *r; struct rdt_mon_domain *d; - enum resctrl_event_id evtid; + unsigned int evtid; bool first; struct cacheinfo *ci; int err; --=20 2.48.1 From nobody Mon Feb 9 08:54:32 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9B8F23370F for ; Fri, 21 Mar 2025 23:16:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598986; cv=none; b=txY1NLIC5eTA4ZpfxDqEZfvQVCAo5s7oEF1Y7jkk9gx0DuR8pYA8IgzlHSD341uJIyb3neXsyOwEllsi8CxbvCv2OS/VeWz8y8o3k/At9CzHe64Rz+lvd4Eho0aWCeY8YrFO524hQZf4AKmuM0F+6JcqIyw6+IaV1aTivhED6J4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598986; c=relaxed/simple; bh=5pUAwn0PpJ0GvI4TOD5atFueR3MvGjgzGmsNB3jneVA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gt8tqw8XT5uE7VpTbe5j3JVkDiw5+G5oEO7Ai9FTbkJSyMo60TP7cYyxnKB9DNK3O496+eeNsrphHpk8/RPlPtisbXUaQH78SwKwKhuewEKSQCRYGVXlNsrgWJ2kfEjZ0NFCQxegXjsfOG/KsrkczbfhkOYt9L+ZXltGLHNK7uI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=dOKQ1+G2; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="dOKQ1+G2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742598985; x=1774134985; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5pUAwn0PpJ0GvI4TOD5atFueR3MvGjgzGmsNB3jneVA=; b=dOKQ1+G2hlnpocJpVNw2xZtq1EKZ/e8YUEqll9blaWx/tAoPWULwA8Vw 2lptx+dbBiS5HqfVy6DzdbX5d90H5yJn7IwHuSvt/eFH///rxfPaj7b4V 3Fh0XAGU7s63FCOv69Kn7xMJ49nJgsl4A18s410Wi6KfaVgFTMHK14A+z ckOgrwYdwZDSx3Nnfzxsqm4PX4aRfXRkKEq4Gi0LsPAsP2+RuCwV+5JDd ESz5TwEsV7X7kj4bfEOT+AoeANdPRfKuGVMy8NYkRuBC4onXDhlcpCQdD zY79MfciKdWbV91YiMwi2DvfTO50wNB7vK0xwbjMTwQoHnVcVcQh5zney Q==; X-CSE-ConnectionGUID: xJyLiBk3TrWV1yy7sDp2uA== X-CSE-MsgGUID: bprZPEvIR+WrKAbJchi3ag== X-IronPort-AV: E=McAfee;i="6700,10204,11380"; a="43604588" X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="43604588" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:22 -0700 X-CSE-ConnectionGUID: MqmpnjQTTPO4Zuxgaqno1Q== X-CSE-MsgGUID: 7P6NfqYBTnOVVY0xNRM5Ug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="128354309" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:21 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v2 07/16] x86/resctrl: Add initialization hook for Intel PMT events Date: Fri, 21 Mar 2025 16:15:57 -0700 Message-ID: <20250321231609.57418-8-tony.luck@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250321231609.57418-1-tony.luck@intel.com> References: <20250321231609.57418-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Call the OOBMSM discovery code to find out if there are any event groups that match unique identifiers understood by resctrl. Note that initiialzation must happen in two phases because the OOBMSM VSEC discovery process is not complete at resctrl "lateinit()" initialization time. So there is an initial hook that assumes that Intel PMT will exist, called early so that package scoped domain groups are initialized. At first mount the remainder of initialization is done. If there are no Intel PMT events, the package domain lists are removed. Move definition of struct mon_evt to Events for specific systems to be added by a separate patch. Signed-off-by: Tony Luck --- include/linux/resctrl.h | 14 ++ include/linux/resctrl_types.h | 14 ++ arch/x86/kernel/cpu/resctrl/internal.h | 6 + fs/resctrl/internal.h | 14 -- arch/x86/kernel/cpu/resctrl/core.c | 9 +- arch/x86/kernel/cpu/resctrl/intel_aet.c | 211 ++++++++++++++++++++++++ fs/resctrl/rdtgroup.c | 3 + arch/x86/kernel/cpu/resctrl/Makefile | 1 + 8 files changed, 255 insertions(+), 17 deletions(-) create mode 100644 arch/x86/kernel/cpu/resctrl/intel_aet.c diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 6c895ec220fe..999e0802a26e 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -170,6 +170,14 @@ struct rdt_mon_domain { int cqm_work_cpu; }; =20 +/** + * struct rdt_core_mon_domain - CPUs sharing an Intel-PMT-scoped resctrl m= onitor resource + * @hdr: common header for different domain types + */ +struct rdt_core_mon_domain { + struct rdt_domain_hdr hdr; +}; + /** * struct resctrl_cache - Cache allocation related data * @cbm_len: Length of the cache bit mask @@ -522,4 +530,10 @@ extern unsigned int resctrl_rmid_realloc_limit; int resctrl_init(void); void resctrl_exit(void); =20 +#ifdef CONFIG_INTEL_AET_RESCTRL +void rdt_get_intel_aet_mount(void); +#else +static inline void rdt_get_intel_aet_mount(void) { } +#endif + #endif /* _RESCTRL_H */ diff --git a/include/linux/resctrl_types.h b/include/linux/resctrl_types.h index 8f967e03af5a..d56fcd082d2c 100644 --- a/include/linux/resctrl_types.h +++ b/include/linux/resctrl_types.h @@ -57,4 +57,18 @@ enum resctrl_event_id { =20 #define QOS_NUM_EVENTS (QOS_L3_MBM_LOCAL_EVENT_ID + 1) =20 +/** + * struct mon_evt - Entry in the event list of a resource + * @evtid: per resource event id + * @name: name of the event + * @configurable: true if the event is configurable + * @list: entry in &rdt_resource->evt_list + */ +struct mon_evt { + unsigned int evtid; + char *name; + bool configurable; + struct list_head list; +}; + #endif /* __LINUX_RESCTRL_TYPES_H */ diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index 521db28efb3f..ada402c7678b 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -168,6 +168,12 @@ void rdt_ctrl_update(void *arg); =20 int rdt_get_mon_l3_config(struct rdt_resource *r); =20 +#ifdef CONFIG_INTEL_AET_RESCTRL +int rdt_get_intel_aet_mon_config(void); +#else +static inline int rdt_get_intel_aet_mon_config(void) { return 0; } +#endif + bool rdt_cpu_has(int flag); =20 void __init intel_rdt_mbm_apply_quirk(void); diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h index 422f36573db7..f5a698b49e97 100644 --- a/fs/resctrl/internal.h +++ b/fs/resctrl/internal.h @@ -67,20 +67,6 @@ static inline struct rdt_fs_context *rdt_fc2context(stru= ct fs_context *fc) return container_of(kfc, struct rdt_fs_context, kfc); } =20 -/** - * struct mon_evt - Entry in the event list of a resource - * @evtid: per resource event id - * @name: name of the event - * @configurable: true if the event is configurable - * @list: entry in &rdt_resource->evt_list - */ -struct mon_evt { - unsigned int evtid; - char *name; - bool configurable; - struct list_head list; -}; - /** * struct mon_data - Monitoring details for each event file. * @rid: Resource id associated with the event file. diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index c8cc3104f56c..1ab0f5eec244 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -882,6 +882,7 @@ static __init bool get_rdt_alloc_resources(void) static __init bool get_rdt_mon_resources(void) { struct rdt_resource *r =3D &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl; + int ret1 =3D -EINVAL, ret2; =20 if (rdt_cpu_has(X86_FEATURE_CQM_OCCUP_LLC)) rdt_mon_features |=3D (1 << QOS_L3_OCCUP_EVENT_ID); @@ -890,10 +891,12 @@ static __init bool get_rdt_mon_resources(void) if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) rdt_mon_features |=3D (1 << QOS_L3_MBM_LOCAL_EVENT_ID); =20 - if (!rdt_mon_features) - return false; + if (rdt_mon_features) + ret1 =3D rdt_get_mon_l3_config(r); + + ret2 =3D rdt_get_intel_aet_mon_config(); =20 - return !rdt_get_mon_l3_config(r); + return ret1 =3D=3D 0 || ret2; } =20 static __init void __check_quirks_intel(void) diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/= resctrl/intel_aet.c new file mode 100644 index 000000000000..9a8ccb62b4ab --- /dev/null +++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c @@ -0,0 +1,211 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Resource Director Technology(RDT) + * - Intel Application Energy Telemetry + * + * Copyright (C) 2025 Intel Corporation + * + * Author: + * Tony Luck + */ + +#define pr_fmt(fmt) "resctrl: " fmt + +#include +#include +#include +#include "fake_intel_aet_features.h" +#include +#include + +#include "internal.h" + +static struct pmt_feature_group *feat_energy; +static struct pmt_feature_group *feat_perf; + +/* All telemetry events from Intel CPUs */ +enum pmt_event_id { + PMT_EVENT_ENERGY, + PMT_EVENT_ACTIVITY, + PMT_EVENT_STALLS_LLC_HIT, + PMT_EVENT_C1_RES, + PMT_EVENT_UNHALTED_CORE_CYCLES, + PMT_EVENT_STALLS_LLC_MISS, + PMT_EVENT_AUTO_C6_RES, + PMT_EVENT_UNHALTED_REF_CYCLES, + PMT_EVENT_UOPS_RETIRED, + + PMT_NUM_EVENTS +}; + +/** + * enum evt_type - Type for values for each event. + * @EVT_U64: Integer up to 64 bits + * @EVT_U46_18: Fixed point binary, 46 bits for integer, 18 binary place b= its + */ +enum evt_type { + EVT_U64, + EVT_U46_18, +}; + +#define EVT(id, evtname, offset, t) \ + { \ + .evt =3D { \ + .evtid =3D id, \ + .name =3D evtname \ + }, \ + .evt_offset =3D offset, \ + .evt_type =3D t \ + } + +/** + * struct pmt_event - Telemetry event. + * @evt: Resctrl event + * @evt_offset: MMIO offset of counter + * @evt_type: Type + */ +struct pmt_event { + struct mon_evt evt; + int evt_offset; + enum evt_type evt_type; +}; + +/** + * struct telem_entry - Summarized form from XML telemetry description + * @name: Name for this group of events + * @guid: Unique ID for this group + * @num_rmids: Number of RMIDS supported + * @stride: Number of bytes of counters for each RMID + * @overflow_counter_off: Offset od overflow count + * @last_overflow_tstamp_off: Offset of overflow timestamp + * @last_update_tstamp_off: Offset of last update timestamp + * @active: Marks this group as active on current CPU + * @evts: Telemetry events in this group + */ +struct telem_entry { + char *name; + int guid; + int num_rmids; + int stride; + int overflow_counter_off; + int last_overflow_tstamp_off; + int last_update_tstamp_off; + bool active; + struct pmt_event evts[]; +}; + +/* All known telemetry event groups */ +static struct telem_entry *telem_entry[] =3D { + NULL +}; + +/* Per-package event groups active on this machine */ +static struct pkg_info { + int count; + struct telemetry_region *regions; +} *pkg_info; + +/* + * Scan a feature group looking for guids recognized by this code + * and update the per-package counts of known groups. + */ +static bool count_events(struct pkg_info *pkg, int max_pkgs, struct pmt_fe= ature_group *p) +{ + struct telem_entry **tentry; + bool found =3D false; + + for (int i =3D 0; i < p->count; i++) { + struct telemetry_region *tr =3D &p->regions[i]; + + for (tentry =3D telem_entry; *tentry; tentry++) { + if (tr->guid =3D=3D (*tentry)->guid) { + if (tr->plat_info.package_id > max_pkgs) { + pr_warn_once("Bad package %d\n", tr->plat_info.package_id); + continue; + } + found =3D true; + (*tentry)->active =3D true; + pkg[tr->plat_info.package_id].count++; + break; + } + } + } + + return found; +} + +DEFINE_FREE(intel_pmt_put_feature_group, struct pmt_feature_group *, \ + if (!IS_ERR_OR_NULL(_T)) \ + intel_pmt_put_feature_group(_T)) + +/* + * Ask OOBMSM discovery driver for all the RMID based telemetry groups + * that it supports. + */ +static bool get_events(void) +{ + struct pmt_feature_group *p1 __free(intel_pmt_put_feature_group) =3D NULL; + struct pmt_feature_group *p2 __free(intel_pmt_put_feature_group) =3D NULL; + int num_pkgs =3D topology_max_packages(); + struct pkg_info *pkg __free(kfree) =3D NULL; + + pkg =3D kmalloc_array(num_pkgs, sizeof(*pkg_info), GFP_KERNEL | __GFP_ZER= O); + if (!pkg) + return false; + + p1 =3D intel_pmt_get_regions_by_feature(FEATURE_PER_RMID_ENERGY_TELEM); + p2 =3D intel_pmt_get_regions_by_feature(FEATURE_PER_RMID_PERF_TELEM); + + if (IS_ERR_VALUE(p1) && IS_ERR_VALUE(p1)) + return false; + + if (!IS_ERR_VALUE(p1)) + if (!count_events(pkg, num_pkgs, p1)) + intel_pmt_put_feature_group(no_free_ptr(p1)); + if (!IS_ERR_VALUE(p2)) + if (!count_events(pkg, num_pkgs, p2)) + intel_pmt_put_feature_group(no_free_ptr(p2)); + + if (!IS_ERR_OR_NULL(p1)) + feat_energy =3D no_free_ptr(p1); + if (!IS_ERR_OR_NULL(p2)) + feat_perf =3D no_free_ptr(p2); + pkg_info =3D no_free_ptr(pkg); + + return true; +} + +/* + * Early initialization. Cannot do much here because OOBMSM has not + * completed enumeration of telemetry event groups. + */ +int rdt_get_intel_aet_mon_config(void) +{ + struct rdt_resource *r =3D &rdt_resources_all[RDT_RESOURCE_INTEL_AET].r_r= esctrl; + + INIT_LIST_HEAD(&r->evt_list); + + return 1; +} + +/* + * Late (first mount) initialization. Safe to ask OOBMSM which telemetry + * event groups are supported. + */ +void rdt_get_intel_aet_mount(void) +{ + struct rdt_resource *r =3D &rdt_resources_all[RDT_RESOURCE_INTEL_AET].r_r= esctrl; + struct rdt_core_mon_domain *d, *tmp; + static int do_one_time; + + if (do_one_time) + return; + + do_one_time =3D 1; + + if (!get_events()) { + list_for_each_entry_safe(d, tmp, &r->mon_domains, hdr.list) + kfree(d); + r->mon_capable =3D false; + } +} diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index a90291f57330..4833dfa08ce3 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2572,6 +2572,9 @@ static int rdt_get_tree(struct fs_context *fc) =20 cpus_read_lock(); mutex_lock(&rdtgroup_mutex); + + rdt_get_intel_aet_mount(); + /* * resctrl file system can only be mounted once. */ diff --git a/arch/x86/kernel/cpu/resctrl/Makefile b/arch/x86/kernel/cpu/res= ctrl/Makefile index 2c3b09f95127..a47e1c214087 100644 --- a/arch/x86/kernel/cpu/resctrl/Makefile +++ b/arch/x86/kernel/cpu/resctrl/Makefile @@ -2,6 +2,7 @@ obj-$(CONFIG_X86_CPU_RESCTRL) +=3D core.o rdtgroup.o monitor.o obj-$(CONFIG_X86_CPU_RESCTRL) +=3D ctrlmondata.o obj-$(CONFIG_RESCTRL_FS_PSEUDO_LOCK) +=3D pseudo_lock.o +obj-$(CONFIG_INTEL_AET_RESCTRL) +=3D intel_aet.o obj-$(CONFIG_INTEL_AET_RESCTRL) +=3D fake_intel_aet_features.o =20 # To allow define_trace.h's recursive include: --=20 2.48.1 From nobody Mon Feb 9 08:54:32 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD478233713 for ; Fri, 21 Mar 2025 23:16:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598986; cv=none; b=l4mf3eOfTq19yb1VTj70ZV9UiU+zHwGrp44oZbyV2cYH+gzvC1ErjV8jaXEjg3NKp8ihu8iYWzwWk8AMMG4VhTvCK+fiRYGluIYyXeSYsobAN5g7keH3gyUURll+lrOlgFbWte4Wpzedd4KFhyZMNi3VRxWDvf9/yetfoQA6/aU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598986; c=relaxed/simple; bh=Tevqw1RmArPpC2Ze0nf0CBxzpci8OzxKGJJTa6CwTvc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hYJ40YNiNMQdbc5a8HA/MYH3T3Yv+mmMPVW8H4G+Y6dhZDUYdK7Gc4grfwaLvuU+6mGZ5fRaEtl9UAB1YMBGsfV9n+Zc8vK5arEva4vQ+/+Li9qz4f6py6tzjbhAR9KDS1mu8xG6WQRugQUyB/pLnvrFsTW1ofgLGaazMSSBddQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=fhTq9hLP; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fhTq9hLP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742598985; x=1774134985; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Tevqw1RmArPpC2Ze0nf0CBxzpci8OzxKGJJTa6CwTvc=; b=fhTq9hLPukMPc2fT80F6B+9ohf9dNBNBTdzPvOFjw03t1ofdYsX8QpZZ zTDWSLjY9qaRN47KSSsqEFamL/G7Pjeq1l3myZYxwdCqfOkF4x1Dj9j9N 3cArl061mrdYfZ9jMPozQpebKVu23V7lrvZRNzfYG3Yd87HcFc6VE/343 TGJobl2Yola/XgH1+ctFrj7bbiBXMxNtVuB9m8IIz+UZ44hXoSsd1xjkk g3TZwbphuIK+RRWUqbPNB4O0P7yJ+5XmWvY9qpjDrmWbFfYYdMALrG3UB ODEN8ZUr99ClbDZ60hg5Iu9ZplHHCdzhqxAW62KGZPN7VTS4RmZP0ytpr Q==; X-CSE-ConnectionGUID: rLMoVxroRBWsnU72DG+XWA== X-CSE-MsgGUID: yhKNQvBIRzu4cwzNRu/rSg== X-IronPort-AV: E=McAfee;i="6700,10204,11380"; a="43604595" X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="43604595" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:22 -0700 X-CSE-ConnectionGUID: v4xcqgwoTVKEay4ZRmficw== X-CSE-MsgGUID: 27922Y0nQfierbmeQ9yyzw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="128354312" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:22 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v2 08/16] x86/resctrl: Add Intel PMT domain specific code Date: Fri, 21 Mar 2025 16:15:58 -0700 Message-ID: <20250321231609.57418-9-tony.luck@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250321231609.57418-1-tony.luck@intel.com> References: <20250321231609.57418-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Domain specific initialization and tear down. Very simple as there are no domain specific elements that need to be allocated or initiailazed. Just the domain itself. Signed-off-by: Tony Luck --- arch/x86/kernel/cpu/resctrl/core.c | 32 ++++++++++++++++++++++++++++++ fs/resctrl/rdtgroup.c | 11 ++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index 1ab0f5eec244..2adf40d8de32 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -541,6 +541,29 @@ static void setup_l3_mon_domain(int cpu, int id, struc= t rdt_resource *r, struct } } =20 +static void setup_intel_aet_mon_domain(int cpu, int id, struct rdt_resourc= e *r, + struct list_head *add_pos) +{ + struct rdt_core_mon_domain *d; + int err; + + d =3D kzalloc_node(sizeof(*d), GFP_KERNEL, cpu_to_node(cpu)); + if (!d) + return; + + d->hdr.id =3D id; + d->hdr.type =3D RESCTRL_MON_DOMAIN; + cpumask_set_cpu(cpu, &d->hdr.cpu_mask); + list_add_tail_rcu(&d->hdr.list, add_pos); + + err =3D resctrl_online_mon_domain(r, &d->hdr); + if (err) { + list_del_rcu(&d->hdr.list); + synchronize_rcu(); + kfree(d); + } +} + static void domain_add_cpu_mon(int cpu, struct rdt_resource *r) { int id =3D get_domain_id_from_scope(cpu, r->mon_scope); @@ -565,6 +588,9 @@ static void domain_add_cpu_mon(int cpu, struct rdt_reso= urce *r) case RDT_RESOURCE_L3: setup_l3_mon_domain(cpu, id, r, add_pos); break; + case RDT_RESOURCE_INTEL_AET: + setup_intel_aet_mon_domain(cpu, id, r, add_pos); + break; default: WARN_ON_ONCE(1); } @@ -661,6 +687,12 @@ static void domain_remove_cpu_mon(int cpu, struct rdt_= resource *r) synchronize_rcu(); mon_domain_free(hw_dom); break; + case RDT_RESOURCE_INTEL_AET: + resctrl_offline_mon_domain(r, d); + list_del_rcu(&hdr->list); + synchronize_rcu(); + kfree(container_of(hdr, struct rdt_core_mon_domain, hdr)); + break; } } =20 diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 4833dfa08ce3..d3919642aa9b 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -4077,6 +4077,9 @@ void resctrl_offline_mon_domain(struct rdt_resource *= r, struct rdt_mon_domain *d if (resctrl_mounted && resctrl_arch_mon_capable()) rmdir_mondata_subdir_allrdtgrp(r, &d->hdr); =20 + if (r->rid =3D=3D RDT_RESOURCE_INTEL_AET) + goto done; + if (resctrl_is_mbm_enabled()) cancel_delayed_work(&d->mbm_over); if (resctrl_arch_is_llc_occupancy_enabled() && has_busy_rmid(d)) { @@ -4093,7 +4096,7 @@ void resctrl_offline_mon_domain(struct rdt_resource *= r, struct rdt_mon_domain *d } =20 domain_destroy_mon_state(d); - +done: mutex_unlock(&rdtgroup_mutex); } =20 @@ -4160,11 +4163,14 @@ int resctrl_online_ctrl_domain(struct rdt_resource = *r, struct rdt_ctrl_domain *d int resctrl_online_mon_domain(struct rdt_resource *r, struct rdt_domain_hd= r *hdr) { struct rdt_mon_domain *d; - int err; + int err =3D 0; =20 d =3D container_of(hdr, struct rdt_mon_domain, hdr); mutex_lock(&rdtgroup_mutex); =20 + if (r->rid =3D=3D RDT_RESOURCE_INTEL_AET) + goto do_mkdir; + err =3D domain_setup_mon_state(r, d); if (err) goto out_unlock; @@ -4178,6 +4184,7 @@ int resctrl_online_mon_domain(struct rdt_resource *r,= struct rdt_domain_hdr *hdr if (resctrl_arch_is_llc_occupancy_enabled()) INIT_DELAYED_WORK(&d->cqm_limbo, cqm_handle_limbo); =20 +do_mkdir: /* * If the filesystem is not mounted then only the default resource group * exists. Creation of its directories is deferred until mount time --=20 2.48.1 From nobody Mon Feb 9 08:54:32 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47ED9233D86 for ; Fri, 21 Mar 2025 23:16:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598988; cv=none; b=tjv3vlCnvqJndoFqBtEZeom/RPdCjVfT8hKStVfxwNBiXDLnqy2193wfAfLkj/Ti3Yk7hKO93H2Ck6fBt/+MGk4KBUiVwBgi0Ngny/cW6f0ayxdu2EsgWBEd29KrMEbWL8mBJLKxl62zetlFaYyxGjPjRpEFJQD/aHIvYbXdknA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598988; c=relaxed/simple; bh=EelZRvoSNl3GeFDTwR9XrsX4puLt4kUGCZtESpc/1Zw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V8UPao7Xbu2A7Er1hkTu9seUuK2/ToomXGlfIGqOH8Wsg7X7zY7pa9BZneSV0+0jJgWxrms6mdtQ55qkKTSClj+MMz2gGQ58nEhXVErzaQ/WUZzYCrnKp/uDPt/F9McAS8K8FkqlsrPZAf92V+iotmHi5H6u6K0yKYoB3n/iNW4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WOH9ZsS9; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WOH9ZsS9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742598987; x=1774134987; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EelZRvoSNl3GeFDTwR9XrsX4puLt4kUGCZtESpc/1Zw=; b=WOH9ZsS9GYOdZwuj7oSJ0T6L3M4PiS9NRx5wNK1R3reZ922yN2HpnQTj ybwpEuBxlhngp8p6eTY89tv1nH6OJdaYKw3UX78MNKQhlBOYJGnG2Elis QY8+Uf9zdoyN1HJZH9Qsj8+HKkTl0JfG5GSDXdqF3rQOOacVFoOGDbJ6U Qy+o5B7bK92A1UDsanE21LP11b3rLX7H7Y9ccni4p7qNrHUyYZHl3aFS6 7+zru623AFJLGGqqSSyBSOcHJpFgHHuAKHv+8vh7hma/v+CELlWhrJcEH B6Efg9tx9UOH9T3SmX3n3ROs4v/V726WTkFF5TfwRUTycLCnNmiQ913Gu A==; X-CSE-ConnectionGUID: qjw1EKbuRIy7rf2H2lZDxA== X-CSE-MsgGUID: M35qyD8NRiWimTZ6iVtG6Q== X-IronPort-AV: E=McAfee;i="6700,10204,11380"; a="43604603" X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="43604603" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:22 -0700 X-CSE-ConnectionGUID: VNVNbhtLTh6z9ePbxiQRzg== X-CSE-MsgGUID: fQOcj1/pSvaITgqDnDlzXA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="128354315" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:22 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v2 09/16] x86/resctrl: Add detailed descriptions for Clearwater Forest events Date: Fri, 21 Mar 2025 16:15:59 -0700 Message-ID: <20250321231609.57418-10-tony.luck@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250321231609.57418-1-tony.luck@intel.com> References: <20250321231609.57418-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There are two event groups one for energy reporting and another for "perf" events. See the XML description files in https://github.com/intel/Intel-PMT in the xml/CWF/OOBMSM/{RMID-ENERGY,RMID-PERF}/ for the detailed descriptions that were used to derive these descriptions. Signed-off-by: Tony Luck --- arch/x86/kernel/cpu/resctrl/intel_aet.c | 54 +++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/= resctrl/intel_aet.c index 9a8ccb62b4ab..67862e81b9e0 100644 --- a/arch/x86/kernel/cpu/resctrl/intel_aet.c +++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c @@ -94,8 +94,62 @@ struct telem_entry { struct pmt_event evts[]; }; =20 +/* + * Known events from Intel Clearwater Forest CPU. + */ +#define CWF_NUM_RMIDS 576 +#define CWF_ENERGY_GUID 0x26696143 +#define CWF_PERF_GUID 0x26557651 +#define CWF_ENERGY_STRIDE 0x10 +#define CWF_PERF_STRIDE 0x38 + +/* + * https://github.com/intel/Intel-PMT + * xml/CWF/OOBMSM/RMID-ENERGY *.xml + */ +static struct telem_entry cwf_energy =3D { + .name =3D "energy", + .guid =3D CWF_ENERGY_GUID, + .num_rmids =3D CWF_NUM_RMIDS, + .stride =3D CWF_ENERGY_STRIDE, + .overflow_counter_off =3D CWF_NUM_RMIDS * CWF_ENERGY_STRIDE, + .last_overflow_tstamp_off =3D CWF_NUM_RMIDS * CWF_ENERGY_STRIDE + 8, + .last_update_tstamp_off =3D CWF_NUM_RMIDS * CWF_ENERGY_STRIDE + 16, + .evts =3D { + EVT(PMT_EVENT_ENERGY, "core_energy", 0x0, EVT_U46_18), + EVT(PMT_EVENT_ACTIVITY, "activity", 0x8, EVT_U46_18), + { } + } +}; + +/* + * https://github.com/intel/Intel-PMT + * xml/CWF/OOBMSM/RMID-PERF *.xml + */ +static struct telem_entry cwf_perf =3D { + .name =3D "perf", + .guid =3D CWF_PERF_GUID, + .num_rmids =3D CWF_NUM_RMIDS, + .stride =3D CWF_PERF_STRIDE, + .overflow_counter_off =3D CWF_NUM_RMIDS * CWF_PERF_STRIDE, + .last_overflow_tstamp_off =3D CWF_NUM_RMIDS * CWF_PERF_STRIDE + 8, + .last_update_tstamp_off =3D CWF_NUM_RMIDS * CWF_PERF_STRIDE + 16, + .evts =3D { + EVT(PMT_EVENT_STALLS_LLC_HIT, "stalls_llc_hit", 0x0, EVT_U64), + EVT(PMT_EVENT_C1_RES, "c1_res", 0x8, EVT_U64), + EVT(PMT_EVENT_UNHALTED_CORE_CYCLES, "unhalted_core_cycles", 0x10, EVT_U6= 4), + EVT(PMT_EVENT_STALLS_LLC_MISS, "stalls_llc_miss", 0x18, EVT_U64), + EVT(PMT_EVENT_AUTO_C6_RES, "c6_res", 0x20, EVT_U64), + EVT(PMT_EVENT_UNHALTED_REF_CYCLES, "unhalted_ref_cycles", 0x28, EVT_U64), + EVT(PMT_EVENT_UOPS_RETIRED, "uops_retired", 0x30, EVT_U64), + { } + } +}; + /* All known telemetry event groups */ static struct telem_entry *telem_entry[] =3D { + &cwf_energy, + &cwf_perf, NULL }; =20 --=20 2.48.1 From nobody Mon Feb 9 08:54:32 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7FB5233D9C for ; Fri, 21 Mar 2025 23:16:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598988; cv=none; b=gSM+Ss7ZLrRZ8GieWf5i3D2pVip1JAyxTe77MFdB/40eRfoVgJqdMtKNT+KS+4xUkTflqV1osd4Nq7GdzLBX71fNmYigPgvVHFgqRJUP9z361ose+YGUBxs9iL3L5J5QyACAl2LwLmK/3xV6QyiXiroAXw8q4Yk6tY+O1C+R1xY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598988; c=relaxed/simple; bh=cCNSar58WlYhHdFeOp9gxfKGPr/CcucOc0z3EF+w1bE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q+CYO87wLWYMNGrLzD5CGoQLh45E9QSlIsKq3jF/Q1S5VXudcFeD3iv1lN0qKNG1/Te9biFFrB7rPLA+KINlBJqF636m9Z2nuQ8ecqmBIvgvKXJTS7JZJO4B+p7MrA2Iq3MDsDH2XwCJ+XjjZVgAyjski1z8wU2POMVB8FOco6Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Tq+LrrEl; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Tq+LrrEl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742598987; x=1774134987; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cCNSar58WlYhHdFeOp9gxfKGPr/CcucOc0z3EF+w1bE=; b=Tq+LrrElwDKniiBcquTjH71vTmFwaOYwKAT2Q8pDP6VtL0oS/3pxlall p/mj9digXNsSpkdEYIdhBdFBRqP3fmwRQOoHEkins8GATAWyeOqzGuWTe j+6ogc9A7GRiimibKOSvOy9+ra3+1vTD3KPFyl02vNcVjtbngCE9bFhvv FsyFUDocdAtq5z7c+vV6/XxllL7jQCePNjtWwFhOrPAKu8LeABhJ5c5MC KjXud2/5PuVwcWBMR3GsVmvUw/JWLOUqCqcXYUsc9Y7z8RQ5eSN19xqzy C9BZN/0Qe0nhAU9sE1Lemw3/cMlVDvMigq9vgdVbFpxPI5ISqF+o6KGws w==; X-CSE-ConnectionGUID: DCq24Bh3QMytu1fhFHoj9Q== X-CSE-MsgGUID: AfRAtlk5TjKZdghvrCzPDg== X-IronPort-AV: E=McAfee;i="6700,10204,11380"; a="43604612" X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="43604612" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:23 -0700 X-CSE-ConnectionGUID: 6OtA2PDcRQyzQSn3ckEVdQ== X-CSE-MsgGUID: LojECj1aTE+LzbfmCtuksw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="128354318" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:23 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v2 10/16] x86/resctrl: Allocate per-package structures for known events Date: Fri, 21 Mar 2025 16:16:00 -0700 Message-ID: <20250321231609.57418-11-tony.luck@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250321231609.57418-1-tony.luck@intel.com> References: <20250321231609.57418-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the per-package counts of known events to allocate arrays to make a copy of just the known events. Add hook into resctrl_exit() to cleanup. Signed-off-by: Tony Luck --- arch/x86/kernel/cpu/resctrl/internal.h | 2 + arch/x86/kernel/cpu/resctrl/core.c | 2 + arch/x86/kernel/cpu/resctrl/intel_aet.c | 60 ++++++++++++++++++++++++- 3 files changed, 63 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index ada402c7678b..2503a24e4177 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -170,8 +170,10 @@ int rdt_get_mon_l3_config(struct rdt_resource *r); =20 #ifdef CONFIG_INTEL_AET_RESCTRL int rdt_get_intel_aet_mon_config(void); +void rdt_intel_aet_exit(void); #else static inline int rdt_get_intel_aet_mon_config(void) { return 0; } +static inline void rdt_intel_aet_exit(void) { }; #endif =20 bool rdt_cpu_has(int flag); diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index 2adf40d8de32..d011c095aafa 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -1095,6 +1095,8 @@ static void __exit resctrl_arch_exit(void) { cpuhp_remove_state(rdt_online); =20 + rdt_intel_aet_exit(); + resctrl_exit(); } =20 diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/= resctrl/intel_aet.c index 67862e81b9e0..e2d8eab997fc 100644 --- a/arch/x86/kernel/cpu/resctrl/intel_aet.c +++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c @@ -188,6 +188,26 @@ static bool count_events(struct pkg_info *pkg, int max= _pkgs, struct pmt_feature_ return found; } =20 +static int setup(struct pkg_info *pkg, int pkgnum, struct pmt_feature_grou= p *p, int slot) +{ + struct telem_entry **tentry; + + for (int i =3D 0; i < p->count; i++) { + for (tentry =3D telem_entry; *tentry; tentry++) { + if (!(*tentry)->active) + continue; + if (pkgnum !=3D p->regions[i].plat_info.package_id) + continue; + if (p->regions[i].guid !=3D (*tentry)->guid) + continue; + + pkg[pkgnum].regions[slot++] =3D p->regions[i]; + } + } + + return slot; +} + DEFINE_FREE(intel_pmt_put_feature_group, struct pmt_feature_group *, \ if (!IS_ERR_OR_NULL(_T)) \ intel_pmt_put_feature_group(_T)) @@ -202,6 +222,8 @@ static bool get_events(void) struct pmt_feature_group *p2 __free(intel_pmt_put_feature_group) =3D NULL; int num_pkgs =3D topology_max_packages(); struct pkg_info *pkg __free(kfree) =3D NULL; + bool found_known_features =3D false; + int i, slot; =20 pkg =3D kmalloc_array(num_pkgs, sizeof(*pkg_info), GFP_KERNEL | __GFP_ZER= O); if (!pkg) @@ -220,13 +242,32 @@ static bool get_events(void) if (!count_events(pkg, num_pkgs, p2)) intel_pmt_put_feature_group(no_free_ptr(p2)); =20 + for (i =3D 0; i < num_pkgs; i++) { + if (!pkg[i].count) + continue; + found_known_features =3D true; + pkg[i].regions =3D kmalloc_array(pkg[i].count, sizeof(*pkg[i].regions), = GFP_KERNEL); + if (!pkg[i].regions) + goto fail; + + slot =3D 0; + if (!IS_ERR_VALUE(p1)) + slot =3D setup(pkg, i, p1, slot); + if (!IS_ERR_VALUE(p2)) + slot =3D setup(pkg, i, p2, slot); + } + if (!IS_ERR_OR_NULL(p1)) feat_energy =3D no_free_ptr(p1); if (!IS_ERR_OR_NULL(p2)) feat_perf =3D no_free_ptr(p2); pkg_info =3D no_free_ptr(pkg); =20 - return true; + return found_known_features; +fail: + while (--i > 0) + kfree(pkg[i].regions); + return false; } =20 /* @@ -242,6 +283,23 @@ int rdt_get_intel_aet_mon_config(void) return 1; } =20 +/* Clean up when resctrl shuts down completely */ +void rdt_intel_aet_exit(void) +{ + int num_pkgs =3D topology_max_packages(); + + if (pkg_info) { + for (int i =3D 0; i < num_pkgs; i++) + kfree(pkg_info[i].regions); + kfree(pkg_info); + } + + if (feat_energy) + intel_pmt_put_feature_group(feat_energy); + if (feat_perf) + intel_pmt_put_feature_group(feat_perf); +} + /* * Late (first mount) initialization. Safe to ask OOBMSM which telemetry * event groups are supported. --=20 2.48.1 From nobody Mon Feb 9 08:54:32 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 131D52343C9 for ; Fri, 21 Mar 2025 23:16:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598988; cv=none; b=evINGEs9kD9cCVOvufYnHUZFluBECEuzA7+tv6UL6bu2UcOYO5oWdno7Qu071g9CyuuFSIM6HkRGMpWSbsYnUtI/AvVeaimNq2XP28fjLgi+BYtCZJTb9cFCdqxgGSlKxhTTCp4xO++mtRpbq9U0X6WqlCooHCFNCkvu5qXMnUk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598988; c=relaxed/simple; bh=1AOS5NOV/X2OFLA9OJSrKtuSZLspIDShcAFxfbEWq0E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SV8V6HW47m98fT93h7JHphy7mxrg6LD8HjJdizhlX2IYNGI1AcjxtsNeWSKxqJvltNfIQQKBjnTS07Fm8DqoqnT21QKr/DHRT+QCQWYJQYeleEPXiRDJkI9w+SFrQXcU3ZEmct18Y4LW3o2duRkwh8reVREvB68ISKkA8i4F5HI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YyTB7apR; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YyTB7apR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742598987; x=1774134987; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1AOS5NOV/X2OFLA9OJSrKtuSZLspIDShcAFxfbEWq0E=; b=YyTB7apRtzmljvUuUXT2SouaZ87P/crpSFZfcq5HMUGUWw6UM5QU5iMX C+H9uJCRUI8U+XNCRJviDys+7YC99/DtVuugdVZZsZbHtCHo7RyY2Ajnk gYW3TgmA2PI7mKv/5QepEzbrYnwQ5f1NohFr2hw4aziMCrYpH+awNwsI9 nAtQz+fP5Y0VdFZV80ja0F41ave7NZDkx3z7a9mcHBx4a3oYUH5uI/zeV G7Z8kfLp8iPuU2dWRvgaDK4P71MznV6YuwWrr0u9qZU8e8fUWGr6Zz/Px r6nTD65yF/fHp0pKFvSF/q2rQx2uG+ZSmrZaBAgz41oQxcsledPxlhNvT A==; X-CSE-ConnectionGUID: PEI064erQS6N+qo1RMMq5Q== X-CSE-MsgGUID: bMConS2UREaVJyWNdudIWQ== X-IronPort-AV: E=McAfee;i="6700,10204,11380"; a="43604619" X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="43604619" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:23 -0700 X-CSE-ConnectionGUID: 1BZc1KJHQNKJiCDrwZSnGw== X-CSE-MsgGUID: fQ8gWGcQQeCHK72VLxeifQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="128354321" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:23 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v2 11/16] x86/resctrl: Link known events onto RDT_RESOURCE_INTEL_AET.evt_list Date: Fri, 21 Mar 2025 16:16:01 -0700 Message-ID: <20250321231609.57418-12-tony.luck@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250321231609.57418-1-tony.luck@intel.com> References: <20250321231609.57418-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Core code uses this list to populate "mon_data" directories. Signed-off-by: Tony Luck --- arch/x86/kernel/cpu/resctrl/intel_aet.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/= resctrl/intel_aet.c index e2d8eab997fc..9ac912742ef1 100644 --- a/arch/x86/kernel/cpu/resctrl/intel_aet.c +++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c @@ -13,6 +13,7 @@ =20 #include #include +#include #include #include "fake_intel_aet_features.h" #include @@ -308,14 +309,34 @@ void rdt_get_intel_aet_mount(void) { struct rdt_resource *r =3D &rdt_resources_all[RDT_RESOURCE_INTEL_AET].r_r= esctrl; struct rdt_core_mon_domain *d, *tmp; + struct telem_entry **tentry; static int do_one_time; + struct mon_evt *evt; + bool ret =3D false; =20 if (do_one_time) return; =20 do_one_time =3D 1; =20 - if (!get_events()) { + if (!get_events()) + goto done; + + for (tentry =3D telem_entry; *tentry; tentry++) { + if (!(*tentry)->active) + continue; + for (int i =3D 0; (*tentry)->evts[i].evt.name; i++) { + evt =3D &(*tentry)->evts[i].evt; + list_add_tail(&evt->list, &r->evt_list); + ret =3D true; + } + if (!r->num_rmid) + r->num_rmid =3D (*tentry)->num_rmids; + else + r->num_rmid =3D min(r->num_rmid, (*tentry)->num_rmids); + } +done: + if (!ret) { list_for_each_entry_safe(d, tmp, &r->mon_domains, hdr.list) kfree(d); r->mon_capable =3D false; --=20 2.48.1 From nobody Mon Feb 9 08:54:32 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 27197235359 for ; Fri, 21 Mar 2025 23:16:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598989; cv=none; b=cfNzDjwe+32XcGPu0LVbPkj+iVs7hDq4pFjHRbAP+bCEgANkNOqMqCEnJwT6MDPOt9ziNaH4/Did9YUuEzyF9NAtkyXHYPMxEJeEy8qFgfHUAnOd+1reHMZxBPr50Cys493pH17lQFnmaj08diyT1kfZ+3/OP0WnhD/GXyp6lkc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598989; c=relaxed/simple; bh=wNOnSyJUZyVtqGVHCJp5/qbvQ2/t2PXiy9nfB0mLrQE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hXFisfvconLa+GYRV50NwcH8c7jmz+VX1k7JTjHsah9V/bX7bWAApVuzpwc7LhXxFYoFWCcFGDfvujiBcjMgTrhCB+L6PHJs6WJT+ZJ7ZLyIJig0YamfCMVMGKKbABfTkwAO41CE4CeYgI/iAz+BHi6i0QempvghXgIHHet1zzk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=EJVDO9M+; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="EJVDO9M+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742598988; x=1774134988; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wNOnSyJUZyVtqGVHCJp5/qbvQ2/t2PXiy9nfB0mLrQE=; b=EJVDO9M+r9TW+I8P+InLbFDu7xCPm9pw2MK1N5TLnvV7DwoaPw8+VnPP 4oDUYZ+/jo23nZQwCmdAc+PTdF/VNPRiUHYJ5AcAA4c1RYH2UMzJ8rwsM L86pMmG6HdBHvGZa4g+TT2AHli/sh1qc7JPaivPIoUtj3DXt+W49s/HM+ /Puf7zBH2no3rbs8WRoVednJJ9j4AprJsl7i4qAThtyEOJz3RembyqSkm DxoQqD9bFjLR1b/8Ne7oj/+S3szjjn2dfV2dVyVxkhwxagopiw9yu9B88 1r5ERBK4H1hY2KL/+FVJDigsxCboSUBiUCOBI92ux+NGnw8i+L77wdJNg Q==; X-CSE-ConnectionGUID: 1uTu1Sm7TUm8FiiX37VEJw== X-CSE-MsgGUID: PwJQfiBOSxKwDjntgiJZrg== X-IronPort-AV: E=McAfee;i="6700,10204,11380"; a="43604628" X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="43604628" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:24 -0700 X-CSE-ConnectionGUID: BewV8rCOQeuMTEO0qpwK+w== X-CSE-MsgGUID: PUbPB3lBSMSUITyGOuN4CA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="128354324" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:23 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v2 12/16] x86/resctrl: Build lookup table for package events Date: Fri, 21 Mar 2025 16:16:02 -0700 Message-ID: <20250321231609.57418-13-tony.luck@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250321231609.57418-1-tony.luck@intel.com> References: <20250321231609.57418-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The resctrl filesystem saves the evt_type in the private data pointer of the kernfs_node of each file in the mon_data directories. To print the values for each file the show() function will need to map from this evtid to: num_rmids - to make sure data for this file exists guid - to pick the pmt_event(s) for each package stride/offset - to compute MMIO offset for this RMID/event Build a lookup table for each event to save searching through lists and add macros for ease of use. Signed-off-by: Tony Luck --- arch/x86/kernel/cpu/resctrl/intel_aet.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/= resctrl/intel_aet.c index 9ac912742ef1..bab8e4de26b3 100644 --- a/arch/x86/kernel/cpu/resctrl/intel_aet.c +++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c @@ -39,6 +39,18 @@ enum pmt_event_id { PMT_NUM_EVENTS }; =20 +static struct evtinfo { + struct telem_entry *telem_entry; + struct pmt_event *pmt_event; +} evtinfo[PMT_NUM_EVENTS]; + +#define EVT_NUM_RMIDS(evtid) (evtinfo[evtid].telem_entry->num_rmids) +#define EVT_STRIDE(evtid) (evtinfo[evtid].telem_entry->stride) +#define EVT_GUID(evtid) (evtinfo[evtid].telem_entry->guid) + +#define EVT_OFFSET(evtid) (evtinfo[evtid].pmt_event->evt_offset) +#define EVT_TYPE(evtid) (evtinfo[evtid].pmt_event->evt_type) + /** * enum evt_type - Type for values for each event. * @EVT_U64: Integer up to 64 bits @@ -328,6 +340,9 @@ void rdt_get_intel_aet_mount(void) for (int i =3D 0; (*tentry)->evts[i].evt.name; i++) { evt =3D &(*tentry)->evts[i].evt; list_add_tail(&evt->list, &r->evt_list); + + evtinfo[evt->evtid].telem_entry =3D *tentry; + evtinfo[evt->evtid].pmt_event =3D &(*tentry)->evts[i]; ret =3D true; } if (!r->num_rmid) --=20 2.48.1 From nobody Mon Feb 9 08:54:32 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9644B235377 for ; Fri, 21 Mar 2025 23:16:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598990; cv=none; b=j1ihALqMYeHlf2FPZCP7bG/EINnHJcUsjKxbCIXoyIV0/aM15+LnlTbZb0t0irdTfLdEHN6U/H/VcaFEp/nFTEiinNX8zMo7IxjnNWNGt7+HpyQlAXmEFlDD6zAm9dXCKkx35zLTK9ubxGNvtuBF88WC0CYgMLcMmNCJNHQp/qk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598990; c=relaxed/simple; bh=BR6sWBYhLeThHSd8a037VGUJ8PncGE9yf9kQ19l3VcM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Sp90ZFFlXVcKi47BHTKULazpoLJv9MTx2BISVv6OjsK6pUdNDD1d7m7Ck41fsPGdBpm/pI0klN0Z9OtL+H8nBmucxlPUW5MG1RWcJQmc7La9tc2Zg1enJBLb2aswquWdMh+YblLicktLCDGBE3+MQax3uGC3iFgV2q9wzRk6kkw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=AUzNKA5S; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AUzNKA5S" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742598989; x=1774134989; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BR6sWBYhLeThHSd8a037VGUJ8PncGE9yf9kQ19l3VcM=; b=AUzNKA5S9N0YH3SwHnWPMVCtGj3G5QM6mUOIFrr6G0csGUZOFcgeHXIC AcWp4RGowRdDz8ws0ePNQsCj2EZsIntYcLuuR1dXtWYtp4wO2t5Ox9sKN 1ozgPb1QqRBTPXOYTnXPQ+lgP7lPRDW8F8iY8U5P9b1TBQxHOtSYBSre5 YMFPAnzOtDBiXcScnkfMHmon//FXvhGniP1q1U2qPxiTQUUG5/AA8WZDX PqMS8kvEEQc+SVZrz3MYqVTfcmeD6zI2hHIRVSEJMc37/5Ntmpf7uT/+/ E7PAG+cCbSecRCKCNDcnDq7KLyI2rppI5MF0v69MvKrqFeWkWYKa5SvPc Q==; X-CSE-ConnectionGUID: cA8JFWbgQuCqf5PN75xRug== X-CSE-MsgGUID: fRd7Wh4rRyiqY3X+x+wRXg== X-IronPort-AV: E=McAfee;i="6700,10204,11380"; a="43604633" X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="43604633" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:24 -0700 X-CSE-ConnectionGUID: rThT7eakTeGuDAPmGIyFIA== X-CSE-MsgGUID: qtszo6s7SHqERPEChTqo0g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="128354327" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:24 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v2 13/16] x86/resctrl: Add code to display core telemetry events Date: Fri, 21 Mar 2025 16:16:03 -0700 Message-ID: <20250321231609.57418-14-tony.luck@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250321231609.57418-1-tony.luck@intel.com> References: <20250321231609.57418-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" These can be read from any CPU. Rely on the smp_call*() functions picking the current CPU when given a free choice from cpu_online_mask. There may be multiple devices tracking each package, so scan all of them and add up counters. Output format depends on the data type. Either a 63 bit integer, or a fixed point decimal. Signed-off-by: Tony Luck --- include/linux/resctrl.h | 3 ++ fs/resctrl/internal.h | 4 +- arch/x86/kernel/cpu/resctrl/intel_aet.c | 53 +++++++++++++++++++++++++ fs/resctrl/ctrlmondata.c | 23 ++++++++++- fs/resctrl/monitor.c | 23 +++++++++-- 5 files changed, 100 insertions(+), 6 deletions(-) diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 999e0802a26e..e900764393f4 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -532,8 +532,11 @@ void resctrl_exit(void); =20 #ifdef CONFIG_INTEL_AET_RESCTRL void rdt_get_intel_aet_mount(void); +bool intel_aet_read_event(int domid, int rmid, int evtid, u64 *val, bool *= fptype); #else static inline void rdt_get_intel_aet_mount(void) { } +static inline bool intel_aet_read_event(int domid, int rmid, int evtid, u6= 4 *val, + bool *fptype) { return false; } #endif =20 #endif /* _RESCTRL_H */ diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h index f5a698b49e97..4d65a781034e 100644 --- a/fs/resctrl/internal.h +++ b/fs/resctrl/internal.h @@ -98,6 +98,7 @@ struct mon_data { * domains in @r sharing L3 @ci.id * @evtid: Which monitor event to read. * @first: Initialize MBM counter when true. + * @fptype:If true indicates @val is in 46.18 fixed point format * @ci: Cacheinfo for L3. Only set when @d is NULL. Used when summing d= omains. * @err: Error encountered when reading counter. * @val: Returned value of event counter. If @rgrp is a parent resource = group, @@ -112,6 +113,7 @@ struct rmid_read { struct rdt_mon_domain *d; unsigned int evtid; bool first; + bool fptype; struct cacheinfo *ci; int err; u64 val; @@ -343,7 +345,7 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg= ); =20 void mon_event_read(struct rmid_read *rr, struct rdt_resource *r, struct rdt_mon_domain *d, struct rdtgroup *rdtgrp, - cpumask_t *cpumask, int evtid, int first); + const cpumask_t *cpumask, int evtid, int first); =20 int resctrl_mon_resource_init(void); =20 diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/= resctrl/intel_aet.c index bab8e4de26b3..41ebb2ee9b41 100644 --- a/arch/x86/kernel/cpu/resctrl/intel_aet.c +++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c @@ -357,3 +357,56 @@ void rdt_get_intel_aet_mount(void) r->mon_capable =3D false; } } + +#define VALID_BIT BIT_ULL(63) +#define DATA_BITS GENMASK_ULL(62, 0) + +/* + * Walk the array of telemetry groups on a specific package. + * Read and sum values for a specific counter (described by + * guid and offset). + * Return failure (~0x0ull) if any counter isn't valid. + */ +static u64 scan_pmt_devs(int package, int guid, int offset) +{ + u64 rval, val; + int ndev =3D 0; + + rval =3D 0; + + for (int i =3D 0; i < pkg_info[package].count; i++) { + if (pkg_info[package].regions[i].guid !=3D guid) + continue; + ndev++; + val =3D readq(pkg_info[package].regions[i].addr + offset); + + if (!(val & VALID_BIT)) + return ~0ull; + rval +=3D val & DATA_BITS; + } + + return ndev ? rval : ~0ull; +} + +/* + * Read counter for an event on a domain (summing all aggregators + * on the domain). + */ +bool intel_aet_read_event(int domid, int rmid, int evtid, u64 *val, bool *= fptype) +{ + u64 evtcount; + int offset; + + if (rmid >=3D EVT_NUM_RMIDS(evtid)) + return false; + + offset =3D rmid * EVT_STRIDE(evtid); + offset +=3D EVT_OFFSET(evtid); + evtcount =3D scan_pmt_devs(domid, EVT_GUID(evtid), offset); + *fptype =3D evtid =3D=3D PMT_EVENT_ENERGY || evtid =3D=3D PMT_EVENT_ACTIV= ITY; + + if (evtcount !=3D ~0ull || *val =3D=3D 0) + *val +=3D evtcount; + + return evtcount !=3D ~0ull; +} diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c index d56b78450a99..5612f5f64574 100644 --- a/fs/resctrl/ctrlmondata.c +++ b/fs/resctrl/ctrlmondata.c @@ -548,7 +548,7 @@ struct rdt_domain_hdr *resctrl_find_domain(struct list_= head *h, int id, =20 void mon_event_read(struct rmid_read *rr, struct rdt_resource *r, struct rdt_mon_domain *d, struct rdtgroup *rdtgrp, - cpumask_t *cpumask, int evtid, int first) + const cpumask_t *cpumask, int evtid, int first) { int cpu; =20 @@ -585,6 +585,21 @@ void mon_event_read(struct rmid_read *rr, struct rdt_r= esource *r, resctrl_arch_mon_ctx_free(r, evtid, rr->arch_mon_ctx); } =20 +#define NUM_FRAC_BITS 18 +#define FRAC_MASK GENMASK(NUM_FRAC_BITS - 1, 0) + +static void show_fp_value(struct seq_file *m, u64 val) +{ + u64 frac; + + frac =3D val & FRAC_MASK; + frac =3D frac * 1000000; + frac +=3D 1ul << (NUM_FRAC_BITS - 1); + frac >>=3D NUM_FRAC_BITS; + + seq_printf(m, "%llu.%06llu\n", val >> NUM_FRAC_BITS, frac); +} + int rdtgroup_mondata_show(struct seq_file *m, void *arg) { struct kernfs_open_file *of =3D m->private; @@ -594,6 +609,7 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg) u32 resid, evtid, domid; struct rdtgroup *rdtgrp; struct rdt_resource *r; + const cpumask_t *mask; struct mon_data *md; int ret =3D 0; =20 @@ -642,7 +658,8 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg) goto out; } d =3D container_of(hdr, struct rdt_mon_domain, hdr); - mon_event_read(&rr, r, d, rdtgrp, &d->hdr.cpu_mask, evtid, false); + mask =3D (resid =3D=3D RDT_RESOURCE_L3) ? &d->hdr.cpu_mask : cpu_online_= mask; + mon_event_read(&rr, r, d, rdtgrp, mask, evtid, false); } =20 checkresult: @@ -651,6 +668,8 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg) seq_puts(m, "Error\n"); else if (rr.err =3D=3D -EINVAL) seq_puts(m, "Unavailable\n"); + else if (rr.fptype) + show_fp_value(m, rr.val); else seq_printf(m, "%llu\n", rr.val); =20 diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index 3fe21dcf0fde..f4049ae5344c 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -447,6 +447,24 @@ static void mbm_bw_count(u32 closid, u32 rmid, struct = rmid_read *rr) m->prev_bw =3D cur_bw; } =20 +static int mon_event_count_one_group(int closid, int rmid, struct rmid_rea= d *rr) +{ + bool ret; + + switch (rr->r->rid) { + case RDT_RESOURCE_L3: + rr->fptype =3D false; + return __mon_event_count(closid, rmid, rr); + case RDT_RESOURCE_INTEL_AET: + ret =3D intel_aet_read_event(rr->d->hdr.id, rmid, rr->evtid, &rr->val, &= rr->fptype); + if (!ret) + rr->err =3D -EINVAL; + return ret ? 0 : -EINVAL; + } + + return -EINVAL; +} + /* * This is scheduled by mon_event_read() to read the CQM/MBM counters * on a domain. @@ -460,7 +478,7 @@ void mon_event_count(void *info) =20 rdtgrp =3D rr->rgrp; =20 - ret =3D __mon_event_count(rdtgrp->closid, rdtgrp->mon.rmid, rr); + ret =3D mon_event_count_one_group(rdtgrp->closid, rdtgrp->mon.rmid, rr); =20 /* * For Ctrl groups read data from child monitor groups and @@ -471,8 +489,7 @@ void mon_event_count(void *info) =20 if (rdtgrp->type =3D=3D RDTCTRL_GROUP) { list_for_each_entry(entry, head, mon.crdtgrp_list) { - if (__mon_event_count(entry->closid, entry->mon.rmid, - rr) =3D=3D 0) + if (mon_event_count_one_group(entry->closid, entry->mon.rmid, rr) =3D= =3D 0) ret =3D 0; } } --=20 2.48.1 From nobody Mon Feb 9 08:54:32 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC33B2356AC for ; Fri, 21 Mar 2025 23:16:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598990; cv=none; b=BmEr3YbWdbYqrWWA7s7zH5PxOmj4Je5eVvozekADxvYFgEi2m7uS1ItoS0gsL6D8CqWwGpHYxmE9rChAIOmiqbB2ll9m9TwutmRreKI04ICzf/XFC+65IMhL9swy02hrOWbDwNMHzljIu7szaxDSlHiAt1ElMjGzO8Z8BI3EuIk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598990; c=relaxed/simple; bh=Mzo6MdUnv8b60jJzdi+ZYeWJ8nm5Tp+qficcWDvNvL0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fEN5Yd8ZYppfwR9akGOq/Y1m9tY1kquuNB/uMWFHbLDuQbSyPp0K4UUmRfN/vgwlA45Hc+ICeKxPv5XWnzzhm5ZJv1ps7AF90Le2pGLAIbjwj5vrowZB7QOzyVQw7ATXKZBj3SK+hmYAAgwUL3PByRUis8/NXLElLEeRYkg/tCw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=f4FavWR8; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="f4FavWR8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742598989; x=1774134989; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Mzo6MdUnv8b60jJzdi+ZYeWJ8nm5Tp+qficcWDvNvL0=; b=f4FavWR8ssbJ861wCefJysyc5v3XO2ykixYDtru2U9EEk88IXRwAiIbY twXtp5AfJbtFS3tzjN3y7soDDyq6VQ0y9pbCjUxD1PQvANSr7UOsPEumk 8+9yiCE48ZQjdtmXKQUhkXL6NXG5ouuy4K6cbyerI7RGyPumhFyHeufY5 Lej543O30JWulLTrv9huMGOVOI3ZDrkCyXEopcrzIwD3CrLFZ9R1f0wAb 2ll5eTSdZD4vWDJkLgioEz5SgPDMOcPLcddP5whPug7Qlv2WBoUB9c1Ec ZQ+0iZL/3LxKwtBCgsKck5G0W6b/huAc5uUmk2stHO6EwClttDhPfKhQZ w==; X-CSE-ConnectionGUID: p6nzNofXTFuOTDTStagB2g== X-CSE-MsgGUID: 7vZtz1zNQ/G0D0WvMMYu/A== X-IronPort-AV: E=McAfee;i="6700,10204,11380"; a="43604640" X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="43604640" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:25 -0700 X-CSE-ConnectionGUID: yh6M/CxPRSWOEGfBCFBvgw== X-CSE-MsgGUID: OLWiC+aVRXiIAatVxca0NQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="128354333" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:24 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v2 14/16] x86/resctrl: Add status files to info/PKG_MON Date: Fri, 21 Mar 2025 16:16:04 -0700 Message-ID: <20250321231609.57418-15-tony.luck@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250321231609.57418-1-tony.luck@intel.com> References: <20250321231609.57418-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Each of the package event groups includes status about the number of missed events and timestamps (from a 25 MHz clock) on last time an update was missed and last time an update was processed. Add a three info files to report per-aggregator values of these status values. Signed-off-by: Tony Luck --- include/linux/resctrl.h | 12 ++++ fs/resctrl/internal.h | 2 + arch/x86/kernel/cpu/resctrl/intel_aet.c | 90 ++++++++++++++++++++++--- fs/resctrl/rdtgroup.c | 21 ++++++ 4 files changed, 117 insertions(+), 8 deletions(-) diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index e900764393f4..9f6a0b26eec3 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -533,10 +533,22 @@ void resctrl_exit(void); #ifdef CONFIG_INTEL_AET_RESCTRL void rdt_get_intel_aet_mount(void); bool intel_aet_read_event(int domid, int rmid, int evtid, u64 *val, bool *= fptype); +int rdtgroup_last_update_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v); +int rdtgroup_overflows_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v); +int rdtgroup_overflow_timestamp_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v); #else static inline void rdt_get_intel_aet_mount(void) { } static inline bool intel_aet_read_event(int domid, int rmid, int evtid, u6= 4 *val, bool *fptype) { return false; } +static inline int rdtgroup_last_update_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) { return 0; }; +static inline int rdtgroup_overflows_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) { return 0; }; +static inline int rdtgroup_overflow_timestamp_show(struct kernfs_open_file= *of, + struct seq_file *seq, void *v) { return 0; }; #endif =20 #endif /* _RESCTRL_H */ diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h index 4d65a781034e..53590b1fa8c3 100644 --- a/fs/resctrl/internal.h +++ b/fs/resctrl/internal.h @@ -236,6 +236,8 @@ struct rdtgroup { =20 #define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) =20 +#define RFTYPE_PKG_INFO (RFTYPE_INFO | RFTYPE_RES_PKG) + #define RFTYPE_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) =20 #define RFTYPE_MON_BASE (RFTYPE_BASE | RFTYPE_MON) diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/= resctrl/intel_aet.c index 41ebb2ee9b41..28692c6ec425 100644 --- a/arch/x86/kernel/cpu/resctrl/intel_aet.c +++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c @@ -358,6 +358,11 @@ void rdt_get_intel_aet_mount(void) } } =20 +enum ops { + DO_SUM_EVENT, + DO_PRINTVALS +}; + #define VALID_BIT BIT_ULL(63) #define DATA_BITS GENMASK_ULL(62, 0) =20 @@ -367,22 +372,29 @@ void rdt_get_intel_aet_mount(void) * guid and offset). * Return failure (~0x0ull) if any counter isn't valid. */ -static u64 scan_pmt_devs(int package, int guid, int offset) +static u64 scan_pmt_devs(struct seq_file *m, int package, int guid, int of= fset, enum ops op) { - u64 rval, val; + u64 rval =3D 0, val; + char *sep =3D ""; int ndev =3D 0; =20 - rval =3D 0; - for (int i =3D 0; i < pkg_info[package].count; i++) { if (pkg_info[package].regions[i].guid !=3D guid) continue; ndev++; val =3D readq(pkg_info[package].regions[i].addr + offset); =20 - if (!(val & VALID_BIT)) - return ~0ull; - rval +=3D val & DATA_BITS; + switch (op) { + case DO_SUM_EVENT: + if (!(val & VALID_BIT)) + return ~0ull; + rval +=3D val & DATA_BITS; + break; + case DO_PRINTVALS: + seq_printf(m, "%s0x%llx", sep, val); + sep =3D ","; + break; + } } =20 return ndev ? rval : ~0ull; @@ -402,7 +414,7 @@ bool intel_aet_read_event(int domid, int rmid, int evti= d, u64 *val, bool *fptype =20 offset =3D rmid * EVT_STRIDE(evtid); offset +=3D EVT_OFFSET(evtid); - evtcount =3D scan_pmt_devs(domid, EVT_GUID(evtid), offset); + evtcount =3D scan_pmt_devs(NULL, domid, EVT_GUID(evtid), offset, DO_SUM_E= VENT); *fptype =3D evtid =3D=3D PMT_EVENT_ENERGY || evtid =3D=3D PMT_EVENT_ACTIV= ITY; =20 if (evtcount !=3D ~0ull || *val =3D=3D 0) @@ -410,3 +422,65 @@ bool intel_aet_read_event(int domid, int rmid, int evt= id, u64 *val, bool *fptype =20 return evtcount !=3D ~0ull; } + +static void status_show(struct seq_file *seq, char *name, int guid, int of= fset) +{ + struct rdt_resource *r =3D &rdt_resources_all[RDT_RESOURCE_INTEL_AET].r_r= esctrl; + struct rdt_mon_domain *d; + char *sep =3D ""; + + seq_printf(seq, "%s: ", name); + + cpus_read_lock(); + list_for_each_entry(d, &r->mon_domains, hdr.list) { + seq_printf(seq, "%s%d=3D[", sep, d->hdr.id); + scan_pmt_devs(seq, d->hdr.id, guid, offset, DO_PRINTVALS); + seq_puts(seq, "]"); + sep =3D ";"; + } + cpus_read_unlock(); + + seq_puts(seq, "\n"); +} + +int rdtgroup_last_update_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) +{ + struct telem_entry **t; + + for (t =3D telem_entry; *t; t++) { + if (!(*t)->active) + continue; + status_show(seq, (*t)->name, (*t)->guid, (*t)->last_update_tstamp_off); + } + + return 0; +} + +int rdtgroup_overflows_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) +{ + struct telem_entry **t; + + for (t =3D telem_entry; *t; t++) { + if (!(*t)->active) + continue; + status_show(seq, (*t)->name, (*t)->guid, (*t)->overflow_counter_off); + } + + return 0; +} + +int rdtgroup_overflow_timestamp_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) +{ + struct telem_entry **t; + + for (t =3D telem_entry; *t; t++) { + if (!(*t)->active) + continue; + status_show(seq, (*t)->name, (*t)->guid, (*t)->last_overflow_tstamp_off); + } + + return 0; +} diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index d3919642aa9b..9021c60fd05b 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -1971,6 +1971,27 @@ static struct rftype res_common_files[] =3D { .seq_show =3D rdtgroup_closid_show, .fflags =3D RFTYPE_CTRL_BASE | RFTYPE_DEBUG, }, + { + .name =3D "last_update", + .mode =3D 0444, + .kf_ops =3D &rdtgroup_kf_single_ops, + .seq_show =3D rdtgroup_last_update_show, + .fflags =3D RFTYPE_PKG_INFO, + }, + { + .name =3D "overflows", + .mode =3D 0444, + .kf_ops =3D &rdtgroup_kf_single_ops, + .seq_show =3D rdtgroup_overflows_show, + .fflags =3D RFTYPE_PKG_INFO, + }, + { + .name =3D "overflow_timestamp", + .mode =3D 0444, + .kf_ops =3D &rdtgroup_kf_single_ops, + .seq_show =3D rdtgroup_overflow_timestamp_show, + .fflags =3D RFTYPE_PKG_INFO, + }, }; =20 static int rdtgroup_add_files(struct kernfs_node *kn, unsigned long fflags) --=20 2.48.1 From nobody Mon Feb 9 08:54:32 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00E09236429 for ; Fri, 21 Mar 2025 23:16:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598991; cv=none; b=qEBunqaBogSsdTTOvAj+DNlm3K2z7mvyaiQ3dIG4Y+9aAfVvYsmL9nJ1QpVjwvCNDPn2OmPVP7xh7wCFnIMp5065KRqAGNVWrBG5mb3FoDHN/UMh4AS1dtsV5hMG5dkwVVw/q2e9nJfF6XLmO68iO3P7TPTnEMZMYuc9ktz1vYs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598991; c=relaxed/simple; bh=iQ4XRfxumCrPk7mdvf5ER8BlfKFGvFPe6nhxNpLfbL4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZSLH1d7sO2SX97iHSCXiBpNR6TxtiSwJmojtKgJ73YQQxeayLEZ1BJ2jAMQ7XQ1GN4oeZOKP4xV7DxqqIJ//CNcmdWHq8c/YSHIcfXiDKirqMN6XQAGY1zGmVhyWIV4kuipnQSebxa+8nbdpewInhozyAbctOgIZxXFk8Yh4z8Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=hmUkkChe; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hmUkkChe" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742598990; x=1774134990; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iQ4XRfxumCrPk7mdvf5ER8BlfKFGvFPe6nhxNpLfbL4=; b=hmUkkChe9B/o/Cw8DoG9TdLKggW0hOvM3SU0pFBQiHRlBJZ0jc3SMpkE KzmhhHg2Sghi8ycExiHeNdmf38F8NzN6t2YTLlLjYl1Pn9bjCbnZQEZNS OIpsOfM7c96c3v24not/Uh22pWcvl3KOUKt3DWDbq+W1JX6Gq8uWd4Tng 91meLFxaGzFtIWrAg7fK7A7vPFsEB0yQn8JVkHz8ICTuyW0vsSmC73T9q mmjRFVRqk7hN3kqEg1Wpu8JBxNcXgtpOi0T2ef4aEdLh61zyZ4i+HXbfu kJoZLrsPtEGQ/ryzOAe/7KywwyOLorRunCvDUsQlGWoo7bvR7jmY2wGZA A==; X-CSE-ConnectionGUID: kkIN8noIQw6oNB2a+mehkg== X-CSE-MsgGUID: qrg5efFwRMeg3urpgCsBOg== X-IronPort-AV: E=McAfee;i="6700,10204,11380"; a="43604648" X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="43604648" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:25 -0700 X-CSE-ConnectionGUID: BrTXd7TkSlSdWQOmQPpMvQ== X-CSE-MsgGUID: qg9vHMitRYO1/cE0Bsq3Rw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="128354336" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:25 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v2 15/16] x86/resctrl: Enable package event monitoring Date: Fri, 21 Mar 2025 16:16:05 -0700 Message-ID: <20250321231609.57418-16-tony.luck@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250321231609.57418-1-tony.luck@intel.com> References: <20250321231609.57418-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" All the code to support this is in place. Unconditionally enable the package resource during early initialization so that domain lists are built. Enumeration of the package events happens at first mount, if there are no package scoped events, then this resource is disabled. Signed-off-by: Tony Luck --- arch/x86/kernel/cpu/resctrl/intel_aet.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/= resctrl/intel_aet.c index 28692c6ec425..593e838fe5b6 100644 --- a/arch/x86/kernel/cpu/resctrl/intel_aet.c +++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c @@ -293,6 +293,8 @@ int rdt_get_intel_aet_mon_config(void) =20 INIT_LIST_HEAD(&r->evt_list); =20 + r->mon_capable =3D true; + return 1; } =20 --=20 2.48.1 From nobody Mon Feb 9 08:54:32 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AADEB236A62 for ; Fri, 21 Mar 2025 23:16:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598992; cv=none; b=YKyJihK0SrFbaooY3NXRP68KZJmB+4L3cU8UllONxJKIjlw+kxcjIuZLVVmx0w9Q+lBIVlL6mrGGx++kWq0xtnzXL6/L1mEHr2Ltz/R7yMqurR0rkP3sbhfruBwfVfLwuAMh6Kp7WWhef6vTi14Rqf0HdLS1R6L2ad16+FrXWBg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742598992; c=relaxed/simple; bh=zyJSs4pgybNOmlhgq1YSJUekw4r0a/e87UbI4q1QkN0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c3pCy0gB7YGBUWtes01sE8iAw3rMKZFGrnRpw+UuCYNMCSIBD+g16jCbbOuD+Gurjz2BW404GT6g/rd/irB2U22hlnpN9PycZWOZQgM/vbrYF29aP0ZaiQ47Uy61owJv/I9Z9gor7g7tXVxrMPbw/amREoF0CJZPQBiHxBvDOzA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=MmErGH10; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MmErGH10" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742598991; x=1774134991; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zyJSs4pgybNOmlhgq1YSJUekw4r0a/e87UbI4q1QkN0=; b=MmErGH10jd6LzhEepSWq6roQL7HFYH0hkFTM2/5m4qa40Q8c+5/6jOb3 An32oJ4gIBaDz5okbDImPWWvtbDqKz5oUnXE/V/4i2Xb+nzIsJqvFEu7/ bTT6Du86n57eVkWGJazxf/ZA/HJ2fELDFxIpdMLqsTUSjpkaI8dV4JKSs uSz3abPOT1FjJjbgXnhe+uWBNzyOFqxUh0zJrbfNRlhxVWDKsErHJWRjx qJ58LRI1JjC3ZBCyUXIgRW6r0xgno3br0EHBtqeBzOv86YDJ89mtfWY4L prtVdWuSDzMK301dOLd7+fw6wVxX67+YReEghK7fiMXmek/zxq7H0BEq/ Q==; X-CSE-ConnectionGUID: OYhPaVuMTu6SXrxUJsLeOw== X-CSE-MsgGUID: +nIcPXc+QOmpTHveZ/ld5A== X-IronPort-AV: E=McAfee;i="6700,10204,11380"; a="43604655" X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="43604655" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:25 -0700 X-CSE-ConnectionGUID: U3x594cXR1uLlU/ztr53uQ== X-CSE-MsgGUID: I6ii42T0QG6dLYNPLYYv6g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,266,1736841600"; d="scan'208";a="128354340" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2025 16:16:25 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v2 16/16] x86/resctrl: Update Documentation for package events Date: Fri, 21 Mar 2025 16:16:06 -0700 Message-ID: <20250321231609.57418-17-tony.luck@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250321231609.57418-1-tony.luck@intel.com> References: <20250321231609.57418-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Each "mon_data" directory is now divided between L3 events and package events. Signed-off-by: Tony Luck --- Documentation/filesystems/resctrl.rst | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesyst= ems/resctrl.rst index 6768fc1fad16..0e915b7c55aa 100644 --- a/Documentation/filesystems/resctrl.rst +++ b/Documentation/filesystems/resctrl.rst @@ -366,15 +366,22 @@ When control is enabled all CTRL_MON groups will also= contain: When monitoring is enabled all MON groups will also contain: =20 "mon_data": - This contains a set of files organized by L3 domain and by - RDT event. E.g. on a system with two L3 domains there will - be subdirectories "mon_L3_00" and "mon_L3_01". Each of these - directories have one file per event (e.g. "llc_occupancy", - "mbm_total_bytes", and "mbm_local_bytes"). In a MON group these - files provide a read out of the current value of the event for - all tasks in the group. In CTRL_MON groups these files provide - the sum for all tasks in the CTRL_MON group and all tasks in - MON groups. Please see example section for more details on usage. + This contains a set of directories, one for each instance + of an L3 cache, or of a processor package. The L3 cache + directories are named "mon_L3_00", "mon_L3_01" etc. The + package directories "mon_PKG_00", "mon_PKG_01" etc. + + Within each directory there is one file per event. In + the L3 directories: "llc_occupancy", "mbm_total_bytes", + and "mbm_local_bytes". In the PKG directories: "core_energy", + "activity", etc. + + In a MON group these files provide a read out of the current + value of the event for all tasks in the group. In CTRL_MON groups + these files provide the sum for all tasks in the CTRL_MON group + and all tasks in MON groups. Please see example section for more + details on usage. + On systems with Sub-NUMA Cluster (SNC) enabled there are extra directories for each node (located within the "mon_L3_XX" directory for the L3 cache they occupy). These are named "mon_sub_L3_YY" --=20 2.48.1