From: Reinette Chatre <reinette.chatre@intel.com>
To: Tony Luck <tony.luck@intel.com>, Fenghua Yu <fenghuay@nvidia.com>,
"Maciej Wieczor-Retman" <maciej.wieczor-retman@intel.com>,
Peter Newman <peternewman@google.com>,
James Morse <james.morse@arm.com>,
Babu Moger <babu.moger@amd.com>,
Drew Fustini <dfustini@baylibre.com>,
Dave Martin <Dave.Martin@arm.com>, Chen Yu <yu.c.chen@intel.com>,
David E Box <david.e.box@intel.com>, <x86@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>,
<linux-kernel@vger.kernel.org>, <patches@lists.linux.dev>
Subject: Re: [PATCH v10 07/17] arm,x86,fs/resctrl: Handle change in number of RMIDs on each mount
Date: Mon, 17 Aug 2026 17:56:00 -0700 [thread overview]
Message-ID: <aa16a09a-d12d-44b1-b00e-16bf4c5d1ae1@intel.com> (raw)
In-Reply-To: <20260729172752.11561-8-tony.luck@intel.com>
Hi Tony,
On 7/29/26 10:27 AM, Tony Luck wrote:
> Application Energy Telemetry (AET) event enumeration takes place
> asynchronously. Linux builds the pmt_telemetry module into the kernel to
> kick off 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.
>
> For simplicity, calculate the maximum possible number of RMIDs and use
> that value to allocate the rmid_ptrs[] array just once. Use this same
> calculated value for all references to rmid_ptrs[] instead of calling
> resctrl_arch_system_max_rmid_idx() in multiple places.
>
> Also use this maximum RMID value when allocating
> rdt_l3_mon_domain::rmid_busy_llc bitmap and rdt_l3_mon_domain::mbm_states.
ok, but why? I have the same comment as v9 about this and I still do not see
why resctrl fs need to allocate the L3 monitoring state for "maximum RMID"
when this is unique to L3 monitoring with its own limits. There can never be
more state used than what L3 monitoring support so why not limit the state to
that instead of using the system wide maximum?
Looking back at v9 the motivation is that "this works for x86" which causes
resctrl fs to obfuscate its implementation on x86 behavior without consideration
how it impacts other architectures.
resctrl fs already supports a per-resource resctrl_arch_get_num_closid(). Could
resctrl add a, for example, per-resource resctrl_arch_get_num_rmid_idx()?
If that was already available, would this patch not have used it instead of
using the system max?
>
> The limbo code must deal with changes in the number of RMIDs from one
> mount to the next because some RMIDs may still be "busy" when the file
> system is unmounted, but be above resctrl_arch_system_num_rmid_idx()
> for the remount. In this case RMIDs that can be released are not put
> onto the rmid_free_lru list.
>
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> ---
...
> 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);
> }
>
> +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 d7ad976ed503..2a1d2ee2b91d 100644
> --- a/fs/resctrl/monitor.c
> +++ b/fs/resctrl/monitor.c
> @@ -75,6 +75,11 @@ static unsigned int rmid_limbo_count;
> */
> static struct rmid_entry *rmid_ptrs;
>
> +/*
> + * @max_idx_limit - The number of elements allocated in *rmid_ptrs.
To be more specific, could this instead be: "The number of elements in rmid_ptrs[]."?
> + */
> +static u32 max_idx_limit;
> +
> /*
> * This is the threshold cache occupancy in bytes at which we will consider an
> * RMID available for re-allocation.
> @@ -115,10 +120,18 @@ static inline struct rmid_entry *__rmid_entry(u32 idx)
>
> static void limbo_release_entry(struct rmid_entry *entry)
> {
> + u32 cur_idx_limit = resctrl_arch_system_num_rmid_idx();
> +
> lockdep_assert_held(&rdtgroup_mutex);
>
> 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) < cur_idx_limit)
> + list_add_tail(&entry->list, &rmid_free_lru);
>
> if (IS_ENABLED(CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID))
> closid_num_dirty_rmid[entry->closid]--;
> @@ -133,7 +146,6 @@ static void limbo_release_entry(struct rmid_entry *entry)
> void __check_limbo(struct rdt_l3_mon_domain *d, bool force_free)
> {
> struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
> - u32 idx_limit = resctrl_arch_system_num_rmid_idx();
> struct rmid_entry *entry;
> bool rmid_dirty = true;
> u32 idx, cur_idx = 1;
> @@ -156,8 +168,12 @@ void __check_limbo(struct rdt_l3_mon_domain *d, bool force_free)
> * RMID and move it to the free list when the counter reaches 0.
> */
> for (;;) {
> - idx = find_next_bit(d->rmid_busy_llc, idx_limit, cur_idx);
> - if (idx >= idx_limit)
> + /*
> + * Need to check all possible RMIDs, not just the range
> + * available in this mount cycle.
> + */
This just documents what can be seen from the code. Would be more helpful to have
comment describe *why* it is possible for an RMID different from the available range
to be busy.
> + idx = find_next_bit(d->rmid_busy_llc, max_idx_limit, cur_idx);
> + if (idx >= max_idx_limit)
> break;
>
> entry = __rmid_entry(idx);
Reinette
next prev parent reply other threads:[~2026-08-18 0:56 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 17:27 [PATCH v10 00/17] Allow AET to use PMT as loadable module Tony Luck
2026-07-29 17:27 ` [PATCH v10 01/17] x86/resctrl: Fix enumeration of number of supported RMIDs Tony Luck
2026-08-13 23:55 ` Reinette Chatre
2026-08-14 16:28 ` Luck, Tony
2026-07-29 17:27 ` [PATCH v10 02/17] x86/resctrl: Require 64-bit x86 for resctrl support Tony Luck
2026-08-18 0:50 ` Reinette Chatre
2026-07-29 17:27 ` [PATCH v10 03/17] fs/resctrl: Remove redundant calls to resctrl_arch_mon_capable() Tony Luck
2026-08-18 0:50 ` Reinette Chatre
2026-07-29 17:27 ` [PATCH v10 04/17] x86/resctrl: Honor rdt=perf option to force enable AET perf events Tony Luck
2026-08-18 0:51 ` Reinette Chatre
2026-07-29 17:27 ` [PATCH v10 05/17] fs/resctrl: Add interface to disable a monitor event Tony Luck
2026-08-18 0:51 ` Reinette Chatre
2026-07-29 17:27 ` [PATCH v10 06/17] x86/resctrl: Drop global 'rdt_mon_capable' flag Tony Luck
2026-08-18 0:54 ` Reinette Chatre
2026-07-29 17:27 ` [PATCH v10 07/17] arm,x86,fs/resctrl: Handle change in number of RMIDs on each mount Tony Luck
2026-08-18 0:56 ` Reinette Chatre [this message]
2026-07-29 17:27 ` [PATCH v10 08/17] x86/resctrl: Enforce system RMID limit on AET event groups Tony Luck
2026-08-18 0:58 ` Reinette Chatre
2026-07-29 17:27 ` [PATCH v10 09/17] x86/resctrl: Add PMT registration API for AET enumeration callbacks Tony Luck
2026-08-18 0:59 ` Reinette Chatre
2026-07-29 17:27 ` [PATCH v10 10/17] platform/x86/intel/pmt: Register enumeration functions with resctrl Tony Luck
2026-07-29 17:27 ` [PATCH v10 11/17] arm,x86/resctrl: Resolve INTEL_PMT_TELEMETRY symbols at runtime Tony Luck
2026-08-18 0:59 ` Reinette Chatre
2026-07-29 17:27 ` [PATCH v10 12/17] x86/resctrl: Prepare to handle nested mount requests Tony Luck
2026-08-18 1:01 ` Reinette Chatre
2026-07-29 17:27 ` [PATCH v10 13/17] fs/resctrl: Call architecture hooks for every mount/unmount Tony Luck
2026-08-18 1:02 ` Reinette Chatre
2026-07-29 17:27 ` [PATCH v10 14/17] x86/resctrl: Export interface to report telemetry unbind/remove Tony Luck
2026-07-29 17:27 ` [PATCH v10 15/17] platform/x86/intel/pmt: Inform resctrl when MMIO maps are being removed Tony Luck
2026-07-29 17:27 ` [PATCH v10 16/17] x86/resctrl: Simplify Kconfig options for resctrl Tony Luck
2026-07-29 17:27 ` [PATCH v10 17/17] Documentation/filesystems/resctrl: Document telemetry mount timing caveat Tony Luck
2026-07-29 20:11 ` [PATCH v10 00/17] Allow AET to use PMT as loadable module Luck, Tony
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aa16a09a-d12d-44b1-b00e-16bf4c5d1ae1@intel.com \
--to=reinette.chatre@intel.com \
--cc=Dave.Martin@arm.com \
--cc=babu.moger@amd.com \
--cc=david.e.box@intel.com \
--cc=dfustini@baylibre.com \
--cc=fenghuay@nvidia.com \
--cc=hch@infradead.org \
--cc=james.morse@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.wieczor-retman@intel.com \
--cc=patches@lists.linux.dev \
--cc=peternewman@google.com \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
--cc=yu.c.chen@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®