mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: Jinjie Ruan <ruanjinjie@huawei.com>, <tony.luck@intel.com>,
	<Dave.Martin@arm.com>, <james.morse@arm.com>,
	<babu.moger@amd.com>, <bp@alien8.de>, <tan.shaopeng@fujitsu.com>,
	<zengheng4@huawei.com>, <gshan@redhat.com>, <jic23@kernel.org>,
	<ben.horgan@arm.com>, <x86@kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 3/3] fs/resctrl: Unmount resctrl with the CDP state it was mounted with
Date: Mon, 9 Nov 2026 14:21:59 -0800	[thread overview]
Message-ID: <04f252d5-0dbc-49e2-9e05-8fce4a166648@intel.com> (raw)
In-Reply-To: <dc148861-35cc-4029-835e-2e93c8b64f05@huawei.com>

Hi Jinjie,

On 11/9/26 3:48 AM, Jinjie Ruan wrote:
> 在 2026/11/7 6:52, Reinette Chatre 写道:
>> On 11/4/26 11:09 PM, Jinjie Ruan wrote:

...

>>> diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
>>> index ae9ddd380515..717c3888c2b5 100644
>>> --- a/fs/resctrl/monitor.c
>>> +++ b/fs/resctrl/monitor.c
>>> @@ -70,6 +70,11 @@ static u32 *closid_num_dirty_rmid;
>>>   */
>>>  static unsigned int rmid_limbo_count;
>>>  
>>> +/*
>>> + * @limbo_cdp - The CDP state under which the RMIDs in limbo were freed.
>>> + */
>>> +static bool limbo_cdp;
>>
>> The variable is described as "The CDP state ..." but its type is a boolean.
>> What does "true" mean? Could this be renamed limbo_cdp_enabled?
>>
>> Looks like this is only set if CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID is set,
>> please mention that in the comments.
>>
>>> +
>>>  /*
>>>   * @rmid_entry - The entry in the limbo and free lists.
>>>   */
>>> @@ -852,6 +857,10 @@ void cqm_handle_limbo(struct work_struct *work)
>>>  	 */
>>>  	mutex_lock(&rdtgroup_mutex);
>>>  
>>> +	/* Don't read the RMIDs in limbo until a mount sets up the CDP state. */
>>> +	if (IS_ENABLED(CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID) && !resctrl_mounted)
>>> +		goto out_unlock;
>>> +
>>
>> Is this IS_ENABLED() check needed? There are several flows managing the limbo handler
>> yet just cqm_handle_limbo() and resctrl_limbo_resume() use this IS_ENABLED() check to manage
>> the lifecycle in a unique way that I am concerned will trip people up in the future when
>> trying to untangle the limbo worker lifecycle.
>>
>> I understand that the IS_ENABLED() check is added to support MPAM specifically here but
>> I think we should aim for as much as possible similar behavior across all architectures.
> 
> Yes, it is for mpam.
> 
>> To that end I do not see why limbo handler should not run on MPAM when resctrl fs is unmounted
>> while on x86 it should. 
> 
> Is it because the CDP implementation of x86 is different from MPAM, and
> MPAM is implemented through simulation?

In x86 the CLOSID and RMID are independent so on x86 the RMID (index) does not change between
CDP enabled and CDP disabled.

>> Having the limbo handler only depend on resctrl_mounted here will make the behavior consistent
>> across architectures while also matching the overflow handler. Keeping these behaviors similar
>> just makes the code easier to understand and reason about. Having resctrl filesystem provide
>> consistent flows across all architectures ensures the same flows are always tested.
>>
>> Yes, x86 would lose the ability to drain RMIDs across an unmount, but nothing needs these
>> RMIDs while resctrl is unmounted. This work ensures that the RMIDs are freed shortly
>> after a mount when they will be needed.
> 
> I believe this behavior is also universal for x86.

Right, without resctrl fs mounted there are no user requests for the monitoring data backed
by any architecture.

...

>>> +				release_limbo_rmids(d);
>>> +		}
>>> +	}
>>> +	limbo_cdp = cdp;
>>> +
>>> +	if (!resctrl_is_mon_event_enabled(QOS_L3_OCCUP_EVENT_ID))
>>> +		return;
>>
>> Could this be moved to the top of the function? QOS_L3_OCCUP_EVENT_ID
>> state cannot change between mounts and this is the event that determines
>> whether limbo handler runs at all. Moving this check would also eliminate the 
>> need for the "d->rmid_busy_llc" check above.
> 
> But limbo_cdp must be updated for next time check.

limbo_cdp (or limbo_cdp_enabled as per earlier comment) is only valid if
resctrl_is_mon_event_enabled(QOS_L3_OCCUP_EVENT_ID) *and*
IS_ENABLED(CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID). Since QOS_L3_OCCUP_EVENT_ID
state cannot change between mounts there is no need to ever update limbo_cdp
if QOS_L3_OCCUP_EVENT_ID is disabled, no?

Reinette

      reply	other threads:[~2026-11-09 22:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  7:09 [PATCH v4 0/3] fs/resctrl: Fix RMID limbo handling Jinjie Ruan
2026-11-05  7:09 ` [PATCH v4 1/3] fs/resctrl: Report a temporary RMID shortage per CLOSID Jinjie Ruan
2026-11-05 11:26   ` Ben Horgan
2026-11-05  7:09 ` [PATCH v4 2/3] fs/resctrl: Do not allocate a monitor context when releasing limbo RMIDs Jinjie Ruan
2026-11-05  7:09 ` [PATCH v4 3/3] fs/resctrl: Unmount resctrl with the CDP state it was mounted with Jinjie Ruan
2026-11-06 22:52   ` Reinette Chatre
2026-11-09 11:48     ` Jinjie Ruan
2026-11-09 22:21       ` Reinette Chatre [this message]

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=04f252d5-0dbc-49e2-9e05-8fce4a166648@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.com \
    --cc=bp@alien8.de \
    --cc=gshan@redhat.com \
    --cc=james.morse@arm.com \
    --cc=jic23@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ruanjinjie@huawei.com \
    --cc=tan.shaopeng@fujitsu.com \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    --cc=zengheng4@huawei.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®