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 82D483AB276 for ; Fri, 17 Jul 2026 09:18:45 +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=1784279927; cv=none; b=WdguOpIPCRFs/6ARO5G0svtrsmweWezB0ciihvdTGMR0eIj00ugUZgz9AblpXZenrA+mOkj5GkG8pw9nQSi+m/aBEmMi/fmVUh8VciNOdPvXrjvDrfppkxn74BAJIKd078faXt8FkZMNNRv8sonREOdCuMuEdCoU4s7a5B57uZY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784279927; c=relaxed/simple; bh=NZ11VQ2UlrkmmSssu1s3Q0lo6ANBbwBro9/3SM8FpC4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=okORxV8E0SsNwji3ESsD8HLlRX8Kvxze4cqi/IGqA929Elpy26jQtAzJFP8iWt1U8/9p7To6Zg1uGKkQLVu8kjHkK0fPt4BWupSrly+O3VYNAqQpLh8F/yzRaKfvY3Er5oMnAUXX9KOJGcE1i77mbSk7i0C8P72hWL7eoQSCU84= 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=NShuvMKB; 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="NShuvMKB" 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 69C8E1476; Fri, 17 Jul 2026 02:18:40 -0700 (PDT) Received: from [10.2.212.8] (e134344.arm.com [10.2.212.8]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BB4EE3F7B4; Fri, 17 Jul 2026 02:18:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1784279924; bh=NZ11VQ2UlrkmmSssu1s3Q0lo6ANBbwBro9/3SM8FpC4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=NShuvMKB8Kgx2lMNrQwzDeWMugkBLo0uhf8O9QnuvEGFCn7qcSGmHjlNlY3sLqo6s HbQoPxjyFzTJbUWUFrUXE03XUddERERT+I0HL7h5FSleyCNew/6Azux78/EOZCXlT4 KUHesVXwuQXQWftP9xmUXBETCitsaIcB90+g81Pk= Message-ID: Date: Fri, 17 Jul 2026 10:18:41 +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 15/23] arm_mpam: Refine L3 topology and class selection To: Fenghua Yu , Reinette Chatre , Tony Luck , James Morse , Dave Martin , Shaopeng Tan , Chen Yu , Babu Moger , Drew Fustini , Vikram Sethi , Shanker Donthineni , Newton Liu , Gavin Shan Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20260716210329.2914625-15-fenghuay@nvidia.com> Content-Language: en-US From: Ben Horgan In-Reply-To: <20260716210329.2914625-15-fenghuay@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Fenghua, On 7/16/26 22:03, Fenghua Yu wrote: > After enabling memory-level MSCs, the existing class-picking heuristics > still treat every candidate like an L3 cache MSC. That rejects valid > memory classes for MBWU counters and applies L3 egress checks to MBA > classes on CPU-less or system-wide affinities, leaving no monitor or > control class selected on affected platforms. > > Adjust the heuristics I think we have to live with what we've got. We don't want to change the resctrl monitor events or schemata files for existing platforms. so memory classes can back MBWU directly, L3 > topology matching is only required for level-3 MBA candidates, and > traffic matching is skipped when the class already spans all CPUs. I think we can keep the existing checks the same and if they match go with what we've got and if they don't then you can go ahead and use MBWU/MBA at NUMA scope when appropriate. > Also tolerate components with no online CPUs once at least one > component has matched. Ok, new support for unexposed features can be added but if we've already got support for something in the specific setup then we shouldn't change how it is exposed to the user. THanks, Ben > > Signed-off-by: Shanker Donthineni > Signed-off-by: Fenghua Yu > --- > drivers/resctrl/mpam_resctrl.c | 22 +++++++++++++++++----- > 1 file changed, 17 insertions(+), 5 deletions(-) > > diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c > index 953412f11995..86458a56a526 100644 > --- a/drivers/resctrl/mpam_resctrl.c > +++ b/drivers/resctrl/mpam_resctrl.c > @@ -854,10 +854,12 @@ static bool topology_matches_l3(struct mpam_class *victim) > { > int cpu, err; > struct mpam_component *victim_iter; > + bool matched_once = false; > > lockdep_assert_cpus_held(); > > cpumask_var_t __free(free_cpumask_var) tmp_cpumask = CPUMASK_VAR_NULL; > + > if (!alloc_cpumask_var(&tmp_cpumask, GFP_KERNEL)) > return false; > > @@ -871,8 +873,11 @@ static bool topology_matches_l3(struct mpam_class *victim) > } > > cpu = cpumask_any_and(&victim_iter->affinity, cpu_online_mask); > - if (WARN_ON_ONCE(cpu >= nr_cpu_ids)) > + if (WARN_ON_ONCE(cpu >= nr_cpu_ids)) { > + if (matched_once) > + continue; > return false; > + } > > cpumask_clear(tmp_cpumask); > err = find_l3_equivalent_bitmask(cpu, tmp_cpumask); > @@ -892,6 +897,7 @@ static bool topology_matches_l3(struct mpam_class *victim) > > return false; > } > + matched_once = true; > } > > return true; > @@ -1030,13 +1036,15 @@ static void mpam_resctrl_pick_mba(void) > continue; > } > > - if (!topology_matches_l3(class)) { > + if (class->level == 3 && !topology_matches_l3(class)) { > pr_debug("class %u topology doesn't match L3\n", > class->level); > continue; > } > > - if (!traffic_matches_l3(class)) { > + /* Check memory at egress from L3 for MSC with L3 */ > + if (!cpumask_equal(&class->affinity, cpu_possible_mask) && > + !traffic_matches_l3(class)) { > pr_debug("class %u traffic doesn't match L3 egress\n", > class->level); > continue; > @@ -1164,8 +1172,9 @@ static void mpam_resctrl_pick_counters(void) > } > > if (class_has_usable_mbwu(class) && > - topology_matches_l3(class) && > - traffic_matches_l3(class)) { > + ((class->type == MPAM_CLASS_MEMORY) || > + (topology_matches_l3(class) && > + traffic_matches_l3(class)))) { > pr_debug("class %u has usable MBWU, and matches L3 topology and traffic\n", > class->level); > > @@ -1302,6 +1311,9 @@ static int mpam_resctrl_pick_domain_id(int cpu, struct mpam_component *comp) > if (class->type == MPAM_CLASS_CACHE) > return comp->comp_id; > > + if (mpam_class_memory(class)) > + return comp->comp_id; > + > if (topology_matches_l3(class)) { > /* Use the corresponding L3 component ID as the domain ID */ > int id = get_cpu_cacheinfo_id(cpu, 3);