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 9722F426D16 for ; Thu, 8 Jan 2026 10:52:14 +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=1767869546; cv=none; b=n0atL91ncCWd2M5ZzVxF3QrnWqkBnOv2w5kfn4gGJRgFkpGI5WA5/aimNaeGnoxXWzK5aReJIrfTY0t3uLitiK4ijXwwD8eqYwBo0vqprb+Zrj/lb+r9C5+MNqD7PCWA6cAhC0FCwZ+tN7u5fLRTw0iPILpe7DTB9t2QkEYFt0Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767869546; c=relaxed/simple; bh=CEX+vCwuDDkooxC5ARTwk1yRfhNVbvlrHD+dxMr0BlA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TV18HAtfKS9mYgKbvbzVJFctGn/X74ntqLFqRXc9JcRhw4sBcMV4Qe+r+Fm8OYYP+SYrbphphSP5ixvX9uPjee8jZL3mPaM7VoEOOotu3BdMzX6B1njisaMnYbJ/6y8cM/sX9Z/Gi5laxlk9RrAT3pzwiJ0HdEfN85HmQd6POF4= 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; 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 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 DA494497; Thu, 8 Jan 2026 02:52:02 -0800 (PST) Received: from [10.1.196.46] (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A27633F6A8; Thu, 8 Jan 2026 02:52:02 -0800 (PST) Message-ID: Date: Thu, 8 Jan 2026 10:52:00 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 27/45] arm_mpam: resctrl: Add support for csu counters To: "Shaopeng Tan (Fujitsu)" 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" , "fenghuay@nvidia.com" , "gshan@redhat.com" , "james.morse@arm.com" , "jonathan.cameron@huawei.com" , "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" , "xhao@linux.alibaba.com" , "catalin.marinas@arm.com" , "will@kernel.org" , "corbet@lwn.net" , "maz@kernel.org" , "oupton@kernel.org" , "joey.gouly@arm.com" , "suzuki.poulose@arm.com" , "kvmarm@lists.linux.dev" References: <20251219181147.3404071-1-ben.horgan@arm.com> <20251219181147.3404071-28-ben.horgan@arm.com> From: Ben Horgan Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Shaopeng, On 1/8/26 10:44, Shaopeng Tan (Fujitsu) wrote: > Hello Ben, > >> From: James Morse >> >> 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 >> Signed-off-by: Ben Horgan >> --- >> Changes since rfc: >> Allow csu counters however many partid or pmg there are >> else if -> if >> reduce scope of local variables >> drop has_csu >> --- >>  drivers/resctrl/mpam_internal.h |   6 ++ >>  drivers/resctrl/mpam_resctrl.c  | 148 ++++++++++++++++++++++++++++++++ >>  2 files changed, 154 insertions(+) [...] >> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c >> index f8d8c241797a..5fde610cc9d7 100644 >> --- a/drivers/resctrl/mpam_resctrl.c >> +++ b/drivers/resctrl/mpam_resctrl.c [...] >>   >> +static void mpam_resctrl_monitor_init(struct mpam_resctrl_mon *mon, >> +                                     enum resctrl_event_id type) >> +{ >> +       struct mpam_resctrl_res *res = &mpam_resctrl_controls[RDT_RESOURCE_L3]; >> +       struct rdt_resource *l3 = &res->resctrl_res; >> + >> +       lockdep_assert_cpus_held(); >> + >> +       /* There also needs to be an L3 cache present */ >> +       if (get_cpu_cacheinfo_id(smp_processor_id(), 3) == -1) >> +               return; >> + >> +       /* >> +        * If there are no MPAM resources on L3, force it into existence. >> +        * topology_matches_l3() already ensures this looks like the L3. >> +        * The domain-ids will be fixed up by mpam_resctrl_domain_hdr_init(). >> +        */ >> +       if (!res->class) { >> +               pr_warn_once("Faking L3 MSC to enable counters.\n"); >> +               res->class = mpam_resctrl_counters[type].class; >> +       } >> + >> +       /* Called multiple times!, once per event type */ >> +       if (exposed_mon_capable) { >> +               l3->mon_capable = true; >> + >> +               /* Setting name is necessary on monitor only platforms */ >> +               l3->name = "L3"; >> +               l3->mon_scope = RESCTRL_L3_CACHE; >> + >> +               resctrl_enable_mon_event(type); >> + >> +               /* >> +                * Unfortunately, num_rmid doesn't mean anything for >> +                * mpam, and its exposed to user-space! >> +                * num-rmid is supposed to mean the number of groups >> +                * that can be created, both control or monitor groups. >> +                * For mpam, each control group has its own pmg/rmid >> +                * space. >> +                */ >> +               l3->mon.num_rmid = 1; >> +       } >> +} > > Dave posted the following patch, Will you apply it? > https://lore.kernel.org/lkml/20250820131621.54983-1-Dave.Martin@arm.com/ Thanks for the reminder. I'll squash that into this patch. > > Best regards, > Shaopeng TAN > > Thanks, Ben