From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4CB10335063 for ; Thu, 18 Dec 2025 13:21:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766064069; cv=none; b=fgYOlQFeCpUszezUUS9PKktJeMthrbjb3lDLxlyi/a3VgJBQOt8YG2DN6xt9FJOnWRB7veu9+d3F9C4T1qmOrZ7EP/z0f2WXK6v+TWEibgAcIdiu67xoqGeKYc81Cij6PPdNEygt9f8HMDb9Ua6kxz6t4IbR8spcj9q5Jxd3xgA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766064069; c=relaxed/simple; bh=Jfn+sBHqZcPHxvWnEdy1QaLvTj6s1Ge9lDEZnslGzyM=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uy2zZVq65ESUQv8MmCr/hOBnDNH7Lm9NkZLpPVGvpWIprv8qeIpqysE7wX8MlT2gZSxU3Yt0/+tiaCK2xNA5+O2hId9ixvPTmAETS/Vnljc4UMAeNfjapwMFeqEmzG+ifY/kS16YT/vMnIWV9F+SGUulo0actUebluTZ9qoJHP0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.224.83]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4dXB9q5XDxzJ468x; Thu, 18 Dec 2025 21:20:31 +0800 (CST) Received: from dubpeml100005.china.huawei.com (unknown [7.214.146.113]) by mail.maildlp.com (Postfix) with ESMTPS id C374940565; Thu, 18 Dec 2025 21:21:02 +0800 (CST) Received: from localhost (10.203.177.15) by dubpeml100005.china.huawei.com (7.214.146.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.36; Thu, 18 Dec 2025 13:21:01 +0000 Date: Thu, 18 Dec 2025 13:20:59 +0000 From: Jonathan Cameron To: James Morse CC: , , D Scott Phillips OS , , , , , , Jamie Iles , "Xin Hao" , , , , David Hildenbrand , Dave Martin , Koba Ko , Shanker Donthineni , , , Gavin Shan , Ben Horgan , , , Punit Agrawal Subject: Re: [RFC PATCH 18/38] arm_mpam: resctrl: Add support for csu counters Message-ID: <20251218132059.00001a0d@huawei.com> In-Reply-To: <20251205215901.17772-19-james.morse@arm.com> References: <20251205215901.17772-1-james.morse@arm.com> <20251205215901.17772-19-james.morse@arm.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml500009.china.huawei.com (7.191.174.84) To dubpeml100005.china.huawei.com (7.214.146.113) On Fri, 5 Dec 2025 21:58:41 +0000 James Morse wrote: > resctrl exposes a counter via a file named llc_occupancy. This isn't really > a counter as its value goes up and down, this is a snapshot of the cache > storage usage monitor. > > Add some picking code to find a cache as close as possible to the L3 that > supports the CSU monitor. > > If there is an L3, but it doesn't have any controls, force the L3 resource > to exist. The existing topology_matches_l3() and > mpam_resctrl_domain_hdr_init() code will ensure this looks like the L3, > even if the class belongs to a later cache. > > Signed-off-by: James Morse More triviality from me. I'll take a separate look at whether this actually works for all the systems we care about. It feels like maybe a top level MPAM to resctl mapping document might be useful as people are going to fall into traps around these various heuristics, particularly as more exciting topologies arrive in the future. > diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c > index fe830524639e..fc1f054f187e 100644 > --- a/drivers/resctrl/mpam_resctrl.c > +++ b/drivers/resctrl/mpam_resctrl.c > /* > * Calculate the worst-case percentage change from each implemented step > * in the control. > @@ -499,6 +531,64 @@ static void mpam_resctrl_pick_mba(void) > } > } > > +static void counter_update_class(enum resctrl_event_id evt_id, > + struct mpam_class *class) > +{ > + struct mpam_class *existing_class = mpam_resctrl_counters[evt_id].class; > + > + if (existing_class) { > + if (class->level == 3) { > + pr_debug("Existing class is L3 - L3 wins\n"); > + return; As returned the else isn't adding anything much. > + } else if (existing_class->level < class->level) { > + pr_debug("Existing class is closer to L3, %u versus %u - closer is better\n", > + existing_class->level, class->level); > + return; > + } > + } > + > + mpam_resctrl_counters[evt_id].class = class; > + exposed_mon_capable = true; > +}