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: <20260106145831.000055aa@huawei.com>
Date: Tue, 6 Jan 2026 14:58:31 +0000
From: Jonathan Cameron <jonathan.cameron@...wei.com>
To: Ben Horgan <ben.horgan@....com>
CC: <amitsinght@...vell.com>, <baisheng.gao@...soc.com>,
	<baolin.wang@...ux.alibaba.com>, <carl@...amperecomputing.com>,
	<dave.martin@....com>, <david@...nel.org>, <dfustini@...libre.com>,
	<fenghuay@...dia.com>, <gshan@...hat.com>, <james.morse@....com>,
	<kobak@...dia.com>, <lcherian@...vell.com>,
	<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
	<peternewman@...gle.com>, <punit.agrawal@....qualcomm.com>,
	<quic_jiles@...cinc.com>, <reinette.chatre@...el.com>,
	<rohit.mathew@....com>, <scott@...amperecomputing.com>,
	<sdonthineni@...dia.com>, <tan.shaopeng@...itsu.com>,
	<xhao@...ux.alibaba.com>, <catalin.marinas@....com>, <will@...nel.org>,
	<corbet@....net>, <maz@...nel.org>, <oupton@...nel.org>,
	<joey.gouly@....com>, <suzuki.poulose@....com>, <kvmarm@...ts.linux.dev>
Subject: Re: [PATCH v2 39/45] arm_mpam: resctrl: Call resctrl_init() on
 platforms that can support resctrl

On Fri, 19 Dec 2025 18:11:41 +0000
Ben Horgan <ben.horgan@....com> wrote:

> From: James Morse <james.morse@....com>
> 
> Now that MPAM links against resctrl, call resctrl_init() to register the
> filesystem and setup resctrl's structures.
> 
> Signed-off-by: James Morse <james.morse@....com>
> Signed-off-by: Ben Horgan <ben.horgan@....com>

Just minor suggestions inline.  I'm not sure the for loop macros
are worth doing but that particular pair of loops feel awfully familiar
at this point, so maybe. 

Either way..

Reviewed-by: Jonathan Cameron <jonathan.cameron@...wei.com>
 
> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
> index 059148c38a38..bbb12b5dfd8c 100644
> --- a/drivers/resctrl/mpam_resctrl.c
> +++ b/drivers/resctrl/mpam_resctrl.c

> @@ -1840,11 +1861,70 @@ int mpam_resctrl_setup(void)
>  		pr_warn("Number of PMG is not a power of 2! resctrl may misbehave");
>  	}
>  
> -	/* TODO: call resctrl_init() */
> +	err = resctrl_init();
> +	if (!err)
> +		WRITE_ONCE(resctrl_enabled, true);

Trivial but I'd prefer the error path out of line.

	if (err)
		return err;

	WRITE_ONCE(resctrl_enabled, true);
	
	return 0;
>  
>  	return err;
>  }

> +
> +/*
> + * The driver is detaching an MSC from this class, if resctrl was using it,
> + * pull on resctrl_exit().
> + */
> +void mpam_resctrl_teardown_class(struct mpam_class *class)
> +{
> +	int i;
> +	struct mpam_resctrl_res *res;
> +	struct mpam_resctrl_mon *mon;
> +
> +	might_sleep();
> +
> +	for (i = 0; i < RDT_NUM_RESOURCES; i++) {
There are enough iterators over these that I wonder
if it is worth some macros.
 
	for_each_mpam_resctrl_control(res) {
	}
and
	for_each_mpam_resctrl_counter(mon) {
	}


> +		res = &mpam_resctrl_controls[i];
> +		if (res->class == class) {
> +			res->class = NULL;
> +			break;
> +		}
> +	}
> +	for (i = 0; i < QOS_NUM_EVENTS; i++) {
> +		mon = &mpam_resctrl_counters[i];
> +		if (mon->class == class) {
> +			mon->class = NULL;
> +
> +			mpam_resctrl_teardown_mon(mon, class);
> +
> +			break;
> +		}
> +	}
> +}
> +
>  static int __init __cacheinfo_ready(void)
>  {
>  	cacheinfo_ready = true;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ