Re: [PATCH v1 2/2] PCI: Include human-readable sizes in resource assignment messages

From: Andy Shevchenko

Date: Mon Aug 24 2026 - 04:19:14 EST


On Fri, Aug 21, 2026 at 03:46:38PM +0200, Petr Mladek wrote:
> On Sat 2026-08-08 20:48:00, Andy Shevchenko wrote:
> > On Sat, Aug 08, 2026 at 12:23:08PM -0500, Bjorn Helgaas wrote:
> > > Include human-readable sizes, e.g., "16.0 MiB", in addition to the hex
> > > "0x1000000" size, in resource-related messages. Also consistently include
> > > the "0x" prefix.
> >
> > Instead of repeating many times the %#llx (%s) and accompanying
> > string_get_size() calls can we rather introduce a (sub-)extension
> > to %p[R] (perhaps against 'R' to print only size) and use it?
>
> I am not sure if I understand it correctly. It looks to me that
> this patch uses string_get_size() for printing some "arbitrary" size
> values. Some are not part of struct resources, so using %pRR
> might be confusing.

AFAICS (but I might have missed something) they all can be containered into
the local variables of type 'struct resource' and then be used with that
extension directly. So, I don't see that it will be confusing.

> Unfortunately, implementing a generic printf modifier for printing
> human readable size is complicated. It should keep the type-size
> checks. Also it should allow to distinguish binary vs decimal
> size calculation, for example 1kB vs 1kHz for 1024B vs 1000Hz.
> See https://lore.kernel.org/all/ZbFd5TZ_pi7q3hso@xxxxxxxxxxxxxxxxxxxx/

I have an idea about this, but I think it's too premature for that type
of extension. So far, this series (AFAIU) is only about known type and
hence known units to print with the format also kinda fixed.

--
With Best Regards,
Andy Shevchenko