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: <20260106123037.000039d0@huawei.com>
Date: Tue, 6 Jan 2026 12:30:37 +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 26/45] arm_mpam: resctrl: Add kunit test for control
 format conversions

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

> From: Dave Martin <Dave.Martin@....com>
> 
> resctrl specifies the format of the control schemes, and these don't match
> the hardware.
> 
> Some of the conversions are a bit hairy - add some kunit tests.
> 
> Signed-off-by: Dave Martin <Dave.Martin@....com>
> [morse: squashed enough of Dave's fixes in here that it's his patch now!]
> Signed-off-by: James Morse <james.morse@....com>
> Signed-off-by: Ben Horgan <ben.horgan@....com>
I took a fairly quick look at these and they seem sane.
Very valuable to have these tests.

Trivial stuff below and a request to carry the reference over to the
code rather than just having it in the tests.

Reviewed-by: Jonathan Cameron <jonathan.cameron@...wei.com>

> diff --git a/drivers/resctrl/test_mpam_resctrl.c b/drivers/resctrl/test_mpam_resctrl.c
> new file mode 100644
> index 000000000000..d0615aa7671c
> --- /dev/null
> +++ b/drivers/resctrl/test_mpam_resctrl.c

> +/*
> + * Mysterious inscriptions taken from ARM DDI 0598D.b,
> + * "Arm Architecture Reference Manual Supplement - Memory System
> + * Resource Partitioning and Monitoring (MPAM), for A-profile
> + * architecture", Section 9.8, "About the fixed-point fractional
> + * format" (exact percentage entries only):

This is the reference I'd like alongside the conversion code.

> + */
> +static const struct percent_value_case percent_value_cases[] = {
> +	/* Architectural cases: */
> +	{   1,  8,    1 },	{   1, 12,  0x27 },	{   1, 16,  0x28e },
> +	{  25,  8, 0x3f },	{  25, 12, 0x3ff },	{  25, 16, 0x3fff },
> +	{  35,  8, 0x58 },	{  35, 12, 0x598 },	{  35, 16, 0x5998 },
> +	{  45,  8, 0x72 },	{  45, 12, 0x732 },	{  45, 16, 0x7332 },
> +	{  50,  8, 0x7f },	{  50, 12, 0x7ff },	{  50, 16, 0x7fff },
> +	{  52,  8, 0x84 },	{  52, 12, 0x850 },	{  52, 16, 0x851d },
> +	{  55,  8, 0x8b },	{  55, 12, 0x8cb },	{  55, 16, 0x8ccb },
> +	{  58,  8, 0x93 },	{  58, 12, 0x946 },	{  58, 16, 0x9479 },
> +	{  75,  8, 0xbf },	{  75, 12, 0xbff },	{  75, 16, 0xbfff },
> +	{  88,  8, 0xe0 },	{  88, 12, 0xe13 },	{  88, 16, 0xe146 },
> +	{  95,  8, 0xf2 },	{  95, 12, 0xf32 },	{  95, 16, 0xf332 },
> +	{ 100,  8, 0xff },	{ 100, 12, 0xfff },	{ 100, 16, 0xffff },
> +
This blank line doesn't add anything.

> +};
> +
> +static void test_percent_value_desc(const struct percent_value_case *param,
> +				    char *desc)
> +{
> +	snprintf(desc, KUNIT_PARAM_DESC_SIZE,
> +		 "pc=%d, width=%d, value=0x%.*x\n",
> +		 param->pc, param->width,
> +		 DIV_ROUND_UP(param->width, 4), param->value);
> +}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ