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>, <corbet@lwn.net>,
	<skhan@linuxfoundation.org>, <rdunlap@infradead.org>,
	<tglx@kernel.org>, <mingo@redhat.com>, <bp@alien8.de>,
	<dave.hansen@linux.intel.com>, <hpa@zytor.com>,
	<ben.horgan@arm.com>, <fenghuay@nvidia.com>,
	<tan.shaopeng@fujitsu.com>, <will@kernel.org>, <gshan@redhat.com>,
	<zengheng4@huawei.com>, <jic23@kernel.org>, <x86@kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-doc@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v5 RESEND 3/7] fs/resctrl: Clear the CDP state after the cleanup
Date: Wed, 11 Nov 2026 10:27:33 -0800	[thread overview]
Message-ID: <ad702ee1-ef91-412a-99ad-e425325e21a4@intel.com> (raw)
In-Reply-To: <20261110133938.3768632-4-ruanjinjie@huawei.com>

Hi Jinjie,

On 11/10/26 5:39 AM, Jinjie Ruan wrote:
> On MPAM a CLOSID is translated into the PARTIDs that the hardware
> configuration uses. Without CDP, CLOSID c is PARTID c; with CDP it is
> PARTIDs 2c and 2c+1. resctrl_unmount() clears the CDP state with
> rdt_disable_ctx() before resctrl_fs_teardown() removes the groups, so
> the teardown translates the CLOSIDs differently from when the groups
> were set up.

This behavior is not unique to MPAM. Above makes this sound like
architecture specific behavior that makes one wonder why this needs
to be fixed in resctrl filesystem

> 
> For example, rdtgroup_unassign_cntrs() unassigns and resets the MBM
> counters of each group through resctrl_arch_config_cntr(). On MPAM that
> helper maps a counter to a monitor with the index
> resctrl_get_config_index() returns for the CDP state. A counter assigned

Please take care not to narrate the code. Instead just describe the flow
on a high level to help understand the change without needing reader to
refer to the code much.

> while CDP was enabled is mapped to the monitor for PARTIDs 2c and 2c+1.
> With CDP cleared, MPAM removes the mapping of PARTID c and resets the
> monitor for PARTID c instead, so the mappings of PARTIDs 2c and 2c+1 are
> left behind. The helper had an empty body on MPAM until the ABMC support
> implemented it, which is when the teardown started to program the
> mapping with the cleared state.
> 
> Clear the CDP state after resctrl_fs_teardown(), so the teardown runs
> with the CDP state the configuration was created under.
> 
> x86 is not affected as its RMIDs and counters do not depend on the
> CLOSID.

I think x86 is lucky here to not have encountered this issue and this fix
applies to it just as much, adding to motivation for this needing to be
included in the filesystem. Below is an example of a changelog that aims
to capture all the comments, you need not use verbatim and are welcome to
improve (and please correct) it:

	To support CDP, resctrl halves the number of CLOSIDs available to
	resource groups and gives each remaining CLOSID two hardware
	configurations instead of one, distinguished by index: 2 * CLOSID for
	data and 2 * CLOSID + 1 for code. Without CDP a CLOSID has a single
	configuration, at index CLOSID. Every architecture computes these
	indices the same way.

	Unmounting clears the CDP state before it undoes what the groups were
	given, so the cleanup computes index CLOSID where the group was set up
	with 2 * CLOSID and 2 * CLOSID + 1. The group's two configurations are
	left in place and index CLOSID is cleared instead, which with CDP
	enabled is a configuration of a different CLOSID. The architecture may
	keep this state for as long as the resource exists.

	Only MPAM can reach this today. Of everything the cleanup has to undo,
	MPAM addresses only the MBM counter assignment by the translated CLOSID,
	and it only began doing so when it implemented assignable counters. x86
	addresses its counters by RMID alone.

	Clear the CDP state after the cleanup, so that the cleanup runs with the
	CDP state the groups were set up under.

> 
> Fixes: 6e0e538a75ce ("arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use")
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> Cc: <stable@vger.kernel.org> # 7.3+

Looks like 6e0e538a75ce landed in 7.3 so the stable constraint looks unnecessary?

> ---
Patch looks good to me.

Thank you very much.

Reinette


  reply	other threads:[~2026-11-11 18:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 13:39 [PATCH v5 RESEND 0/7] fs/resctrl: Fix some resctl bugs related to mpam Jinjie Ruan
2026-11-10 13:39 ` [PATCH v5 RESEND 1/7] fs/resctrl: Report a temporary RMID shortage per CLOSID Jinjie Ruan
2026-11-10 13:39 ` [PATCH v5 RESEND 2/7] fs/resctrl: Do not allocate a monitor context when releasing limbo RMIDs Jinjie Ruan
2026-11-10 13:39 ` [PATCH v5 RESEND 3/7] fs/resctrl: Clear the CDP state after the cleanup Jinjie Ruan
2026-11-11 18:27   ` Reinette Chatre [this message]
2026-11-10 13:39 ` [PATCH v5 RESEND 4/7] fs/resctrl: Stop the limbo handler while resctrl is unmounted Jinjie Ruan
2026-11-11 18:26   ` Reinette Chatre
2026-11-10 13:39 ` [PATCH v5 RESEND 5/7] fs/resctrl: Release the limbo RMIDs when the CDP state changes Jinjie Ruan
2026-11-11 18:33   ` Reinette Chatre
2026-11-10 13:39 ` [PATCH v5 RESEND 6/7] fs/resctrl: Disallow monitor group move when the RMID index changes Jinjie Ruan
2026-11-11 18:33   ` Reinette Chatre
2026-11-10 13:39 ` [PATCH v5 RESEND 7/7] fs/resctrl: Add info/moveable_mon_group Jinjie Ruan
2026-11-11 18:34   ` Reinette Chatre

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=ad702ee1-ef91-412a-99ad-e425325e21a4@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=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=fenghuay@nvidia.com \
    --cc=gshan@redhat.com \
    --cc=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --cc=jic23@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=ruanjinjie@huawei.com \
    --cc=skhan@linuxfoundation.org \
    --cc=tan.shaopeng@fujitsu.com \
    --cc=tglx@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=will@kernel.org \
    --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®