lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <OSZPR01MB8798ED2AFBA3EDFA0D2AFB9B8B8CA@OSZPR01MB8798.jpnprd01.prod.outlook.com>
Date: Thu, 15 Jan 2026 10:05:49 +0000
From: "Shaopeng Tan (Fujitsu)" <tan.shaopeng@...itsu.com>
To: Ben Horgan <ben.horgan@....com>
CC: "amitsinght@...vell.com" <amitsinght@...vell.com>,
	"baisheng.gao@...soc.com" <baisheng.gao@...soc.com>,
	"baolin.wang@...ux.alibaba.com" <baolin.wang@...ux.alibaba.com>,
	"carl@...amperecomputing.com" <carl@...amperecomputing.com>,
	"dave.martin@....com" <dave.martin@....com>, "david@...nel.org"
	<david@...nel.org>, "dfustini@...libre.com" <dfustini@...libre.com>,
	"fenghuay@...dia.com" <fenghuay@...dia.com>, "gshan@...hat.com"
	<gshan@...hat.com>, "james.morse@....com" <james.morse@....com>,
	"jonathan.cameron@...wei.com" <jonathan.cameron@...wei.com>,
	"kobak@...dia.com" <kobak@...dia.com>, "lcherian@...vell.com"
	<lcherian@...vell.com>, "linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "peternewman@...gle.com"
	<peternewman@...gle.com>, "punit.agrawal@....qualcomm.com"
	<punit.agrawal@....qualcomm.com>, "quic_jiles@...cinc.com"
	<quic_jiles@...cinc.com>, "reinette.chatre@...el.com"
	<reinette.chatre@...el.com>, "rohit.mathew@....com" <rohit.mathew@....com>,
	"scott@...amperecomputing.com" <scott@...amperecomputing.com>,
	"sdonthineni@...dia.com" <sdonthineni@...dia.com>, "xhao@...ux.alibaba.com"
	<xhao@...ux.alibaba.com>, "catalin.marinas@....com"
	<catalin.marinas@....com>, "will@...nel.org" <will@...nel.org>,
	"corbet@....net" <corbet@....net>, "maz@...nel.org" <maz@...nel.org>,
	"oupton@...nel.org" <oupton@...nel.org>, "joey.gouly@....com"
	<joey.gouly@....com>, "suzuki.poulose@....com" <suzuki.poulose@....com>,
	"kvmarm@...ts.linux.dev" <kvmarm@...ts.linux.dev>
Subject: Re: [PATCH v3 37/47] arm_mpam: resctrl: Update the rmid reallocation
 limit

Hello Ben,

> From: James Morse <james.morse@....com>
> 
> resctrl's limbo code needs to be told when the data left in a cache is
> small enough for the partid+pmg value to be re-allocated.
> 
> x86 uses the cache size divided by the number of rmid users the cache may
> have. Do the same, but for the smallest cache, and with the number of
> partid-and-pmg users.
> 
> Reviewed-by: Jonathan Cameron <jonathan.cameron@...wei.com>
> Signed-off-by: James Morse <james.morse@....com>
> Signed-off-by: Ben Horgan <ben.horgan@....com>
> ---
> Changes since v2:
> Move waiting for cache info into it's own patch
> ---
>  drivers/resctrl/mpam_resctrl.c | 35 ++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
> index 5adc78f9c96f..a6be3ce84241 100644
> --- a/drivers/resctrl/mpam_resctrl.c
> +++ b/drivers/resctrl/mpam_resctrl.c
> @@ -561,6 +561,38 @@ void resctrl_arch_reset_cntr(struct rdt_resource *r, struct rdt_mon_domain *d,
>          reset_mon_cdp_safe(mon, mon_comp, USE_PRE_ALLOCATED, closid, rmid);
>  }
>  
> +/*
> + * The rmid realloc threshold should be for the smallest cache exposed to
> + * resctrl.
> + */
> +static int update_rmid_limits(struct mpam_class *class)
> +{
> +       u32 num_unique_pmg = resctrl_arch_system_num_rmid_idx();
> +       struct mpam_props *cprops = &class->props;
> +       struct cacheinfo *ci;
> +
> +       lockdep_assert_cpus_held();
> +
> +       /* Assume cache levels are the same size for all CPUs... */
> +       ci = get_cpu_cacheinfo_level(smp_processor_id(), class->level);
> +       if (!ci || ci->size == 0) {
> +               pr_debug("Could not read cache size for class %u\n",
> +                        class->level);
> +               return -EINVAL;
> +       }
> +
> +       if (!mpam_has_feature(mpam_feat_msmon_csu, cprops))
> +               return 0;

Shouldn't it be return -EOPNOTSUPP;?

However, before the function update_rmid_limits() is called, there is a check: if (cache_has_usable_csu(class) && topology_matches_l3(class)).
cache_has_usable_csu(class) already contains an identical check. Therefore, I think it's safe to remove this redundant one.

Best regards,
Shaopeng TAN

> +       if (!resctrl_rmid_realloc_limit ||
> +           ci->size < resctrl_rmid_realloc_limit) {
> +               resctrl_rmid_realloc_limit = ci->size;
> +               resctrl_rmid_realloc_threshold = ci->size / num_unique_pmg;
> +       }
> +
> +       return 0;
> +}
> +
>  static bool cache_has_usable_cpor(struct mpam_class *class)
>  {
>          struct mpam_props *cprops = &class->props;
> @@ -1006,6 +1038,9 @@ static void mpam_resctrl_pick_counters(void)
>                          /* CSU counters only make sense on a cache. */
>                          switch (class->type) {
>                          case MPAM_CLASS_CACHE:
> +                               if (update_rmid_limits(class))
> +                                       continue;
> +
>                                  counter_update_class(QOS_L3_OCCUP_EVENT_ID, class);
>                                  break;
>                          default:
> --
> 2.43.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ