mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yin Li <yin.li@oss.qualcomm.com>
To: Ben Horgan <ben.horgan@arm.com>,
	"ping.li" <leeonion.muyu@gmail.com>,
	james.morse@arm.com
Cc: linux-kernel@vger.kernel.org, reinette.chatre@intel.com,
	fenghuay@nvidia.com, Andre Przywara <andre.przywara@arm.com>
Subject: Re: [PATCH v2] arm_mpam: Only schedule mpam_enable work after first successful MSC probe
Date: Thu, 17 Sep 2026 17:19:46 +0800	[thread overview]
Message-ID: <5f3f2dba-17c0-49e6-a0cc-df92436d26e7@oss.qualcomm.com> (raw)
In-Reply-To: <558c0816-604a-49b6-8843-66ea5df28d3e@arm.com>



On 9/10/2026 5:25 PM, Ben Horgan wrote:
> Hi Ping,
> 
> On 08/09/2026 03:48, ping.li wrote:
>> From: Ping Li <leeonion.muyu@gmail.com>
>>
>> mpam_discovery_cpu_online() sets new_device_probed unconditionally after
>> processing each reachable MSC. Once an MSC has already been probed
>> (msc->probed is true), later CPUs sharing it skip
>> mpam_msc_hw_probe() but still leave err at its default value of 0.
>> As a result, new_device_probed is still set to true, causing
>> mpam_enable_work to be scheduled again even though no new hardware was
>> probed.
> 
> This patch is an improvement but, thinking again, it looks there is scope getting rid of
> mpam_enable() altogether. Rather than walking the list after each hw probe we could increment an
> atomic variable, similar to what is done in mpam_msc_drv_probe(), and then just schedule
> mpam_enable_once(). What do you think?
> 

Hi Ben,

Seeing another atomic-counter based sequencing mechanism in this patch 
reminded me of a similar issue I explored while working on MPAM DT support.

At the time, I experimented with removing the fw_num_msc pre-counting 
logic and moving the discovery callback registration to a 
late_initcall() stage. The motivation was to avoid separate DT/ACPI 
counting paths and allow discovery to proceed based on successfully 
probed MSCs.

However, I eventually dropped that approach because it relied on 
synchronous probing and would not behave correctly in deferred-probe or 
future asynchronous-probe scenarios.

That made me curious about the motivation behind this change:
   - Is MPAM intentionally designed around the assumption that all 
firmware-described MSCs must probe successfully before discovery can 
proceed?
   - Is the count-and-compare model primarily retained to guarantee 
correct ordering under deferred/asynchronous probing?

I'm not suggesting changing the implementation, just interested in 
understanding the design rationale.

Thanks,
Yin


> Thanks,
> 
> Ben
> 
>>
>> Set new_device_probed only when mpam_msc_hw_probe() is called and
>> succeeds.
>>
>> Signed-off-by: Ping Li <leeonion.muyu@gmail.com>
>> ---
>> Changes in v2:
>> - Drop the Fixes: tag, as the extra mpam_enable() calls cause no real
>>    harm: schedule_work() merges the duplicate work, and mpam_enable()
>>    is a no-op until all MSCs have been probed. This is a cleanup, not a
>>    bug fix.
>>
>>   drivers/resctrl/mpam_devices.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
>> index 2f09f4b78bd3..fefdcf588932 100644
>> --- a/drivers/resctrl/mpam_devices.c
>> +++ b/drivers/resctrl/mpam_devices.c
>> @@ -1866,13 +1866,15 @@ static int mpam_discovery_cpu_online(unsigned int cpu)
>>   			continue;
>>   
>>   		mutex_lock(&msc->probe_lock);
>> -		if (!msc->probed)
>> +		if (!msc->probed) {
>>   			err = mpam_msc_hw_probe(msc);
>> +			if (!err)
>> +				new_device_probed = true;
>> +		}
>>   		mutex_unlock(&msc->probe_lock);
>>   
>>   		if (err)
>>   			break;
>> -		new_device_probed = true;
>>   	}
>>   
>>   	if (new_device_probed && !err)
> 

-- 
Thx and BRs,
Yin


  reply	other threads:[~2026-09-17  9:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 13:06 [PATCH] " ping.li
2026-09-08  2:48 ` [PATCH v2] " ping.li
2026-09-10  9:25   ` Ben Horgan
2026-09-17  9:19     ` Yin Li [this message]
2026-09-15  3:18   ` [PATCH v3] arm_mpam: Use an atomic counter to schedule mpam_enable_once() Ping Li
2026-09-15  9:48     ` Ben Horgan
2026-09-15 11:56     ` [PATCH v4] " Ping Li

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=5f3f2dba-17c0-49e6-a0cc-df92436d26e7@oss.qualcomm.com \
    --to=yin.li@oss.qualcomm.com \
    --cc=andre.przywara@arm.com \
    --cc=ben.horgan@arm.com \
    --cc=fenghuay@nvidia.com \
    --cc=james.morse@arm.com \
    --cc=leeonion.muyu@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reinette.chatre@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®