From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6816620FA81 for ; Fri, 3 Jul 2026 14:01:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783087299; cv=none; b=ePBP+1ewyooluT3WisekPb8qrn+qWNxjv+tTm4MATn55Nvv+67Eo3kwH9JRX7JcUgk2y7Pvf87CNZEo8Qipg4dwakcSMKOrZob9uKw6SVTKKQ0OZvibMVr7JeAZUJN3u5doNT29/UA6fcRMD9fbIllGXSjMx87NBMwe3QTPHhwo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783087299; c=relaxed/simple; bh=zQ2saK3N8tjQXvyqm147W7lK2i3tH/yyPXIdgCx7ieI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=OWLJCCHjfuXM7AqLrxe2AmgdrCS48ell19KP1o62I0boZhPNCSw+WTBrNQhhAprgBbg0YdqyRoEdW711yqHjPxxrMJQLkhI0wBeyMH2xEWJpyslFqW0ePRIGNIZjymEMAruoze+epXJu5Jfue+iKBUlQrRBW5PKQXzL2eGgsPnI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=tUR639/m; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="tUR639/m" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6D646463D; Fri, 3 Jul 2026 07:01:33 -0700 (PDT) Received: from [10.211.55.3] (unknown [10.57.73.238]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 779203F85F; Fri, 3 Jul 2026 07:01:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1783087297; bh=zQ2saK3N8tjQXvyqm147W7lK2i3tH/yyPXIdgCx7ieI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=tUR639/mZqB99L/R8p/+Ow8CUGRtFOhwwjyLrr6Hg+KpqIX6xs5SxN/32z9LegT6t R/RdgLeSyo1ulNknDTjUZLJSrvfuv9+x+LI9uXpbS7aXj1c4ZARoIrQu9shRZGArzx NI6IkcEhuoZ5uJMyZ231a6+jhi/WUZ3Ol7mBckL0= Message-ID: Date: Fri, 3 Jul 2026 15:01:30 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Thunderbird Daily Subject: Re: [PATCH v4 1/5] arm_mpam: resctrl: Pick classes for use as MBM counters To: Fenghua Yu 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 , Jonathan Cameron References: <20260520212458.1797221-1-ben.horgan@arm.com> <20260520212458.1797221-2-ben.horgan@arm.com> <887e73b3-a3ec-419e-9583-6a2c288106f2@nvidia.com> Content-Language: en-US From: Ben Horgan In-Reply-To: <887e73b3-a3ec-419e-9583-6a2c288106f2@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 >> >> 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 >> Tested-by: Zeng Heng >> Reviewed-by: Shaopeng Tan >> Reviewed-by: Jonathan Cameron >> Signed-off-by: James Morse >> Signed-off-by: Ben Horgan >> --- >> 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