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>,
	tony.luck@intel.com, reinette.chatre@intel.com,
	Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com,
	tglx@kernel.org, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, hpa@zytor.com, fenghuay@nvidia.com,
	tan.shaopeng@fujitsu.com, zengheng4@huawei.com, jic23@kernel.org,
	gshan@redhat.com, catalin.marinas@arm.com, x86@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v10 RESEND 05/15] arm_mpam: Don't stall MPAM enable when an MSC fails to probe
Date: Mon, 26 Oct 2026 14:49:55 +0000	[thread overview]
Message-ID: <c0fe8907-81e2-4bde-a5a4-193209946583@arm.com> (raw)
In-Reply-To: <20261020134239.3921377-6-ruanjinjie@huawei.com>

Hi Jinjie,



On 20/10/2026 14:42, Jinjie Ruan wrote:
> mpam_msc_drv_probe() registers the discovery cpuhp callbacks only when
> the number of successfully probed MSCs reaches fw_num_msc. Every failure
> path returns before the counter is incremented, and a failed probe is
> final - the driver core does not retry. One failing MSC therefore leaves
> the counter below fw_num_msc forever: the discovery callbacks are never
> registered, mpam_enable() is never scheduled, and MPAM stays dead
> system-wide - the resctrl filesystem is never registered, and no error
> message hints at the cause.
> 
> An MSC can legitimately fail to probe on an otherwise working system:
> firmware may describe MSCs that are not accessible from any possible
> CPU, e.g. when the possible CPUs are restricted with nr_cpus=. The MSCs
> of the clipped CPUs then fail with "MSC is not accessible from any
> CPU!", or their cache resources become unresolvable from PPTT.

As the MPAM resources are system wide we need to query the support from each of the MSC to know what
resources will end up. I do appreciate that if you have full control of your system then you can
know this in advance but then you can also adjust your acpi tables to mark the non-accessible MSC as
disabled. As such, I don't think changes such as this should be in the driver. Here is a previous
explanation for a similar patch [1]

Thanks,

Ben

[1] https://lore.kernel.org/lkml/59c21340-4e3d-4c48-9d9f-c0f78a023bac@arm.com/

> 
> Count every completed probe, successful or not. Failed MSCs are not on
> mpam_all_msc (either never added, or removed by mpam_msc_drv_remove()),
> so the discovery path skips them naturally, and MPAM is enabled for the
> surviving devices.
> 
> Cc: stable@vger.kernel.org
> Cc: Ben Horgan <ben.horgan@arm.com>
> Cc: Reinette Chatre <reinette.chatre@intel.com>
> Cc: Fenghua Yu <fenghuay@nvidia.com>
> Cc: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Fixes: f04046f2577a5 ("arm_mpam: Add probe/remove for mpam msc driver and kbuild boiler plate")
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
>  drivers/resctrl/mpam_devices.c | 26 ++++++++++++++++++--------
>  1 file changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
> index 61cbc75625fa..a44d66a5733d 100644
> --- a/drivers/resctrl/mpam_devices.c
> +++ b/drivers/resctrl/mpam_devices.c
> @@ -2120,21 +2120,31 @@ static int mpam_msc_drv_probe(struct platform_device *pdev)
>  	msc = do_mpam_msc_drv_probe(pdev);
>  	mutex_unlock(&mpam_list_lock);
>  
> -	if (IS_ERR(msc))
> -		return PTR_ERR(msc);
> +	if (IS_ERR(msc)) {
> +		err = PTR_ERR(msc);
> +		goto out;
> +	}
>  
>  	/* Create RIS entries described by firmware */
>  	err = acpi_mpam_parse_resources(msc, plat_data);
> -	if (err) {
> +	if (err)
>  		mpam_msc_drv_remove(pdev);
> -		return err;
> -	}
> -
> -	if (atomic_add_return(1, &mpam_num_msc) == fw_num_msc)
> +out:
> +	/*
> +	 * A failed MSC must not prevent MPAM being enabled for the
> +	 * surviving devices. Firmware may describe MSCs that are not
> +	 * accessible from any possible CPU, e.g. when the possible CPUs
> +	 * were restricted by nr_cpus=. The failed device is not
> +	 * re-probed, so count it here too: otherwise the counter never
> +	 * reaches fw_num_msc, the discovery cpuhp callbacks are never
> +	 * registered and mpam_enable() is never scheduled - MPAM stays
> +	 * dead system-wide, without any error message.
> +	 */
> +	if (atomic_inc_return(&mpam_num_msc) == fw_num_msc)
>  		mpam_register_cpuhp_callbacks(mpam_discovery_cpu_online, NULL,
>  					      "mpam:drv_probe");
>  
> -	return 0;
> +	return err;
>  }
>  
>  static struct platform_driver mpam_msc_driver = {


  reply	other threads:[~2026-10-26 14:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20 13:42 [PATCH v10 RESEND 00/15] arm_mpam: Introduce Narrow-PARTID feature Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 01/15] fs/resctrl: Return -EBUSY when per-CLOSID RMIDs are in limbo Jinjie Ruan
2026-10-26 14:05   ` Ben Horgan
2026-10-20 13:42 ` [PATCH v10 RESEND 02/15] fs/resctrl: Skip monitor context allocation when force-freeing RMIDs Jinjie Ruan
2026-10-26 14:08   ` Ben Horgan
2026-10-26 14:11     ` Ben Horgan
2026-10-27  1:33       ` Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 03/15] arm_mpam: Fix error return in resctrl_arch_mon_ctx_alloc() Jinjie Ruan
2026-10-26 14:40   ` Ben Horgan
2026-10-27  1:25     ` Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 04/15] arm_mpam: Fix infinite PARTID reset loop when 65536 PARTIDs are supported Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 05/15] arm_mpam: Don't stall MPAM enable when an MSC fails to probe Jinjie Ruan
2026-10-26 14:49   ` Ben Horgan [this message]
2026-10-27  1:47     ` Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 06/15] fs/resctrl: Unmount resctrl with the CDP state it was mounted with Jinjie Ruan
2026-10-26 15:08   ` Ben Horgan
2026-10-20 13:42 ` [PATCH v10 RESEND 07/15] fs/resctrl: Add resctrl_arch_rmid_idx_match() helper Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 08/15] arm_mpam: resctrl: Add resctrl_closid_rmid_to_partid_pmg() helper Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 09/15] arm_mpam: Add a helper to check a PARTID is in a CLOSID Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 10/15] arm_mpam: Track the PARTID and internal PARTID limits per class Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 11/15] arm_mpam: Divide the PARTIDs between the control groups Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 12/15] arm_mpam: Map resctrl RMIDs onto the request PARTIDs Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 13/15] arm_mpam: Identify the non-aliasing controls Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 14/15] arm_mpam: Use the request PARTIDs beyond the internal range Jinjie Ruan
2026-10-20 13:42 ` [PATCH v10 RESEND 15/15] arm_mpam: resctrl: Add kunit tests for narrow PARTID helpers 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=c0fe8907-81e2-4bde-a5a4-193209946583@arm.com \
    --to=ben.horgan@arm.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --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-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=reinette.chatre@intel.com \
    --cc=ruanjinjie@huawei.com \
    --cc=tan.shaopeng@fujitsu.com \
    --cc=tglx@kernel.org \
    --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®