From nobody Tue Jun 16 19:33:08 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 4FA71410D02 for ; Wed, 29 Apr 2026 18:49:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488552; cv=none; b=OPBgehL3iekeq4PPs55uQJzFhv+MB4XhmACkCqvGkw++ovG+px/aASbwwspCMn12bRF9NZhDhQd6BgQenAKzLPUGAmgbLI8ajAXXaU4k1D+OJzJzI3oMWuIxOwn4mdQpLlbKUQVi4vBWuve7ZHcuZNGkgz5UViYyUYGtSa3mhng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488552; c=relaxed/simple; bh=TpqgBuTQel4V5/BGOHX3wAgyHeUcGtOmEJQ2AKSmzOg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TVvdUxdtoHRtdoxjfu7F3mh3M/B2K98+/0iAOzLHqqI7zrXmmzAtWuDA3U2D1w37cYrKoxs+MZUGUBIGAzRH+a/J+2vVD5D2Qde252uPZlq2Kgird1KEvwWeOWWR78QOCjRKjELjYW53icDR9FmLCOJcrugfpj1dQbcE9tcntPA= 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/Pc/AoN; arc=none smtp.client-ip=198.175.65.12 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/Pc/AoN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1777488549; x=1809024549; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TpqgBuTQel4V5/BGOHX3wAgyHeUcGtOmEJQ2AKSmzOg=; b=d/Pc/AoNZ/M4ha+fFeOjAOIBrvoExSd9WH+qTAZK+9T8YgqqKHm8VM5m 05to91Lzk9d0cQwyXRxi5XjKFN4W43AYqSbmyv6lmMuJeaLVEvHMUzo/x Ikx1u1iBRR5MYaMnw15hlKzEgi8VYetDNWWTVCla6n2cgvKlyKb4nfoFp +HkTiRdPJlDSYxjvc9iXjv0vP/08Nc44KgxKGZLhK3NC10yzP6xtPRjVR Wcm8R/seV/St8jjqyErNcgDu99CAJRJevDKcGSnKhg/Lyux1Ga+z4n2Ax G+MMV9foAdEhqcjzy/e2pcTG0R2ROkgnPGOWbJtmUm8fOrig2fgccH/Bj w==; X-CSE-ConnectionGUID: VMo/NNdfQAWFKNq9VGcF5g== X-CSE-MsgGUID: /lb0NnuERFyGyCjn8vzI9A== X-IronPort-AV: E=McAfee;i="6800,10657,11771"; a="89890678" X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="89890678" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:05 -0700 X-CSE-ConnectionGUID: YBURRahzS6aVzIiPMXyLSA== X-CSE-MsgGUID: CNEj4rkASy6J7jcBPE/V0w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="238322987" Received: from mjruhl-desk.amr.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.222.13]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:05 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu , David E Box , x86@kernel.org Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v6 01/10] x86/resctrl: Stop setting event_group::force_off on RMID shortage Date: Wed, 29 Apr 2026 11:48:49 -0700 Message-ID: <20260429184858.36423-2-tony.luck@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260429184858.36423-1-tony.luck@intel.com> References: <20260429184858.36423-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" Drop the force_off assignment from all_regions_have_sufficient_rmid(). This preserves current single-enumeration behaviour while preparing for the upcoming per-mount enumeration, where latching force_off would incorrectly suppress re-enumeration on subsequent mounts - even when the user explicitly requested the feature via "rdt=3D{feature}". Signed-off-by: Tony Luck --- arch/x86/kernel/cpu/resctrl/intel_aet.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/= resctrl/intel_aet.c index 89b8b619d5d5..e2af700bca04 100644 --- a/arch/x86/kernel/cpu/resctrl/intel_aet.c +++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c @@ -60,8 +60,8 @@ struct pmt_event { * data for all telemetry regions of type @pfname. * Valid if the system supports the event group, * NULL otherwise. - * @force_off: True when "rdt" command line or architecture code disables - * this event group due to insufficient RMIDs. + * @force_off: True when "rdt" command line disables this event group + * to avoid system limitations due to insufficient RMIDs. * @force_on: True when "rdt" command line overrides disable of this * event group. * @guid: Unique number per XML description file. @@ -214,10 +214,8 @@ static bool all_regions_have_sufficient_rmid(struct ev= ent_group *e, struct pmt_f if (!p->regions[i].addr) continue; tr =3D &p->regions[i]; - if (tr->num_rmids < e->num_rmid) { - e->force_off =3D true; + if (tr->num_rmids < e->num_rmid) return false; - } } =20 return true; --=20 2.53.0 From nobody Tue Jun 16 19:33:08 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 B7F6138BF8D for ; Wed, 29 Apr 2026 18:49:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488556; cv=none; b=XXFIXkchxUrtD/KgU+UySSIEYae56PHZtWvCOZyXO0oIgrajh1gBhFjzkxQqmJclIhoNh9usAGrIrORNJJjYIoV1JkJYABXSMCacw2qTsQrGnBRQ493Xmd0gtc+1b5qVOPwiAyFjE+tS7HCWp+x/M1ghb/bdbtGlsZNYrcKcjZA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488556; c=relaxed/simple; bh=OKR49uNzcVCyA09/b1ukfX+a3193DZbc/IP6myFdMQo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sZGAKMZ11I3nNsz7ssXux8rT5G4l2iQxpZqVll9fR+eJAVJyShc6zuPuKJpxqNE4moXaqB0ccnyfvNcLXQ7+uHTpNmWAhtLI7pBtXV5X/c0+O5trAzKeGLi3y18qqSiZ2X0cakYeyeqEE2kH51diSladJnp8cXiQOZSZmQm8g+k= 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=H39Gyp+9; arc=none smtp.client-ip=198.175.65.12 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="H39Gyp+9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1777488551; x=1809024551; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OKR49uNzcVCyA09/b1ukfX+a3193DZbc/IP6myFdMQo=; b=H39Gyp+9jOUYReEjo8B4DEXNRcXGj914VJnbkBbn75KHy+1dOZ4tzrGb pNzkluCUbjCZFn8rhDMl02deHRoZYqCFFXfiPYPd0nsVsYWz0gO0Wi5kL xPi0h2PxP2IOR6/TC3vgskuCyk0OU3vEdhnQNeEVO8VN0YY7snM/UF7R0 +24aEN7E8qfujtq0t8C/IzF9Lt0jnM58syOEESRvmqq27actuc25FSDf1 aS49Npcl7wce2sGgB/o5GK3FriIA/FPlpzZBDZUqgkdZ3eFiv/HG5yq6U xbEvZAi/RuA11W/6vfGMaWz+ElaeaHhMnU8mN9ZHW1ALpvWH3tYz0p5W+ g==; X-CSE-ConnectionGUID: pbTkhDsYTguF/LcPrRB6MQ== X-CSE-MsgGUID: TWEDx4pYR22ZTEPxJLOA4Q== X-IronPort-AV: E=McAfee;i="6800,10657,11771"; a="89890690" X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="89890690" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:06 -0700 X-CSE-ConnectionGUID: c2FIExSHSdm3bkK7QJNqEA== X-CSE-MsgGUID: UZiSWIb8R1SMAfyPlEqYkQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="238322992" Received: from mjruhl-desk.amr.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.222.13]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:06 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu , David E Box , x86@kernel.org Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v6 02/10] fs/resctrl: Add interface to disable a monitor event Date: Wed, 29 Apr 2026 11:48:50 -0700 Message-ID: <20260429184858.36423-3-tony.luck@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260429184858.36423-1-tony.luck@intel.com> References: <20260429184858.36423-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" In preparation for re-running AET enumeration on every mount, AET code must= be able to disable events on unmount so the next mount starts from a clean sla= te. Add a file system interface for architecture to clear the enabled flag for a given event. Add kerneldoc comments to describe limitations on when events may be enabled or disabled. Signed-off-by: Tony Luck --- include/linux/resctrl.h | 34 ++++++++++++++++++++++++++++++++++ fs/resctrl/monitor.c | 12 ++++++++++++ 2 files changed, 46 insertions(+) diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 006e57fd7ca5..a8338656f836 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -414,9 +414,43 @@ u32 resctrl_arch_get_num_closid(struct rdt_resource *r= ); u32 resctrl_arch_system_num_rmid_idx(void); int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid); =20 +/** + * resctrl_enable_mon_event() - Enable monitoring event + * @eventid: ID of the event + * @any_cpu: True if event data can be read from any CPU. + * @binary_bits:Number of binary places of the fixed-point value expected = to + * back a floating point event. Can only be set for floating point + * events. + * @arch_priv: Architecture private data associated with event. Passed ba= ck to + * architecture when reading the event via resctrl_arch_rmid_read(). + * + * The file system must not be mounted when enabling an event. + * + * Events that require per-domain (architectural and/or filesystem) state = must + * be enabled before the domain structures are allocated. For example befo= re + * CPU hotplug callbacks that allocate domain structures are registered. I= f the + * architecture discovers a resource after initialization it should enable + * events needing per-domain state before any domain structure allocation = which + * should be coordinated with the CPU hotplug callbacks. + * + * Return: + * true if event was successfully enabled, false otherwise. + */ bool resctrl_enable_mon_event(enum resctrl_event_id eventid, bool any_cpu, unsigned int binary_bits, void *arch_priv); =20 +/** + * resctrl_disable_mon_event() - Disable monitoring event + * @eventid: ID of the event + * + * The file system must not be mounted when disabling an event. + * + * Events that require per-domain (architectural and/or filesystem) state + * will require additional cleanup which should be coordinated with the CPU + * hotplug callbacks. + */ +void resctrl_disable_mon_event(enum resctrl_event_id eventid); + bool resctrl_is_mon_event_enabled(enum resctrl_event_id eventid); =20 bool resctrl_arch_is_evt_configurable(enum resctrl_event_id evt); diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index 9fd901c78dc6..327e7a863614 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -1012,6 +1012,18 @@ bool resctrl_enable_mon_event(enum resctrl_event_id = eventid, bool any_cpu, return true; } =20 +void resctrl_disable_mon_event(enum resctrl_event_id eventid) +{ + if (WARN_ON_ONCE(eventid < QOS_FIRST_EVENT || eventid >=3D QOS_NUM_EVENTS= )) + return; + if (!mon_event_all[eventid].enabled) { + pr_warn("Repeat disable for event %d\n", eventid); + return; + } + + mon_event_all[eventid].enabled =3D false; +} + bool resctrl_is_mon_event_enabled(enum resctrl_event_id eventid) { return eventid >=3D QOS_FIRST_EVENT && eventid < QOS_NUM_EVENTS && --=20 2.53.0 From nobody Tue Jun 16 19:33:08 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 93A8F421F0E for ; Wed, 29 Apr 2026 18:49:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488557; cv=none; b=UZxsOkimPMELm65dwH9sPLqCCiFWj+PSGmerUYXi/CvFeRG+lRGnUSD+i+MJ/DRVc3qjN84iJ8RkDjHF4GfcsrW/KUar+8yhtmzgx2cMFC2avO5GZmK4xOAx5e9KS+C4apwPvc1HNPzRZdS69tdNf+VI41zfL0IXW9XAsp+s8EU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488557; c=relaxed/simple; bh=uter/gm8jUnZpY+z3CK6LuRCuje9VP1rSqbu2Gu5G6E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Kimxge3WdfMHMR5BenoHQZ1M77gEuFpQmnYqVv5f3Zo1ij070j9pDV3ZTee/4DRgZyIWmnOjga/bW1pZXyHXF63NML65X0LJw5qKqMxbifNutAdiqAXd7OBur0EV40FqE83lsJOLLfujbzgQg94Wze4S0dd/nXqLvV5epW/eQ9s= 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=SXS6I1tm; arc=none smtp.client-ip=198.175.65.12 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="SXS6I1tm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1777488551; x=1809024551; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uter/gm8jUnZpY+z3CK6LuRCuje9VP1rSqbu2Gu5G6E=; b=SXS6I1tmcqGhUWJsdbADNqnTsgPnf+EgchezicCzgY+Z2oleLKqcgdZ1 oY1pd+n1oF6XHb/KyP6fN52Sg/fKkTn3wTj9un8g7yB5J4io/e4AnNt0W duv/L5w7XDxs0YmA0ziZX3FnH3LOdCsgE27uDBvmvkwDPF72JNOk46Zv/ 6NqRk6xbRUh8HT6spqO8IuBP+7WeVMOMAQ+KSmsJmS5PScN88z+UHmLKX fTRpSdO69A4tvrxo+ajrykxHYaXK2iSjJfnfAZkslaaqU9A91iAY6WvJg KIQva/V36emx6H0+O65BW6IKydBnURvk08FZGchKocv25m05o/szr0vKi g==; X-CSE-ConnectionGUID: 0HX+RwADQEmrYWl5+z4Fsg== X-CSE-MsgGUID: 8FDrKZk5Q6ulis5dztIR7A== X-IronPort-AV: E=McAfee;i="6800,10657,11771"; a="89890703" X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="89890703" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:06 -0700 X-CSE-ConnectionGUID: cZqh32tMToi1oIY5pqGp0A== X-CSE-MsgGUID: JDgcvwKpQDqPJZeo3nbFpg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="238323000" Received: from mjruhl-desk.amr.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.222.13]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:06 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu , David E Box , x86@kernel.org Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v6 03/10] x86/resctrl: Maintain a count of enabled monitor features Date: Wed, 29 Apr 2026 11:48:51 -0700 Message-ID: <20260429184858.36423-4-tony.luck@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260429184858.36423-1-tony.luck@intel.com> References: <20260429184858.36423-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" AET (Application Energy Telemetry) may be enabled/disabled from one mount to the next depending on whether the pmt_telemetry module is loaded. If AET is the only monitoring feature supported on a system and it is enabled in one mount, but disabled in a subsequent mount this will result in empty mon_data directories. Change from a boolean to a count of enabled monitor features inside architecture code. File system code only needs to know if any monitor features are enabled so resctrl_arch_mon_capable() can still return boolean. Signed-off-by: Tony Luck --- arch/x86/include/asm/resctrl.h | 4 ++-- arch/x86/kernel/cpu/resctrl/internal.h | 2 +- arch/x86/kernel/cpu/resctrl/core.c | 24 +++++++++++++----------- arch/x86/kernel/cpu/resctrl/monitor.c | 11 +++-------- 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/arch/x86/include/asm/resctrl.h b/arch/x86/include/asm/resctrl.h index 575f8408a9e7..1e50c7dc3fe3 100644 --- a/arch/x86/include/asm/resctrl.h +++ b/arch/x86/include/asm/resctrl.h @@ -43,7 +43,7 @@ struct resctrl_pqr_state { DECLARE_PER_CPU(struct resctrl_pqr_state, pqr_state); =20 extern bool rdt_alloc_capable; -extern bool rdt_mon_capable; +extern int rdt_mon_feature_count; =20 DECLARE_STATIC_KEY_FALSE(rdt_enable_key); DECLARE_STATIC_KEY_FALSE(rdt_alloc_enable_key); @@ -68,7 +68,7 @@ static inline void resctrl_arch_disable_alloc(void) =20 static inline bool resctrl_arch_mon_capable(void) { - return rdt_mon_capable; + return !!rdt_mon_feature_count; } =20 static inline void resctrl_arch_enable_mon(void) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index e3cfa0c10e92..3b09cfe9a046 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -224,7 +224,7 @@ union l3_qos_abmc_cfg { =20 void rdt_ctrl_update(void *arg); =20 -int rdt_get_l3_mon_config(struct rdt_resource *r); +void rdt_get_l3_mon_config(struct rdt_resource *r); =20 bool rdt_cpu_has(int flag); =20 diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index 7667cf7c4e94..1af8f965fdd0 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -779,7 +779,7 @@ void resctrl_arch_pre_mount(void) cpus_read_lock(); mutex_lock(&domain_list_lock); r->mon_capable =3D true; - rdt_mon_capable =3D true; + rdt_mon_feature_count++; for_each_online_cpu(cpu) domain_add_cpu_mon(cpu, r); mutex_unlock(&domain_list_lock); @@ -959,30 +959,32 @@ static __init bool get_rdt_alloc_resources(void) return ret; } =20 -static __init bool get_rdt_mon_resources(void) +static __init int get_rdt_mon_resources(void) { struct rdt_resource *r =3D &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl; - bool ret =3D false; + int ret =3D 0; =20 if (rdt_cpu_has(X86_FEATURE_CQM_OCCUP_LLC)) { resctrl_enable_mon_event(QOS_L3_OCCUP_EVENT_ID, false, 0, NULL); - ret =3D true; + ret++; } if (rdt_cpu_has(X86_FEATURE_CQM_MBM_TOTAL)) { resctrl_enable_mon_event(QOS_L3_MBM_TOTAL_EVENT_ID, false, 0, NULL); - ret =3D true; + ret++; } if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) { resctrl_enable_mon_event(QOS_L3_MBM_LOCAL_EVENT_ID, false, 0, NULL); - ret =3D true; + ret++; } if (rdt_cpu_has(X86_FEATURE_ABMC)) - ret =3D true; + ret++; =20 if (!ret) - return false; + return 0; =20 - return !rdt_get_l3_mon_config(r); + rdt_get_l3_mon_config(r); + + return ret; } =20 static __init void __check_quirks_intel(void) @@ -1013,9 +1015,9 @@ static __init void check_quirks(void) static __init bool get_rdt_resources(void) { rdt_alloc_capable =3D get_rdt_alloc_resources(); - rdt_mon_capable =3D get_rdt_mon_resources(); + rdt_mon_feature_count =3D get_rdt_mon_resources(); =20 - return (rdt_mon_capable || rdt_alloc_capable); + return (rdt_mon_feature_count || rdt_alloc_capable); } =20 static __init void rdt_init_res_defs_intel(void) diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/re= sctrl/monitor.c index 9bd87bae4983..497cc57ac135 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -25,11 +25,8 @@ =20 #include "internal.h" =20 -/* - * Global boolean for rdt_monitor which is true if any - * resource monitoring is enabled. - */ -bool rdt_mon_capable; +/* Global count of number of resource monitor functions that are enabled. = */ +int rdt_mon_feature_count; =20 #define CF(cf) ((unsigned long)(1048576 * (cf) + 0.5)) =20 @@ -402,7 +399,7 @@ static __init int snc_get_config(void) return ret; } =20 -int __init rdt_get_l3_mon_config(struct rdt_resource *r) +void __init rdt_get_l3_mon_config(struct rdt_resource *r) { unsigned int mbm_offset =3D boot_cpu_data.x86_cache_mbm_width_offset; struct rdt_hw_resource *hw_res =3D resctrl_to_arch_res(r); @@ -460,8 +457,6 @@ int __init rdt_get_l3_mon_config(struct rdt_resource *r) } =20 r->mon_capable =3D true; - - return 0; } =20 void __init intel_rdt_mbm_apply_quirk(void) --=20 2.53.0 From nobody Tue Jun 16 19:33:08 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 1E5FC3FD120 for ; Wed, 29 Apr 2026 18:49:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488557; cv=none; b=E3zfCm63NQbS5BEOKzvLZmUcSxYQMDwLOwwdB7pKGbWC1jkwvqIfGB0x9EIHmjIyEA+j4s9SqmtVZAhopTTdovNq0ULL95O+SNEGO6IhiXVXhE/0mWGZrI7R3CHOCQgRx4IAlu/y/8zSwfY3ucEvA+/sIz8DaCoV8RyOP/lGv/8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488557; c=relaxed/simple; bh=N/XAKokrqJPiBUHTtzoQkOQddXV1yuiXsu0rQQcXcoE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P8D2TbXYd4+LU2KyoFsnRos/VeegughdL0/zihmieBGgOsSx1+sCtKOTV+oY5FxklHEFBClD6z7Y4aXvcNwBjNOOF3MALig6MiSh2M/TZc4iQLsAHpN7JpdKb+6/HwkcqvBkjxuCZHAS37NVam6YrmPrqQs5e2fTONprfCRqGEE= 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=MdTscTGI; arc=none smtp.client-ip=198.175.65.12 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="MdTscTGI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1777488553; x=1809024553; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=N/XAKokrqJPiBUHTtzoQkOQddXV1yuiXsu0rQQcXcoE=; b=MdTscTGISyqHTb+08v2x36TheTkffKWv1bUFM7neTBUozvWahlBEHALa G1VA2CvCe7NyNGOq/gMxL1iYF3qOne7F3qCQ/Vtjmw4WzWi11k9KcgiP0 9ZAms7Vm576+YsQzZmz30cmc2BhflcMVRcVFcOlfpap721MHc+4YNpC2V pMNgvbiwCVLeiismDYjFSE2WTvLrtMpRMj3jp9tdq3u2kqj6JYgBPzXKk 6uKeX/4bdS5HiGJxe2GbzPgSdED8GAF2+4kA0HLTq05msAzuCfK7N57kt jo7P4CkFQD5wWEsA891NwMABzKoh7FbRdY0L9Awr184bk7QKm5X8UnNx4 g==; X-CSE-ConnectionGUID: U7gzusQjR7C9QwUBOggEbg== X-CSE-MsgGUID: 0lS1TD12SWa7yXBcEQbHBQ== X-IronPort-AV: E=McAfee;i="6800,10657,11771"; a="89890712" X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="89890712" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:07 -0700 X-CSE-ConnectionGUID: v2Y7P5SRThu9vsL2OlJDsA== X-CSE-MsgGUID: tEaKDgqJS4yHIAQbn+eVjw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="238323005" Received: from mjruhl-desk.amr.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.222.13]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:07 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu , David E Box , x86@kernel.org Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v6 04/10] fs,x86,mpam/resctrl: Handle change in number of RMIDs on each mount Date: Wed, 29 Apr 2026 11:48:52 -0700 Message-ID: <20260429184858.36423-5-tony.luck@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260429184858.36423-1-tony.luck@intel.com> References: <20260429184858.36423-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" Application Energy Telemetry (AET) event enumeration takes place asynchronously. Linux builds the pmt_telemetry module into the kernel to kick of enumeration early enough that it completes before first mount of the resctrl file system. Allowing pmt_telemetry to be a loadable module means that it is possible for different numbers of RMIDs to be supported on each mount, depending on whether pmt_telemetry module is loaded. Add resctrl_arch_system_max_rmid_idx() interface to provide the maximum supported number of RMIDs on a system. For x86 this is RDT_RESOURCE_L3 rdt_resource::mon.num_rmid (if L3 monitoring is enabled). Allocate the rmid_ptrs, rdt_l3_mon_domain::rmid_busy_llc, and rdt_l3_mon_domain::mbm_states based on the maximum possible. Initialize rmid_free_lru based on the number of RMIDs available for this mount. Note that some RMIDs may still be marked busy from a previous mount. Don't add these to the free list. Check current RMID limit in limbo_release_entry() and do not add out of range RMIDs to the free list. Signed-off-by: Tony Luck --- include/linux/resctrl.h | 1 + arch/x86/kernel/cpu/resctrl/core.c | 12 ++++++++ drivers/resctrl/mpam_resctrl.c | 5 ++++ fs/resctrl/monitor.c | 47 ++++++++++++++++++++---------- fs/resctrl/rdtgroup.c | 2 +- 5 files changed, 50 insertions(+), 17 deletions(-) diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index a8338656f836..3705f0214fa6 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -412,6 +412,7 @@ static inline u32 resctrl_get_default_ctrl(struct rdt_r= esource *r) /* The number of closid supported by this resource regardless of CDP */ u32 resctrl_arch_get_num_closid(struct rdt_resource *r); u32 resctrl_arch_system_num_rmid_idx(void); +u32 resctrl_arch_system_max_rmid_idx(void); int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid); =20 /** diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index 1af8f965fdd0..934492c7e643 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -129,6 +129,18 @@ u32 resctrl_arch_system_num_rmid_idx(void) return num_rmids =3D=3D U32_MAX ? 0 : num_rmids; } =20 +/** + * resctrl_arch_system_max_rmid_idx - Largest possible number of RMIDs + * + * Return: If L3 monitoring is supported, largest possible comes from L3. + */ +u32 resctrl_arch_system_max_rmid_idx(void) +{ + struct rdt_resource *r =3D &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl; + + return r->mon_capable ? r->mon.num_rmid : resctrl_arch_system_num_rmid_id= x(); +} + struct rdt_resource *resctrl_arch_get_resource(enum resctrl_res_level l) { if (l >=3D RDT_NUM_RESOURCES) diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c index 226ff6f532fa..7079870ca894 100644 --- a/drivers/resctrl/mpam_resctrl.c +++ b/drivers/resctrl/mpam_resctrl.c @@ -272,6 +272,11 @@ u32 resctrl_arch_system_num_rmid_idx(void) return (mpam_pmg_max + 1) * (mpam_partid_max + 1); } =20 +u32 resctrl_arch_system_max_rmid_idx(void) +{ + return resctrl_arch_system_num_rmid_idx(); +} + u32 resctrl_arch_rmid_idx_encode(u32 closid, u32 rmid) { return closid * (mpam_pmg_max + 1) + rmid; diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index 327e7a863614..cabf59afd39e 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -115,10 +115,17 @@ static inline struct rmid_entry *__rmid_entry(u32 idx) =20 static void limbo_release_entry(struct rmid_entry *entry) { + u32 idx_limit =3D resctrl_arch_system_num_rmid_idx(); lockdep_assert_held(&rdtgroup_mutex); =20 rmid_limbo_count--; - list_add_tail(&entry->list, &rmid_free_lru); + + /* + * Limbo may be freeing an RMID from a previous mount where there + * were more RMIDs available. + */ + if (resctrl_arch_rmid_idx_encode(entry->closid, entry->rmid) < idx_limit) + list_add_tail(&entry->list, &rmid_free_lru); =20 if (IS_ENABLED(CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID)) closid_num_dirty_rmid[entry->closid]--; @@ -133,7 +140,7 @@ static void limbo_release_entry(struct rmid_entry *entr= y) void __check_limbo(struct rdt_l3_mon_domain *d, bool force_free) { struct rdt_resource *r =3D resctrl_arch_get_resource(RDT_RESOURCE_L3); - u32 idx_limit =3D resctrl_arch_system_num_rmid_idx(); + u32 idx_limit =3D resctrl_arch_system_max_rmid_idx(); struct rmid_entry *entry; u32 idx, cur_idx =3D 1; void *arch_mon_ctx; @@ -192,7 +199,7 @@ void __check_limbo(struct rdt_l3_mon_domain *d, bool fo= rce_free) =20 bool has_busy_rmid(struct rdt_l3_mon_domain *d) { - u32 idx_limit =3D resctrl_arch_system_num_rmid_idx(); + u32 idx_limit =3D resctrl_arch_system_max_rmid_idx(); =20 return find_first_bit(d->rmid_busy_llc, idx_limit) !=3D idx_limit; } @@ -916,24 +923,32 @@ int setup_rmid_lru_list(void) return 0; =20 /* - * Called on every mount, but the number of RMIDs cannot change - * after the first mount, so keep using the same set of rmid_ptrs[] - * until resctrl_exit(). Note that the limbo handler continues to - * access rmid_ptrs[] after resctrl is unmounted. + * Allocate the largest number of RMIDs that this system will ever + * need. These cannot be freed until resctrl_exit() because the limbo + * handler continues to access rmid_ptrs[] after resctrl is unmounted. */ - if (rmid_ptrs) - return 0; + if (!rmid_ptrs) { + idx_limit =3D resctrl_arch_system_max_rmid_idx(); + rmid_ptrs =3D kzalloc_objs(struct rmid_entry, idx_limit); + if (!rmid_ptrs) + return -ENOMEM; + + for (i =3D 0; i < idx_limit; i++) { + entry =3D &rmid_ptrs[i]; + INIT_LIST_HEAD(&entry->list); + + resctrl_arch_rmid_idx_decode(i, &entry->closid, &entry->rmid); + } + } =20 + /* Find how many RMIDs are needed for this mount */ idx_limit =3D resctrl_arch_system_num_rmid_idx(); - rmid_ptrs =3D kzalloc_objs(struct rmid_entry, idx_limit); - if (!rmid_ptrs) - return -ENOMEM; =20 + INIT_LIST_HEAD(&rmid_free_lru); for (i =3D 0; i < idx_limit; i++) { entry =3D &rmid_ptrs[i]; - INIT_LIST_HEAD(&entry->list); - - resctrl_arch_rmid_idx_decode(i, &entry->closid, &entry->rmid); + if (i && entry->busy) + continue; list_add_tail(&entry->list, &rmid_free_lru); } =20 @@ -1156,7 +1171,7 @@ static void mbm_cntr_free_all(struct rdt_resource *r,= struct rdt_l3_mon_domain * */ static void resctrl_reset_rmid_all(struct rdt_resource *r, struct rdt_l3_m= on_domain *d) { - u32 idx_limit =3D resctrl_arch_system_num_rmid_idx(); + u32 idx_limit =3D resctrl_arch_system_max_rmid_idx(); enum resctrl_event_id evt; int idx; =20 diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 5dfdaa6f9d8f..2e31ff753114 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -4373,7 +4373,7 @@ void resctrl_offline_mon_domain(struct rdt_resource *= r, struct rdt_domain_hdr *h */ static int domain_setup_l3_mon_state(struct rdt_resource *r, struct rdt_l3= _mon_domain *d) { - u32 idx_limit =3D resctrl_arch_system_num_rmid_idx(); + u32 idx_limit =3D resctrl_arch_system_max_rmid_idx(); size_t tsize =3D sizeof(*d->mbm_states[0]); enum resctrl_event_id eventid; int idx; --=20 2.53.0 From nobody Tue Jun 16 19:33:08 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 3A397377ED7 for ; Wed, 29 Apr 2026 18:49:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488563; cv=none; b=jhJzHCczezr5oeJF7pG6yJJUO+0CsJE1tEsqsvBJ6mW0lYLrjDMVIQ29WMbgjcC4hffW/VPJKz56Ww7HJIZ3PnX7gE6ICIuxR5ITjqwLJ+vgjZfK3rZCYpawlbb2DULm153xhEHrROnwH+ezk4J192HwKvtfbDZCyxIQPAtamdM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488563; c=relaxed/simple; bh=rLOc77ldRdvLglDGNCsB9ndiaT8ZnPgCqg2WC/lIc0w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JLDQY+ZT5GQXETFyh0VUHSKNQdktRRsxYUXg1Jga5NFF26f0mlRXUsd6nfjAf/OlVqtHSMsOCwhAiOHXHBoYZ1TLWKpjt0V+WTPap+w/WbBugHBF9rR8DntHtHqgYUDPTtbVcSjQYjBu8jHBeWGT+ljJFfaLnYFFGSO552mhopo= 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=ilUscmQl; arc=none smtp.client-ip=198.175.65.12 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="ilUscmQl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1777488558; x=1809024558; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rLOc77ldRdvLglDGNCsB9ndiaT8ZnPgCqg2WC/lIc0w=; b=ilUscmQlZeHxHdVFGpnno8Um09NApTFH7rjA7ZxKYHZPWM/DEYDulNxC pOQD5piKoyKa7Te372cUA9xba8LSSuV8ZegeYShHwCwPcMMFC1E0UOIIA 971g46GEarFwt+aIlTbz5zlr0DPMVx8qLXcEdov9uVGHnmZeek/S1OkfG 0hE5ZMeTzbBmsphARTFZYtdJ6+UiAmgX2kA1Gre/LIaqq8LaKRh2ipDgc eMcdYXeulH5/Ehyst46JanDfTnisbHdSdRBsPZeBz1Q1MVlWn9W814Z41 ihAO3MhchvG2BhY/TtuIYqcGOPWHMMM1dzg3JJMCJUoUJVpE2exk23oxU w==; X-CSE-ConnectionGUID: QgZNdRXFSQuNo9eTa1U+7w== X-CSE-MsgGUID: YFMSUKfrSBOBc/8MTadQ0g== X-IronPort-AV: E=McAfee;i="6800,10657,11771"; a="89890721" X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="89890721" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:07 -0700 X-CSE-ConnectionGUID: ZnOoNTSWRNmglTbLjBW6xQ== X-CSE-MsgGUID: xUIhFUB7Sce2NHHU8EdMWQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="238323014" Received: from mjruhl-desk.amr.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.222.13]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:07 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu , David E Box , x86@kernel.org Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v6 05/10] x86/resctrl: x86/resctrl: Add PMT registration API for AET enumeration callbacks Date: Wed, 29 Apr 2026 11:48:53 -0700 Message-ID: <20260429184858.36423-6-tony.luck@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260429184858.36423-1-tony.luck@intel.com> References: <20260429184858.36423-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" resctrl is always built-in; INTEL_PMT_TELEMETRY may be a module. Add, and export, register/unregister functions so the PMT module can supply/clear enumeration callback functions when loaded/unloaded. Suggested-by: Christoph Hellwig Signed-off-by: Tony Luck --- arch/x86/include/asm/resctrl.h | 19 ++++++++++++++ arch/x86/kernel/cpu/resctrl/intel_aet.c | 35 +++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/arch/x86/include/asm/resctrl.h b/arch/x86/include/asm/resctrl.h index 1e50c7dc3fe3..7c929b72098c 100644 --- a/arch/x86/include/asm/resctrl.h +++ b/arch/x86/include/asm/resctrl.h @@ -4,6 +4,8 @@ =20 #ifdef CONFIG_X86_CPU_RESCTRL =20 +#include +#include #include #include #include @@ -193,11 +195,28 @@ static inline void resctrl_arch_mon_ctx_free(struct r= dt_resource *r, =20 void resctrl_cpu_detect(struct cpuinfo_x86 *c); =20 +#ifdef CONFIG_X86_CPU_RESCTRL_INTEL_AET +void intel_aet_register_enumeration(struct pmt_feature_group *(*get)(enum = pmt_feature_id id), + void (*put)(struct pmt_feature_group *p)); +void intel_aet_unregister_enumeration(void); #else +static inline void intel_aet_register_enumeration(struct pmt_feature_group= *(*get)(enum pmt_feature_id id), + void (*put)(struct pmt_feature_group *p)) { } +static inline void intel_aet_unregister_enumeration(void) { } +#endif /* CONFIG_X86_CPU_RESCTRL_INTEL_AET */ + +#else + +#include +#include =20 static inline void resctrl_arch_sched_in(struct task_struct *tsk) {} static inline void resctrl_cpu_detect(struct cpuinfo_x86 *c) {} =20 +static inline void intel_aet_register_enumeration(struct pmt_feature_group= *(*get)(enum pmt_feature_id id), + void (*put)(struct pmt_feature_group *p)) { } +static inline void intel_aet_unregister_enumeration(void) { } + #endif /* CONFIG_X86_CPU_RESCTRL */ =20 #endif /* _ASM_X86_RESCTRL_H */ diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/= resctrl/intel_aet.c index e2af700bca04..2b3677783427 100644 --- a/arch/x86/kernel/cpu/resctrl/intel_aet.c +++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c @@ -12,17 +12,21 @@ #define pr_fmt(fmt) "resctrl: " fmt =20 #include +#include #include #include #include #include #include +#include #include #include #include #include #include #include +#include +#include #include #include #include @@ -289,6 +293,9 @@ static enum pmt_feature_id lookup_pfid(const char *pfna= me) return FEATURE_INVALID; } =20 +static struct pmt_feature_group *(*get_feature)(enum pmt_feature_id id); +static void (*put_feature)(struct pmt_feature_group *p); + /* * Request a copy of struct pmt_feature_group for each event group. If the= re is * one, the returned structure has an array of telemetry_region structures, @@ -323,6 +330,25 @@ bool intel_aet_get_events(void) return ret; } =20 +static DEFINE_MUTEX(aet_register_lock); + +void intel_aet_register_enumeration(struct pmt_feature_group *(*get)(enum = pmt_feature_id id), + void (*put)(struct pmt_feature_group *p)) +{ + guard(mutex)(&aet_register_lock); + get_feature =3D get; + put_feature =3D put; +} +EXPORT_SYMBOL_GPL(intel_aet_register_enumeration); + +void intel_aet_unregister_enumeration(void) +{ + guard(mutex)(&aet_register_lock); + get_feature =3D NULL; + put_feature =3D NULL; +} +EXPORT_SYMBOL_GPL(intel_aet_unregister_enumeration); + void __exit intel_aet_exit(void) { struct event_group **peg; @@ -405,3 +431,12 @@ void intel_aet_mon_domain_setup(int cpu, int id, struc= t rdt_resource *r, kfree(d); } } + +static int __init intel_aet_init(void) +{ + request_module("pmt_telemetry"); + + return 0; +} + +late_initcall(intel_aet_init); --=20 2.53.0 From nobody Tue Jun 16 19:33:08 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 4C2CC421F07 for ; Wed, 29 Apr 2026 18:49:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488564; cv=none; b=SyL3gkAnc0tAXvM78dyeeqTleliuvm5g+9hi/R20ioae1t2HRRutAen2HAWxXG53sG2Bt7ZgbZeytnJL4/EEmuIoL3V4DTGcUlXPuTCmuUHPeXnTI8JujVXhecEsyD+J08rYqt1GGUCwuCqOcCL1cExmyP6SG42L7A3rQQ7Bi2s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488564; c=relaxed/simple; bh=R5ipzQsFGiwFF2x8vYufOfcDSE3QnQ50EK420XzTosg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YAgG6e16TEnaOd7fKGvbciPlwo0hRSf5iNV8lWWZIQz4V/ECiZPOcrSXPmkgtHxvyv6K7rJw1GbgXPQn5T8R1g4f3sH07+c68k40CRGl+AhMb5u3HCr0PLL4XUMg0DC6EcY8k00v2V3c6YnvLsM5ls9lLc11YQgJnOj84U3ULOA= 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=JcQW/vhS; arc=none smtp.client-ip=198.175.65.12 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="JcQW/vhS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1777488559; x=1809024559; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=R5ipzQsFGiwFF2x8vYufOfcDSE3QnQ50EK420XzTosg=; b=JcQW/vhSncMR9eBfqq+NCLbaP4r6TR7aSrqZPJEcezNSE3MsW5TzxL5W V+BqYvIH10+ife86zWg7woE0Q4SBpI0qXm4cqMJjD2DKgC3uzel3Bsg5x BRrSl8kJH6v6kT/bpdiY/Lgv/lsgmNgw97JUB9RCnKaXLJSPCm9dD7NBh BmHL8GEhsTMLbk14WTaugmDWMg0800NbPLuyqgxh+yg6wQp/tPt9c9O9Z 1bZ1dw+6+ZgPFKT2ldcB/On4GgUvUJNrWjBySg3d52pjEVLUUtEpA3gfq 79s6mYSNLlsFJ+9p2/hIJAJPz05BAmSwvwX0Z6D/1LLQJiBRUKIFPBe9X g==; X-CSE-ConnectionGUID: DYlRUpSZS+KDEgVFXLhbMg== X-CSE-MsgGUID: BHPz5Xu5T4yPWxGGJEGg4g== X-IronPort-AV: E=McAfee;i="6800,10657,11771"; a="89890732" X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="89890732" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:08 -0700 X-CSE-ConnectionGUID: YqhGi1EFSM+O7dun9m0YEw== X-CSE-MsgGUID: KTlQ7q1xQ8Ks5RLKnmijLw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="238323022" Received: from mjruhl-desk.amr.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.222.13]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:08 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu , David E Box , x86@kernel.org Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v6 06/10] platform/x86/intel/pmt: Register enumeration functions with resctrl Date: Wed, 29 Apr 2026 11:48:54 -0700 Message-ID: <20260429184858.36423-7-tony.luck@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260429184858.36423-1-tony.luck@intel.com> References: <20260429184858.36423-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" INTEL_PMT_TELEMETRY is a loadable module, but resctrl is built-in and cannot call PMT functions directly. Register the telemetry enumeration function pointers at pmt_telemetry module init, and unregister them at module exit. Add module_{get,put} calls to the PMT get/put functions to ensure that INTEL_PMT_TELEMETRY cannot be unloaded while resctrl is mounted and referencing the MMIO register space mapped by INTEL_PMT_TELEMETRY. Note that checkpatch complains about the #include of . This is needed rather than to get the function stub definitions when CONFIG_X86_CPU_RESCTRL=3Dn. Suggested-by: Christoph Hellwig Signed-off-by: Tony Luck --- drivers/platform/x86/intel/pmt/telemetry.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/intel/pmt/telemetry.c b/drivers/platform/= x86/intel/pmt/telemetry.c index bdc7c24a3678..0088027c1b15 100644 --- a/drivers/platform/x86/intel/pmt/telemetry.c +++ b/drivers/platform/x86/intel/pmt/telemetry.c @@ -25,6 +25,8 @@ #include #include =20 +#include + #include "class.h" =20 #define TELEM_SIZE_OFFSET 0x0 @@ -284,6 +286,9 @@ struct pmt_feature_group *intel_pmt_get_regions_by_feat= ure(enum pmt_feature_id i region++; } =20 + if (!try_module_get(THIS_MODULE)) + return ERR_PTR(-EINVAL); + kref_init(&feature_group->kref); =20 return no_free_ptr(feature_group); @@ -293,6 +298,7 @@ EXPORT_SYMBOL(intel_pmt_get_regions_by_feature); void intel_pmt_put_feature_group(struct pmt_feature_group *feature_group) { kref_put(&feature_group->kref, pmt_feature_group_release); + module_put(THIS_MODULE); } EXPORT_SYMBOL(intel_pmt_put_feature_group); =20 @@ -425,7 +431,15 @@ static struct auxiliary_driver pmt_telem_aux_driver = =3D { =20 static int __init pmt_telem_init(void) { - return auxiliary_driver_register(&pmt_telem_aux_driver); + int ret; + + ret =3D auxiliary_driver_register(&pmt_telem_aux_driver); + if (ret) + return ret; + + intel_aet_register_enumeration(intel_pmt_get_regions_by_feature, + intel_pmt_put_feature_group); + return 0; } module_init(pmt_telem_init); =20 @@ -433,6 +447,7 @@ static void __exit pmt_telem_exit(void) { auxiliary_driver_unregister(&pmt_telem_aux_driver); xa_destroy(&telem_array); + intel_aet_unregister_enumeration(); } module_exit(pmt_telem_exit); =20 --=20 2.53.0 From nobody Tue Jun 16 19:33:08 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 7761C3FE357 for ; Wed, 29 Apr 2026 18:49:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488564; cv=none; b=Tgf1+BDpKrCJQ8gAlMyFfUlFCQ2coGzuBv0TUiYp7ADiWHECNjUfp8Gd+xf+TphJzPnC7Yi722hDeo2C+i6uUGpUGvtIJXrprG3tgLkbHxKscosYgrjJ5/0oeQmjlNHOKi7bT8DAvHU/5SWtZrlRIpOt6wYAemYmFmf71Rg0PwM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488564; c=relaxed/simple; bh=gDithhGK9/jeLzYM5a2BxEcbR65W2GtKgeDaTht9ynM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NIEEz3MBvJd4TfQlAMo6onbbmjyhjYFmL7StCXZgihjwFNug/uaJaLyrb5EhlD79jhBzjAyt5E3Hui1ED2L7AvUrC0kXLKUUFXDL7PFvKCtPd5jooK80ImgVTZ8dAEbbDSKhTTXfxjBmUAQB7axPYPxsDCy+f1aCnXW6g3vwymA= 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=BDpnhNDN; arc=none smtp.client-ip=198.175.65.12 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="BDpnhNDN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1777488560; x=1809024560; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gDithhGK9/jeLzYM5a2BxEcbR65W2GtKgeDaTht9ynM=; b=BDpnhNDNm8Jg7uHpfxk0G3W/USDGLQqOFVNv2YrMhEa+gymAjjMD1YPI M80bQKWPUxXRx8mYN2JzvJaSVdPJspTju8D87Z99IY+iFQh9ImYd+bZVo psRGssnLdbvCumkCanwIztvo1X11W1l8lwtZFp1XeiHpYGyIeSBeL2QNn dIDt8p7ZcbgFJM96KnZX9jEnIYqhdz99wtchCI/BjiU6IZlWwKK92YrHv OhN4iny3YAxB+w/Ft/EtoTmgYtmDQ72DHlWaaBUUt1sI9ka3M+Ef5XeHp QyiMj4I6K+QnyxDcu5BijtlZuyw7DZEDWjg1YdoB0nXRJYprLiUwzVEbq Q==; X-CSE-ConnectionGUID: jHZFcgXJSnGPscoPjNZ54A== X-CSE-MsgGUID: NrmFVgFHSfK0lIBS2ZLQSg== X-IronPort-AV: E=McAfee;i="6800,10657,11771"; a="89890742" X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="89890742" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:08 -0700 X-CSE-ConnectionGUID: lkKQ2L09RS6D/oGh+GlxkA== X-CSE-MsgGUID: B5rmDV8pT3iJT7ROA80J/g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="238323029" Received: from mjruhl-desk.amr.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.222.13]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:08 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu , David E Box , x86@kernel.org Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v6 07/10] x86/resctrl: Resolve INTEL_PMT_TELEMETRY symbols at runtime Date: Wed, 29 Apr 2026 11:48:55 -0700 Message-ID: <20260429184858.36423-8-tony.luck@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260429184858.36423-1-tony.luck@intel.com> References: <20260429184858.36423-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" resctrl is always built-in, but INTEL_PMT_TELEMETRY and INTEL_TPMI are logically independent and should be loadable modules. Switch AET to use the function-pointer registration API (introduced in the preceding patch) instead of direct link-time references to PMT symbols. Move AET enumeration into resctrl_arch_pre_mount() and cleanup into resctrl_arch_unmount() so the PMT module can be unloaded whenever the filesystem is not mounted. Because all cleanup now happens in the unmount path, intel_aet_exit() is no longer needed and is removed. Note that the Linux file system code does not serialize calls to fs_context_operations::get_tree(), so there may be arbitrarily many parallel calls if users invoke mount(2) multiple times. Add locking and state (resctrl_arch_mount_entries) to only perform enumerat= ion of first mount, and cleanup on last unmount. event_group::num_rmid may be reset (reduced) during enumeration. This is not worth resetting on unmount because the same reduction would occur on each subsequent mount. Signed-off-by: Tony Luck --- include/linux/resctrl.h | 3 ++ arch/x86/kernel/cpu/resctrl/internal.h | 8 ++--- arch/x86/kernel/cpu/resctrl/core.c | 41 +++++++++++++++++++++++-- arch/x86/kernel/cpu/resctrl/intel_aet.c | 26 ++++++++++++---- 4 files changed, 65 insertions(+), 13 deletions(-) diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 3705f0214fa6..9534d42e0c57 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -557,6 +557,9 @@ void resctrl_offline_cpu(unsigned int cpu); */ void resctrl_arch_pre_mount(void); =20 +/* Called to report unmount. */ +void resctrl_arch_unmount(void); + /** * resctrl_arch_rmid_read() - Read the eventid counter corresponding to rm= id * for this resource and domain. diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index 3b09cfe9a046..017a19143ec9 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -234,15 +234,15 @@ void rdt_domain_reconfigure_cdp(struct rdt_resource *= r); void resctrl_arch_mbm_cntr_assign_set_one(struct rdt_resource *r); =20 #ifdef CONFIG_X86_CPU_RESCTRL_INTEL_AET -bool intel_aet_get_events(void); -void __exit intel_aet_exit(void); +bool intel_aet_pre_mount(void); +void intel_aet_unmount(void); int intel_aet_read_event(int domid, u32 rmid, void *arch_priv, u64 *val); void intel_aet_mon_domain_setup(int cpu, int id, struct rdt_resource *r, struct list_head *add_pos); bool intel_handle_aet_option(bool force_off, char *tok); #else -static inline bool intel_aet_get_events(void) { return false; } -static inline void __exit intel_aet_exit(void) { } +static inline bool intel_aet_pre_mount(void) { return false; } +static inline void intel_aet_unmount(void) { } static inline int intel_aet_read_event(int domid, u32 rmid, void *arch_pri= v, u64 *val) { return -EINVAL; diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index 934492c7e643..9336299b9647 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -16,10 +16,12 @@ =20 #define pr_fmt(fmt) "resctrl: " fmt =20 +#include #include #include #include #include +#include =20 #include #include @@ -776,12 +778,20 @@ static int resctrl_arch_offline_cpu(unsigned int cpu) return 0; } =20 +static DEFINE_MUTEX(resctrl_arch_mount_lock); +static int resctrl_arch_mount_entries; + void resctrl_arch_pre_mount(void) { struct rdt_resource *r =3D &rdt_resources_all[RDT_RESOURCE_PERF_PKG].r_re= sctrl; int cpu; =20 - if (!intel_aet_get_events()) + guard(mutex)(&resctrl_arch_mount_lock); + + if (++resctrl_arch_mount_entries > 1) + return; + + if (!intel_aet_pre_mount()) return; =20 /* @@ -798,6 +808,33 @@ void resctrl_arch_pre_mount(void) cpus_read_unlock(); } =20 +void resctrl_arch_unmount(void) +{ + struct rdt_resource *r =3D &rdt_resources_all[RDT_RESOURCE_PERF_PKG].r_re= sctrl; + int cpu; + + guard(mutex)(&resctrl_arch_mount_lock); + + if (--resctrl_arch_mount_entries > 0) + return; + + WARN_ON(resctrl_arch_mount_entries < 0); + + intel_aet_unmount(); + + if (!r->mon_capable) + return; + + cpus_read_lock(); + mutex_lock(&domain_list_lock); + for_each_online_cpu(cpu) + domain_remove_cpu_mon(cpu, r); + r->mon_capable =3D false; + rdt_mon_feature_count--; + mutex_unlock(&domain_list_lock); + cpus_read_unlock(); +} + enum { RDT_FLAG_CMT, RDT_FLAG_MBM_TOTAL, @@ -1174,8 +1211,6 @@ late_initcall(resctrl_arch_late_init); =20 static void __exit resctrl_arch_exit(void) { - intel_aet_exit(); - cpuhp_remove_state(rdt_online); =20 resctrl_exit(); diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/= resctrl/intel_aet.c index 2b3677783427..6e7458a722f9 100644 --- a/arch/x86/kernel/cpu/resctrl/intel_aet.c +++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c @@ -25,8 +25,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -307,7 +307,7 @@ static void (*put_feature)(struct pmt_feature_group *p); * struct pmt_feature_group to indicate that its events are successfully * enabled. */ -bool intel_aet_get_events(void) +static bool aet_get_events(void) { struct pmt_feature_group *p; enum pmt_feature_id pfid; @@ -316,14 +316,14 @@ bool intel_aet_get_events(void) =20 for_each_event_group(peg) { pfid =3D lookup_pfid((*peg)->pfname); - p =3D intel_pmt_get_regions_by_feature(pfid); + p =3D get_feature(pfid); if (IS_ERR_OR_NULL(p)) continue; if (enable_events(*peg, p)) { (*peg)->pfg =3D p; ret =3D true; } else { - intel_pmt_put_feature_group(p); + put_feature(p); } } =20 @@ -349,13 +349,27 @@ void intel_aet_unregister_enumeration(void) } EXPORT_SYMBOL_GPL(intel_aet_unregister_enumeration); =20 -void __exit intel_aet_exit(void) +bool intel_aet_pre_mount(void) +{ + guard(mutex)(&aet_register_lock); + if (!get_feature || !put_feature) + return false; + + return aet_get_events(); +} + +void intel_aet_unmount(void) { struct event_group **peg; =20 + guard(mutex)(&aet_register_lock); for_each_event_group(peg) { if ((*peg)->pfg) { - intel_pmt_put_feature_group((*peg)->pfg); + struct event_group *e =3D *peg; + + for (int j =3D 0; j < e->num_events; j++) + resctrl_disable_mon_event(e->evts[j].id); + put_feature((*peg)->pfg); (*peg)->pfg =3D NULL; } } --=20 2.53.0 From nobody Tue Jun 16 19:33:09 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 3077227F017 for ; Wed, 29 Apr 2026 18:49:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488568; cv=none; b=R2BXbBteO2NqXjZyWTiGmJEbkC5QnPFz70ikR4H0UIGiJK64ZQTNuFHvx15x1yI/OBEKv8/k1Vfdb7R1qlVxwo55rqI8sfQ02F2EuR+XISfP/oUI2vLB3LWY1zIHNHoYZl93GS+KVGseKeOw7scOZvFpqN4Ql8gktIqVCy9TMWQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488568; c=relaxed/simple; bh=xNTNK/75KML/j4U9TRC6Wx+YLGkaG8GrlGihkDxsK+8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qugfctdSKbJuABoq62rPuZWtiIULoNOH5jpuhETebRgmlNO+YalztRdoEbzamseTT4saqNZ05/SicCJj4tIjQoilSEn1icZPhJNp1sLN+bX3TJXNLn3Ph+9/EVlrHakOytT2KW3HhKCl9NfEN9M5qRehI1rsm7mCuFILCiVvOLE= 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=PNNZY1Fk; arc=none smtp.client-ip=198.175.65.12 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="PNNZY1Fk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1777488564; x=1809024564; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xNTNK/75KML/j4U9TRC6Wx+YLGkaG8GrlGihkDxsK+8=; b=PNNZY1Fku/RnDMUdGnM5caq83I23cFh9XZIUTugmvi7jloi/hiPBxPkh 5IgdeevMMCCHOTYCM71QlZwhrxHCwjaUl/pxNJIozw/f4NeDQ1FNUv+4/ n6MxvSSudSFYjdCYqbQwxC/wQ1uJvKvq5kWIgUg5nobEs5fOkjmCT3zX7 m4f+EScuh0vMspW1pRZK/TksMbej9DJ5q5+tir4nDylV6Sa2Ho0jpCBE3 221Q8ICVnB5ftmf3yj9M/rsUJjtOuH9szy2srtO+yVzn33C0x/1Y7EPmL 4h2p+eFreHZrpq+Roq9VjMhIxjb2SO/oFqoP60Bqif2KADDu61/f4bcqV g==; X-CSE-ConnectionGUID: m8WtiVeyQcqdyWytOUv03w== X-CSE-MsgGUID: KeuK69u2SEi/ez20Z4nX8g== X-IronPort-AV: E=McAfee;i="6800,10657,11771"; a="89890754" X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="89890754" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:09 -0700 X-CSE-ConnectionGUID: wFpEGzeURE6/rw7YT1dcfg== X-CSE-MsgGUID: 9ubC7sEHRl2OQPcNGkR1/A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="238323040" Received: from mjruhl-desk.amr.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.222.13]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:08 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu , David E Box , x86@kernel.org Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v6 08/10] fs/resctrl: Call architecture hooks for every mount/unmount Date: Wed, 29 Apr 2026 11:48:56 -0700 Message-ID: <20260429184858.36423-9-tony.luck@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260429184858.36423-1-tony.luck@intel.com> References: <20260429184858.36423-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" Architecture code for AET needs to acquire INTEL_PMT_TELEMETRY module references on mount and release them on unmount. Add hooks for every mount/unmount of the resctrl file system so that architecture code can allocate on mount and free on unmount. Signed-off-by: Tony Luck --- include/linux/resctrl.h | 7 +++++-- fs/resctrl/rdtgroup.c | 9 +++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 9534d42e0c57..e8a87c3664db 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -552,12 +552,15 @@ void resctrl_online_cpu(unsigned int cpu); void resctrl_offline_cpu(unsigned int cpu); =20 /* - * Architecture hook called at beginning of first file system mount attemp= t. + * Architecture hook called before attempting to mount the file system. * No locks are held. */ void resctrl_arch_pre_mount(void); =20 -/* Called to report unmount. */ +/* + * Architecture hook called when mount fails, or on unmount. + * No locks are held. + */ void resctrl_arch_unmount(void); =20 /** diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 2e31ff753114..134ad69de194 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -2790,7 +2789,7 @@ static int rdt_get_tree(struct fs_context *fc) struct rdt_resource *r; int ret; =20 - DO_ONCE_SLEEPABLE(resctrl_arch_pre_mount); + resctrl_arch_pre_mount(); =20 cpus_read_lock(); mutex_lock(&rdtgroup_mutex); @@ -2899,6 +2898,10 @@ static int rdt_get_tree(struct fs_context *fc) rdt_last_cmd_clear(); mutex_unlock(&rdtgroup_mutex); cpus_read_unlock(); + + if (ret) + resctrl_arch_unmount(); + return ret; } =20 @@ -3191,6 +3194,8 @@ static void rdt_kill_sb(struct super_block *sb) kernfs_kill_sb(sb); mutex_unlock(&rdtgroup_mutex); cpus_read_unlock(); + + resctrl_arch_unmount(); } =20 static struct file_system_type rdt_fs_type =3D { --=20 2.53.0 From nobody Tue Jun 16 19:33:09 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 3786A423A64 for ; Wed, 29 Apr 2026 18:49:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488573; cv=none; b=phtJUCfzieWZZsyQF88cW8fa6Nl7R9oauGHj2O2AQ54AWtIx8vxG7BNd20iUabir9K0CnnsrgSgHwDfJAHbhckrD1bGHYQMRlJ4TCzZprqNYZii4x+AlpGz/0Pws1FuXCo8LZ7FIxOvxTxzHnMIwHP5CX/QPBh8/DLOOHEE2rQ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488573; c=relaxed/simple; bh=gbzu/Tg6Qfnn/KJGxlI9TYfjD1D6N/Ew6k1PhVBRDT0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HgNq/WQ9zZJuBdggPP4oAljB7T/8B9UNCLWeb9FkeTbZhoJa/j97Z8UBd95V28mlnMjTzIxLZetwYKcR8/YjdeO0aGAQPZ2i9ASi4tIjF5ioEZCI7OJ3l5vUgofiRPRXw1BHxcr5j+4k6Y9vwa6vMJJNSlDH2ih+OnSxZKFh114= 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=EqjQ6oNg; arc=none smtp.client-ip=198.175.65.12 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="EqjQ6oNg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1777488566; x=1809024566; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gbzu/Tg6Qfnn/KJGxlI9TYfjD1D6N/Ew6k1PhVBRDT0=; b=EqjQ6oNgT74w7vBfKBIeodQ9zTrE8VkOD+NqKs+3atXb75McT8gcOT50 Z/WyZx/cFv1udzu1rshBJwr+LKtL1l1dZGWfz3Vl2EAqkMgNcl5TmpZQv asc/4w7bFgiR07lZB3OxZhblB2W/NKEPf38ajUuHSd51kW/rEvcXBnkR5 IWEQaHgHWoVZwpC2vbWJ4+AM6vyUP1b4iOVYYXQkjgtQhxNZo6Rkw2GPh /qUPZwzeE+UbOafosopYSfVmunhVk9xNaSixGc6uYwAbvwk/hY6Tp7lj1 25TYZccH0LEBBit9KhjXAyWEONBkZ6Cl/b4sxKG50bgxbqlk/dtIyefKQ Q==; X-CSE-ConnectionGUID: uo7NKpe6Rj6GIMpShVvSPw== X-CSE-MsgGUID: mDP/WLkKQmGn/RIG0EFrbg== X-IronPort-AV: E=McAfee;i="6800,10657,11771"; a="89890765" X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="89890765" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:09 -0700 X-CSE-ConnectionGUID: +3xF+w3QSBqKD1lSd2KSAA== X-CSE-MsgGUID: ZQjy1OAPTAa6I59ol/zakg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="238323048" Received: from mjruhl-desk.amr.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.222.13]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:09 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu , David E Box , x86@kernel.org Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v6 09/10] x86/resctrl: Simplify Kconfig options for resctrl Date: Wed, 29 Apr 2026 11:48:57 -0700 Message-ID: <20260429184858.36423-10-tony.luck@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260429184858.36423-1-tony.luck@intel.com> References: <20260429184858.36423-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" Linus Torvalds complained[1] about Kconfig complexity making it too hard for "random people to build their own kernels". CONFIG_X86_CPU_RESCTRL_INTEL_AET has been causing problems since it was first added as it unnaturally required other config options to be set to "built-in". AET now resolves PMT symbols at runtime via the registration API, so INTEL_PMT_TELEMETRY no longer needs to be built-in. This means that AET can be included unconditionally as part of X86_CPU_RESCTRL. Signed-off-by: Tony Luck Link: https://lore.kernel.org/all/CAHk-=3Dwhigg3hvOy7c1j1MXFy6o6CHp0g4Tc3Y-= MAk+XDssHU0A@mail.gmail.com # 1 --- arch/x86/include/asm/resctrl.h | 6 ------ arch/x86/kernel/cpu/resctrl/internal.h | 13 ------------- arch/x86/Kconfig | 16 ++-------------- arch/x86/kernel/cpu/resctrl/Makefile | 2 +- 4 files changed, 3 insertions(+), 34 deletions(-) diff --git a/arch/x86/include/asm/resctrl.h b/arch/x86/include/asm/resctrl.h index 7c929b72098c..775b8edd891b 100644 --- a/arch/x86/include/asm/resctrl.h +++ b/arch/x86/include/asm/resctrl.h @@ -195,15 +195,9 @@ static inline void resctrl_arch_mon_ctx_free(struct rd= t_resource *r, =20 void resctrl_cpu_detect(struct cpuinfo_x86 *c); =20 -#ifdef CONFIG_X86_CPU_RESCTRL_INTEL_AET void intel_aet_register_enumeration(struct pmt_feature_group *(*get)(enum = pmt_feature_id id), void (*put)(struct pmt_feature_group *p)); void intel_aet_unregister_enumeration(void); -#else -static inline void intel_aet_register_enumeration(struct pmt_feature_group= *(*get)(enum pmt_feature_id id), - void (*put)(struct pmt_feature_group *p)) { } -static inline void intel_aet_unregister_enumeration(void) { } -#endif /* CONFIG_X86_CPU_RESCTRL_INTEL_AET */ =20 #else =20 diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index 017a19143ec9..4a89f00aaa01 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -233,24 +233,11 @@ void __init intel_rdt_mbm_apply_quirk(void); void rdt_domain_reconfigure_cdp(struct rdt_resource *r); void resctrl_arch_mbm_cntr_assign_set_one(struct rdt_resource *r); =20 -#ifdef CONFIG_X86_CPU_RESCTRL_INTEL_AET bool intel_aet_pre_mount(void); void intel_aet_unmount(void); int intel_aet_read_event(int domid, u32 rmid, void *arch_priv, u64 *val); void intel_aet_mon_domain_setup(int cpu, int id, struct rdt_resource *r, struct list_head *add_pos); bool intel_handle_aet_option(bool force_off, char *tok); -#else -static inline bool intel_aet_pre_mount(void) { return false; } -static inline void intel_aet_unmount(void) { } -static inline int intel_aet_read_event(int domid, u32 rmid, void *arch_pri= v, u64 *val) -{ - return -EINVAL; -} - -static inline void intel_aet_mon_domain_setup(int cpu, int id, struct rdt_= resource *r, - struct list_head *add_pos) { } -static inline bool intel_handle_aet_option(bool force_off, char *tok) { re= turn false; } -#endif =20 #endif /* _ASM_X86_RESCTRL_INTERNAL_H */ diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index f3f7cb01d69d..861985294547 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -515,8 +515,9 @@ config X86_MPPARSE =20 config X86_CPU_RESCTRL bool "x86 CPU resource control support" - depends on X86 && (CPU_SUP_INTEL || CPU_SUP_AMD) + depends on X86_64 && (CPU_SUP_INTEL || CPU_SUP_AMD) depends on MISC_FILESYSTEMS + depends on (INTEL_PMT_TELEMETRY !=3D n) || !CPU_SUP_INTEL select ARCH_HAS_CPU_RESCTRL select RESCTRL_FS select RESCTRL_FS_PSEUDO_LOCK @@ -536,19 +537,6 @@ config X86_CPU_RESCTRL =20 Say N if unsure. =20 -config X86_CPU_RESCTRL_INTEL_AET - bool "Intel Application Energy Telemetry" - depends on X86_64 && X86_CPU_RESCTRL && CPU_SUP_INTEL && INTEL_PMT_TELEME= TRY=3Dy && INTEL_TPMI=3Dy - help - Enable per-RMID telemetry events in resctrl. - - Intel feature that collects per-RMID execution data - about energy consumption, measure of frequency independent - activity and other performance metrics. Data is aggregated - per package. - - Say N if unsure. - config X86_FRED bool "Flexible Return and Event Delivery" depends on X86_64 diff --git a/arch/x86/kernel/cpu/resctrl/Makefile b/arch/x86/kernel/cpu/res= ctrl/Makefile index 273ddfa30836..97ceb4e44dfa 100644 --- a/arch/x86/kernel/cpu/resctrl/Makefile +++ b/arch/x86/kernel/cpu/resctrl/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_X86_CPU_RESCTRL) +=3D core.o rdtgroup.o monitor.o obj-$(CONFIG_X86_CPU_RESCTRL) +=3D ctrlmondata.o -obj-$(CONFIG_X86_CPU_RESCTRL_INTEL_AET) +=3D intel_aet.o +obj-$(CONFIG_X86_CPU_RESCTRL) +=3D intel_aet.o obj-$(CONFIG_RESCTRL_FS_PSEUDO_LOCK) +=3D pseudo_lock.o =20 # To allow define_trace.h's recursive include: --=20 2.53.0 From nobody Tue Jun 16 19:33:09 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 47F7B42317A for ; Wed, 29 Apr 2026 18:49:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488570; cv=none; b=eO55rJehOrMjp8HmqkIxKKybsqotCMNOwzblMylrtSr8I1EkRYgCMmsuHo8el/pk0iKgqkETAhuM8YmiXzQ2xL5AJoX2Bgb9aGZ1FJCHKqpTYOIjzln76eXUZrcQ4QadyMlO0KnZE242s7EAF6wtgtdd4erMU5VEQI1Pp/+4mAw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777488570; c=relaxed/simple; bh=c/VrSfeRyK2BcOQRuAeB5sHUimURnt5DR1Uti5gcW34=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fAdA3FWPPtVPbPTFdZVOaStXm7CoHvCM8lMhjxE+a0up+QGxFxllBncww4LFRkfKDgBGZnaJwJXDsNtpPC/UuD305v32WYmnvRjcWlLEp5Vs/cjPLXpBd0XRjXAV7FHLv+QrWVUV3394GX1upDes4/ukcR+1KXlaa/9KHau3IAI= 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=PHTHWIC8; arc=none smtp.client-ip=198.175.65.12 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="PHTHWIC8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1777488567; x=1809024567; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=c/VrSfeRyK2BcOQRuAeB5sHUimURnt5DR1Uti5gcW34=; b=PHTHWIC8JxSd/JrBGYdHCRJVmDH9ZxdWt35xPfDi50HxeycqBLyd4ghz /9GCqQM8l1ldbtn1G9xKd4363WyI6M4iL/7ClWs9KOFM22DIs0JCZumcb xuJPj/rTsoI1gXFxsmCfA+eVfJETk7NaOM4gBiMpC6/lmC0EEIfjNVJSn bLBdMf60ppJKHzoikP7tUhiKGky7FAUHHSO5NXsE8xgjdWXqHO/yQ0Cv9 MQRSl67npEayLbQpSoetsL6QtF5d0gSxuvjyxpe60l1F3nGMTUCueAPO+ nAI6J/PDcVT4l0T0h+HgZL5hdusNZl7n48mmchHIaiiYtPyeGWamnMYJI w==; X-CSE-ConnectionGUID: xWP5stujTzqj2nzPSMrTpw== X-CSE-MsgGUID: ui1yJ7SfRbaZQouvnLftBg== X-IronPort-AV: E=McAfee;i="6800,10657,11771"; a="89890776" X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="89890776" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:10 -0700 X-CSE-ConnectionGUID: MhSFXGywQWy7d0AZLeImiA== X-CSE-MsgGUID: w+v6jscRQma4D0+WlIqQEA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,206,1770624000"; d="scan'208";a="238323053" Received: from mjruhl-desk.amr.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.222.13]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2026 11:49:09 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu , David E Box , x86@kernel.org Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v6 10/10] Documentation/filesystems/resctrl: Add footnote for telemetry fstab mount caveat Date: Wed, 29 Apr 2026 11:48:58 -0700 Message-ID: <20260429184858.36423-11-tony.luck@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260429184858.36423-1-tony.luck@intel.com> References: <20260429184858.36423-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" Add a footnote to the 'If telemetry monitoring is enabled' sentence noting that because PMT driver enumerates telemetry features asynchronously, an automatic mount of resctrl from /etc/fstab at boot may occur before those features are available, resulting in them not being enabled. Assisted-by: Claude:Sonnet_4.6 Signed-off-by: Tony Luck --- Documentation/filesystems/resctrl.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesyst= ems/resctrl.rst index b003bed339fd..4e62b8c5e0d6 100644 --- a/Documentation/filesystems/resctrl.rst +++ b/Documentation/filesystems/resctrl.rst @@ -620,7 +620,7 @@ When monitoring is enabled all MON groups will also con= tain: each instance of an L3 cache. Each directory contains files for the enabl= ed L3 events (e.g. "llc_occupancy", "mbm_total_bytes", and "mbm_local_bytes"= ). =20 - If telemetry monitoring is enabled, there will be a "mon_PERF_PKG_YY" + If telemetry monitoring is enabled [#]_, there will be a "mon_PERF_PKG_YY" directory for each physical processor package. Each directory contains files for the enabled telemetry events (e.g. "core_energy". "activity", "uops_retired", etc.) @@ -659,6 +659,11 @@ When monitoring is enabled all MON groups will also co= ntain: returned if the MBM event does not have an assigned counter in the CTRL_MON group nor in any of its associated MON groups. =20 +.. [#] Telemetry features are enumerated asynchronously by the PMT driver.= If + resctrl is automatically mounted from ``/etc/fstab`` at boot, the telem= etry + features may not yet be available at mount time and will therefore not = be + enabled. + "mon_hw_id": Available only with debug option. The identifier used by hardware for the monitor group. On x86 this is the RMID. --=20 2.53.0