Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Horgan <ben.horgan@arm.com>
To: Fenghua Yu <fenghuay@nvidia.com>
Cc: amitsinght@marvell.com, baisheng.gao@unisoc.com,
	baolin.wang@linux.alibaba.com, carl@os.amperecomputing.com,
	dave.martin@arm.com, david@kernel.org, dfustini@baylibre.com,
	gshan@redhat.com, james.morse@arm.com, jic23@kernel.org,
	kobak@nvidia.com, lcherian@marvell.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, peternewman@google.com,
	punit.agrawal@oss.qualcomm.com, quic_jiles@quicinc.com,
	reinette.chatre@intel.com, rohit.mathew@arm.com,
	scott@os.amperecomputing.com, sdonthineni@nvidia.com,
	tan.shaopeng@fujitsu.com, xhao@linux.alibaba.com,
	zengheng4@huawei.com, x86@kernel.org,
	Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>,
	Jonathan Cameron <jonathan.cameron@huawei.com>
Subject: Re: [PATCH v4 1/5] arm_mpam: resctrl: Pick classes for use as MBM counters
Date: Fri, 3 Jul 2026 15:01:30 +0100	[thread overview]
Message-ID: <b8159f62-51a0-4c67-8058-65109d21b3cb@arm.com> (raw)
In-Reply-To: <887e73b3-a3ec-419e-9583-6a2c288106f2@nvidia.com>

Hi Fenghua,

On 7/2/26 17:30, Fenghua Yu wrote:
> Hi, Ben,
> 
> On 5/20/26 14:24, Ben Horgan wrote:
>> From: James Morse <james.morse@arm.com>
>>
>> resctrl has two types of bandwidth counters, NUMA-local and global. MPAM
>> can only count globally; either using MSC at the L3 cache or in the
>> memory
>> controllers. When global and local equate to the same thing continue just
>> to call it global.
>>
>> Pick the corresponding MPAM classes to back the MBM counters. As resctrl
>> requires all monitors to be at the L3 cache, we can only use the counters
>> at the memory controllers when they have the same topology as the L3
>> cache
>> and the traffic they see if the same. In particular, for the bandwidth
>> counters at the memory controllers to be exposed to resctrl it is
>> required
>> there is a single L3 cache and a single NUMA node as otherwise cross NUMA
>> traffic will be counted at the wrong instance.
>>
>> Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
>> Tested-by: Zeng Heng <zengheng4@huawei.com>
>> Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
>> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
>> Signed-off-by: James Morse <james.morse@arm.com>
>> Signed-off-by: Ben Horgan <ben.horgan@arm.com>
>> ---
>> Changes since rfc v1:
>> Move finding any_mon_comp into monitor boilerplate patch
>> Move mpam_resctrl_get_domain_from_cpu() into monitor boilerplate
>> Remove free running check
>> Trim commit message
>>
>> Changes since v3:
>> Extra paragraph in commit message
>> ---
>>   drivers/resctrl/mpam_resctrl.c | 26 ++++++++++++++++++++++++++
>>   1 file changed, 26 insertions(+)
>>
>> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/
>> mpam_resctrl.c
>> index 226ff6f532fa..f70fa65d39e4 100644
>> --- a/drivers/resctrl/mpam_resctrl.c
>> +++ b/drivers/resctrl/mpam_resctrl.c
>> @@ -606,6 +606,16 @@ static bool cache_has_usable_csu(struct
>> mpam_class *class)
>>       return true;
>>   }
>>   +static bool class_has_usable_mbwu(struct mpam_class *class)
>> +{
>> +    struct mpam_props *cprops = &class->props;
>> +
>> +    if (!mpam_has_feature(mpam_feat_msmon_mbwu, cprops))
>> +        return false;
>> +
>> +    return true;
>> +}
>> +
>>   /*
>>    * Calculate the worst-case percentage change from each implemented
>> step
>>    * in the control.
>> @@ -983,6 +993,22 @@ static void mpam_resctrl_pick_counters(void)
>>                   break;
>>               }
>>           }
>> +
>> +        if (class_has_usable_mbwu(class) &&
>> +            topology_matches_l3(class) &&
>> +            traffic_matches_l3(class)) {
>> +            pr_debug("class %u has usable MBWU, and matches L3
>> topology and traffic\n",
>> +                 class->level);
>> +
>> +            /*
>> +             * We can't distinguish traffic by destination so
>> +             * we don't know if it's staying on the same NUMA
> 
> This sentence makes me think counting only on mbm_total is a "software"
> limitation. In fact, it's a MPAM hardware feature (or limitation).
> 
> Maybe add a sentence like this to make it clear why mbm_total only comes
> from originally?
> 
> MPAM only provides one memory bandwidth usage value for each MSC that
> supports memory bandwidth usage . We can't distinguish traffic .."

How about "An MSC measures bandwidth for a path determined by it's
location in hardware."?

Thanks,

Ben

> 
>> +             * node. Hence, we can't calculate mbm_local except
>> +             * when we only have one L3 and it's equivalent to
>> +             * mbm_total and so always use mbm_total.
>> +             */
>> +            counter_update_class(QOS_L3_MBM_TOTAL_EVENT_ID, class);
>> +        }
>>       }
>>   }
>>   
> 
> Thanks.
> 
> -Fenghua



  reply	other threads:[~2026-07-03 14:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-20 21:24 [PATCH v4 0/5] arm_mpam: resctrl: Counter Assignment (ABMC) Ben Horgan
2026-05-20 21:24 ` [PATCH v4 1/5] arm_mpam: resctrl: Pick classes for use as MBM counters Ben Horgan
2026-07-02 16:30   ` Fenghua Yu
2026-07-03 14:01     ` Ben Horgan [this message]
2026-07-03 16:36       ` Fenghua Yu
2026-05-20 21:24 ` [PATCH v4 2/5] arm_mpam: resctrl: Pre-allocate assignable monitors Ben Horgan
2026-05-26  2:50   ` Koba Ko
2026-05-26  8:47     ` Ben Horgan
2026-07-03  5:30   ` Fenghua Yu
2026-05-20 21:24 ` [PATCH v4 3/5] arm_mpam: resctrl: Add resctrl_arch_config_cntr() for ABMC use Ben Horgan
2026-07-03  5:23   ` Fenghua Yu
2026-05-20 21:24 ` [PATCH v4 4/5] arm_mpam: resctrl: Add resctrl_arch_cntr_read() & resctrl_arch_reset_cntr() Ben Horgan
2026-07-03  5:35   ` Fenghua Yu
2026-05-20 21:24 ` [PATCH v4 5/5] arm64: mpam: Add memory bandwidth usage (MBWU) documentation Ben Horgan
2026-07-01 22:38   ` Reinette Chatre
2026-07-02  9:20     ` Ben Horgan
2026-07-02 14:46       ` Reinette Chatre
2026-07-02 14:58         ` Ben Horgan
2026-07-02 15:46           ` Fenghua Yu
2026-05-27  0:42 ` [PATCH v4 0/5] arm_mpam: resctrl: Counter Assignment (ABMC) Shaopeng Tan (Fujitsu)
2026-05-27 14:36   ` Ben Horgan
2026-07-03  5:38 ` Fenghua Yu

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=b8159f62-51a0-4c67-8058-65109d21b3cb@arm.com \
    --to=ben.horgan@arm.com \
    --cc=amitsinght@marvell.com \
    --cc=baisheng.gao@unisoc.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=carl@os.amperecomputing.com \
    --cc=dave.martin@arm.com \
    --cc=david@kernel.org \
    --cc=dfustini@baylibre.com \
    --cc=fenghuay@nvidia.com \
    --cc=gshan@redhat.com \
    --cc=james.morse@arm.com \
    --cc=jic23@kernel.org \
    --cc=jonathan.cameron@huawei.com \
    --cc=kobak@nvidia.com \
    --cc=lcherian@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peternewman@google.com \
    --cc=punit.agrawal@oss.qualcomm.com \
    --cc=quic_jiles@quicinc.com \
    --cc=reinette.chatre@intel.com \
    --cc=rohit.mathew@arm.com \
    --cc=scott@os.amperecomputing.com \
    --cc=sdonthineni@nvidia.com \
    --cc=tan.shaopeng@fujitsu.com \
    --cc=tan.shaopeng@jp.fujitsu.com \
    --cc=x86@kernel.org \
    --cc=xhao@linux.alibaba.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