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: <Z9KdzZUxs3vlwp0Z@smile.fi.intel.com>
Date: Thu, 13 Mar 2025 10:56:45 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Aditya Garg <gargaditya08@...e.com>
Cc: Sven Peter <sven@...npeter.dev>,
	Thomas Zimmermann <tzimmermann@...e.de>,
	Aun-Ali Zaidi <admin@...eit.net>,
	Maxime Ripard <mripard@...nel.org>,
	"airlied@...hat.com" <airlied@...hat.com>,
	Simona Vetter <simona@...ll.ch>, Petr Mladek <pmladek@...e.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Rasmus Villemoes <linux@...musvillemoes.dk>,
	Sergey Senozhatsky <senozhatsky@...omium.org>,
	Jonathan Corbet <corbet@....net>,
	"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
	"apw@...onical.com" <apw@...onical.com>,
	"joe@...ches.com" <joe@...ches.com>,
	"dwaipayanray1@...il.com" <dwaipayanray1@...il.com>,
	"lukas.bulwahn@...il.com" <lukas.bulwahn@...il.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
	"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
	Hector Martin <marcan@...can.st>,
	"asahi@...ts.linux.dev" <asahi@...ts.linux.dev>
Subject: Re: [PATCH 1/2] lib/vsprintf: Add support for generic FourCCs by
 extending %p4cc

On Thu, Mar 13, 2025 at 08:53:28AM +0000, Aditya Garg wrote:
> > On 13 Mar 2025, at 2:19 PM, Andy Shevchenko <andriy.shevchenko@...ux.intel.com> wrote:
> > On Thu, Mar 13, 2025 at 07:26:05AM +0000, Aditya Garg wrote:
> >>>> On 13 Mar 2025, at 12:58 AM, Andy Shevchenko <andriy.shevchenko@...ux.intel.com> wrote:
> >>> On Wed, Mar 12, 2025 at 07:14:36PM +0000, Aditya Garg wrote:
> >>>>> On 12 Mar 2025, at 9:05 PM, Sven Peter <sven@...npeter.dev> wrote:
> >>>>> On Wed, Mar 12, 2025, at 13:03, Aditya Garg wrote:

...

> >>>>> I don't have a strong opinion either way: for SMC I just need to print
> >>>>> FourCC keys for debugging / information in a few places.
> >>>>> 
> >>>>> I'm preparing the SMC driver for upstreaming again (after a two year delay :-()
> >>>>> and was just going to use macros to print the SMC FourCC keys similar to
> >>>>> DRM_MODE_FMT/DRM_MODE_ARG for now to keep the series smaller and revisit
> >>>>> the topic later.
> >>>>> 
> >>>>> Right now I have these in my local tree (only compile tested so far):
> >>>>> 
> >>>>> #define SMC_KEY_FMT "%c%c%c%c (0x%08x)"
> >>>>> #define SMC_KEY_ARG(k) (k)>>24, (k)>>16, (k)>>8, (k), (k)
> >>>> 
> >>>> That seems to be a nice alternative, which I guess Thomas was also suggesting.
> >>> 
> >>> I don't think it's "nice". Each of the approaches has pros and cons.
> >>> You can start from bloat-o-meter here and compare it with your %p extension.
> >>> 
> >>> Also, can you show the bloat-o-meter output for the vsprintf.c?
> >> 
> >> Here are your outputs:
> > 
> > Thank you!
> > 
> >> ---------------------------------------------------------------------
> >> For appletbdrm:
> >> 
> >> aditya@...Book:~/linux$ ./scripts/bloat-o-meter $P4 $MACRO
> >> add/remove: 0/0 grow/shrink: 1/1 up/down: 64/-19 (45)
> >> Function                                     old     new   delta
> >> appletbdrm_read_response                     395     459     +64
> >> appletbdrm_probe                            1786    1767     -19
> >> Total: Before=13418, After=13463, chg +0.34%
> > 
> > This is enough, no need to repeat this for every parameter.
> > 
> >> ---------------------------------------------------------------------
> >> For vsprintf:
> >> 
> >> aditya@...Book:~/linux$ ./scripts/bloat-o-meter $OLD $NEW
> >> add/remove: 0/0 grow/shrink: 1/0 up/down: 220/0 (220)
> >> Function                                     old     new   delta
> >> fourcc_string                                479     699    +220
> >> Total: Before=26454, After=26674, chg +0.83%
> > 
> > So, we get +220 bytes vs +43 bytes. It means if we found 5+ users, it worth
> > doing.
> 
> Will it also depend upon the number of times it's being used? In appletbdrm,
> it is being used 3 times. Probably more in Asahi SMC.

Right, it depends on the usage count. Also on different architectures it may
give different results. On 32-bit it probably gives better statistics.

> >>>>> which are then used like this:
> >>>>> 
> >>>>> dev_info(dev,
> >>>>>     "Initialized (%d keys " SMC_KEY_FMT " .. " SMC_KEY_FMT ")\n",
> >>>>>      smc->key_count, SMC_KEY_ARG(smc->first_key),
> >>>>>      SMC_KEY_ARG(smc->last_key));

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ