Re: [PATCH] iomem: Adjust address width for 64-bit addresses

From: Linus Torvalds
Date: Sun May 14 2023 - 18:36:21 EST


On Thu, May 11, 2023 at 9:28 AM Lingxiang Zheng <lxzheng@xxxxxxxxx> wrote:
>
> Modify the address width determination in /proc/iomem output to better
> handle 64-bit addresses. The previous implementation did not correctly
> account for 64-bit address space, as it would limit the address width to 8
> hexadecimal characters.

Note that the width is the *minimum* number of characters to print
(with zero padding due to the zero in front in the printf format). Not
the maximum.

I do not believe we actually want to expand the width to be 16
characters wide, just because it's above the 4GB area. That would make
the numbers huge.

The main reason for the 4/8 split is actually for the IO port cases,
ie we do *not* want to show IO ports (that are limited to 16 bits) as
8 hex-char wide.

So think of the 4/8 as a visual distinction between the iomem and
ioports files.

And yes, I'm aware that some platforms have IO ports that are larger
than 16 bits, and on those platforms as a result the iomem and ioports
files will have similar visual behavior.

Linus