mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ben Horgan <ben.horgan@arm.com>
To: Jinjie Ruan <ruanjinjie@huawei.com>,
	james.morse@arm.com, reinette.chatre@intel.com,
	fenghuay@nvidia.com, jic23@kernel.org, zengheng4@huawei.com,
	tan.shaopeng@jp.fujitsu.com, gshan@redhat.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 1/3] arm_mpam: resctrl: Leave CDP off when there are too few PARTIDs
Date: Thu, 3 Dec 2026 17:03:26 +0000	[thread overview]
Message-ID: <eafea8c3-589a-444d-9a2f-24a882456fb7@arm.com> (raw)
In-Reply-To: <20261118113532.638039-2-ruanjinjie@huawei.com>

Hi Jinjie,

On 18/11/2026 11:35, Jinjie Ruan wrote:
> Enabling CDP requires at least 2 PARTIDs. If there are too few PARTIDs,
> resctrl_arch_set_cdp_enabled() returns -EINVAL, but only after it has
> recorded CDP as enabled, halved the monitor count and turned off the
> mbw_max MBA control. resctrl then believes CDP is off, which leaves the
> two sides out of step and the halved monitor count and the missing MBA
> control are not undone.
> 
> Check the PARTID limit before anything is changed so a failed enable has
> no effect.
> 
> Fixes: 6789fb99282c ("arm_mpam: resctrl: Add CDP emulation")
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> Reviewed-by: Gavin Shan <gshan@redhat.com>
> Cc: <stable@vger.kernel.org>

CDP is under CONFIG_EXPERT at the moment so no need for Cc stable.

Thanks,

Ben

> ---
> v5:
> - Add Reviewed-by.
> - Remove the unnecessary stable version.
> ---
>  drivers/resctrl/mpam_resctrl.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
> index 5468367776e2..aa3b3a093857 100644
> --- a/drivers/resctrl/mpam_resctrl.c
> +++ b/drivers/resctrl/mpam_resctrl.c
> @@ -210,6 +210,9 @@ int resctrl_arch_set_cdp_enabled(enum resctrl_res_level rid, bool enable)
>  	if (enable)
>  		pr_warn("CDP is an expert feature and may cause MPAM to malfunction.\n");
>  
> +	if (enable && mpam_partid_max < 1)
> +		return -EINVAL;
> +
>  	/*
>  	 * resctrl_arch_set_cdp_enabled() is only called with enable set to
>  	 * false on error and unmount.
> @@ -239,9 +242,6 @@ int resctrl_arch_set_cdp_enabled(enum resctrl_res_level rid, bool enable)
>  		mpam_resctrl_controls[RDT_RESOURCE_MBA].resctrl_res.alloc_capable = true;
>  
>  	if (enable) {
> -		if (mpam_partid_max < 1)
> -			return -EINVAL;
> -
>  		partid_d = resctrl_get_config_index(RESCTRL_RESERVED_CLOSID, CDP_DATA);
>  		partid_i = resctrl_get_config_index(RESCTRL_RESERVED_CLOSID, CDP_CODE);
>  	}


  reply	other threads:[~2026-12-03 17:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 11:35 [PATCH v5 0/3] arm_mpam: resctrl: Fix several CDP bugs Jinjie Ruan
2026-11-18 11:35 ` [PATCH v5 1/3] arm_mpam: resctrl: Leave CDP off when there are too few PARTIDs Jinjie Ruan
2026-12-03 17:03   ` Ben Horgan [this message]
2026-11-18 11:35 ` [PATCH v5 2/3] arm_mpam: resctrl: Only enable CDP on a resource that supports it Jinjie Ruan
2026-11-18 11:35 ` [PATCH v5 3/3] arm_mpam: resctrl: Limit num_rmids to the CLOSIDs in use Jinjie Ruan

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=eafea8c3-589a-444d-9a2f-24a882456fb7@arm.com \
    --to=ben.horgan@arm.com \
    --cc=fenghuay@nvidia.com \
    --cc=gshan@redhat.com \
    --cc=james.morse@arm.com \
    --cc=jic23@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=ruanjinjie@huawei.com \
    --cc=tan.shaopeng@jp.fujitsu.com \
    --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®