Re: [PATCH 14/14] x86/efi: Print size in binary units in efi_print_memmap
From: Ingo Molnar
Date: Wed Feb 03 2016 - 05:40:58 EST
* Laszlo Ersek <lersek@xxxxxxxxxx> wrote:
> I'll take being CC'd as "please offer an opinion", so I'll offer one. :)
>
> On 02/01/16 23:07, Matt Fleming wrote:
> > From: Robert Elliott <elliott@xxxxxxx>
> >
> > Print the size in the best-fit B, KiB, MiB, etc. units rather than
> > always MiB. This avoids rounding, which can be misleading.
> >
> > Use proper IEC binary units (KiB, MiB, etc.) rather than misuse SI
> > decimal units (KB, MB, etc.).
> >
> > old:
> > efi: mem61: [Persistent Memory | | | | | | | |WB|WT|WC|UC] range=[0x0000000880000000-0x0000000c7fffffff) (16384MB)
> >
> > new:
> > efi: mem61: [Persistent Memory | | | | | | | |WB|WT|WC|UC] range=[0x0000000880000000-0x0000000c7fffffff] (16 GiB)
> >
> > Signed-off-by: Robert Elliott <elliott@xxxxxxx>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> > Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> > Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> > Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
> > Cc: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>
> > Cc: Taku Izumi <izumi.taku@xxxxxxxxxxxxxx>
> > Cc: Laszlo Ersek <lersek@xxxxxxxxxx>
> > Signed-off-by: Matt Fleming <matt@xxxxxxxxxxxxxxxxxxx>
> > ---
> > arch/x86/platform/efi/efi.c | 25 ++++++++++++++++++-------
> > 1 file changed, 18 insertions(+), 7 deletions(-)
> >
> > diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
> > index e80826e6f3a9..2c457c5e8203 100644
> > --- a/arch/x86/platform/efi/efi.c
> > +++ b/arch/x86/platform/efi/efi.c
> > @@ -35,6 +35,7 @@
> > #include <linux/efi.h>
> > #include <linux/efi-bgrt.h>
> > #include <linux/export.h>
> > +#include <linux/bitops.h>
> > #include <linux/bootmem.h>
> > #include <linux/slab.h>
> > #include <linux/memblock.h>
> > @@ -117,6 +118,17 @@ void efi_get_time(struct timespec *now)
> > now->tv_nsec = 0;
> > }
> >
> > +static char * __init efi_size_format(char *buf, size_t size, u64 bytes)
> > +{
> > + static const char *const units_2[] = {
> > + "B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"
> > + };
>
> Blech. Blech blech blech. As far as I'm concerned, "IEC binary units"
> rewrite history. I propose to just say "KB" & friends.
So I kind of agree. Memory is almost never measured in marketing bytes, we should
simply output KB/MB/GB/TB/PB/EB like the rest of the memory management code does
and ignore all the 'i' silliness that infests storage sizes ...
Thanks,
Ingo