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: <85762d20-f615-9a77-3f1a-ce664a2e4f22@os.amperecomputing.com>
Date: Thu, 5 Sep 2024 13:12:13 -0700 (PDT)
From: Ilkka Koskinen <ilkka@...amperecomputing.com>
To: Robin Murphy <robin.murphy@....com>
cc: will@...nel.org, mark.rutland@....com, 
    linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] perf/arm-cmn: Improve format attr printing


On Wed, 4 Sep 2024, Robin Murphy wrote:
> Take full advantage of our formats being stored in bitfield form, and
> make the printing even more robust and simple by letting printk do all
> the hard work of formatting bitlists.
>
> Signed-off-by: Robin Murphy <robin.murphy@....com>

Reviewed-by: Ilkka Koskinen <ilkka@...amperecomputing.com>

--Ilkka


> ---
> drivers/perf/arm-cmn.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
> index 62d4782da7e4..397a46410f7c 100644
> --- a/drivers/perf/arm-cmn.c
> +++ b/drivers/perf/arm-cmn.c
> @@ -1280,15 +1280,11 @@ static ssize_t arm_cmn_format_show(struct device *dev,
> 				   struct device_attribute *attr, char *buf)
> {
> 	struct arm_cmn_format_attr *fmt = container_of(attr, typeof(*fmt), attr);
> -	int lo = __ffs(fmt->field), hi = __fls(fmt->field);
> -
> -	if (lo == hi)
> -		return sysfs_emit(buf, "config:%d\n", lo);
>
> 	if (!fmt->config)
> -		return sysfs_emit(buf, "config:%d-%d\n", lo, hi);
> +		return sysfs_emit(buf, "config:%*pbl\n", 64, &fmt->field);
>
> -	return sysfs_emit(buf, "config%d:%d-%d\n", fmt->config, lo, hi);
> +	return sysfs_emit(buf, "config%d:%*pbl\n", fmt->config, 64, &fmt->field);
> }
>
> #define _CMN_FORMAT_ATTR(_name, _cfg, _fld)				\
> -- 
> 2.39.2.101.g768bb238c484.dirty

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ