x86/efi: use binary units when printing
Subsystems (4)
v3 cover x86/efi: use binary units when printing
The patch series exports the arrays of binary and decimal units as it's described by IEC.
First user of it is EFI code which would print sizes and other values using binary prefix.
James, is this now okay to you?
Matt, I suppose we need to update the stuff in your tree.
Since v2:
- address James comment (don't nail array size)
- fix a title and commit message for patch 3 to be in align with the change
Andy Shevchenko (3):
lib/string_helpers: export string_units_{2,10} for others lib/string_helpers: fix indentation in few places x86/efi: Use proper units in efi_find_mirror()
Robert Elliott (1):
x86/efi: print size in binary units in efi_print_memmap
arch/x86/platform/efi/efi.c | 27 ++++++++++++++++++--------- include/linux/string_helpers.h | 3 +++ lib/string_helpers.c | 26 ++++++++++++++------------ 3 files changed, 35 insertions(+), 21 deletions(-)
Signature · 1 line
2.7.0.rc3
PATCH v3 1/4 lib/string_helpers: export string_units_{2,10} for others
There is one user coming which would like to use those string arrays. It might be useful for any other user in the future.
--- include/linux/string_helpers.h | 3 +++ lib/string_helpers.c | 21 ++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-)
include/linux/string_helpers.h +3 -0
@@ -10,6 +10,9 @@ enum string_size_units { STRING_UNITS_2, /* use binary powers of 2^10 */ }; +extern const char *const string_units_10[]; +extern const char *const string_units_2[]; +void string_get_size (u64 size,u64 blk_size,enum string_size_units units,char *buf,int len);
lib/string_helpers.c +12 -9
@@ -13,6 +13,15 @@#include <linux/string.h> #include <linux/string_helpers.h> +const char *const string_units_10[] = { +"B" ,"kB" ,"MB" ,"GB" ,"TB" ,"PB" ,"EB" ,"ZB" ,"YB" , +}; +EXPORT_SYMBOL (string_units_10); +const char *const string_units_2[] = { +"B" ,"KiB" ,"MiB" ,"GiB" ,"TiB" ,"PiB" ,"EiB" ,"ZiB" ,"YiB" , +}; +EXPORT_SYMBOL (string_units_2); +/** * string_get_size - get the size in the specified units * @size: The size to be converted in blocks
@@ -29,15 +38,9 @@void string_get_size (u64 size,u64 blk_size,const enum string_size_units units,char *buf,int len) { -static const char *const units_10[] = { -"B" ,"kB" ,"MB" ,"GB" ,"TB" ,"PB" ,"EB" ,"ZB" ,"YB" - }; -static const char *const units_2[] = { -"B" ,"KiB" ,"MiB" ,"GiB" ,"TiB" ,"PiB" ,"EiB" ,"ZiB" ,"YiB" - };static const char *const *const units_str[] = { - [STRING_UNITS_10 ] = units_10, - [STRING_UNITS_2 ] = units_2, + [STRING_UNITS_10 ] = string_units_10, + [STRING_UNITS_2 ] = string_units_2, };static const unsigned int divisor[] = { [STRING_UNITS_10 ] =1000 ,
@@ -92,7 +95,7 @@ void string_get_size(u64 size, u64 blk_size, const enum string_size_units units, } out: -if (i >=ARRAY_SIZE (units_2)) +if (i >=ARRAY_SIZE (string_units_2)) unit ="UNK" ;else unit = units_str[units][i];
Signature · 1 line
2.7.0.rc3
Re: [PATCH v3 1/4] lib/string_helpers: export string_units_{2,10} for others
Quoted 68 lines · Andy Shevchenko
There is one user coming which would like to use those string arrays. It might
be useful for any other user in the future.--- include/linux/string_helpers.h | 3 +++ lib/string_helpers.c | 21 ++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-)include/linux/string_helpers.h +3
-0@@ -10,6 +10,9 @@ enum string_size_units { STRING_UNITS_2, /* use binary powers of 2^10*/ }; +extern const char *const string_units_10[]; +extern const char *const string_units_2[]; + void string_get_size(u64 size, u64 blk_size, enum string_size_units units,include/linux/string_helpers.h +0
-0char *buf, int len);lib/string_helpers.c +9
-5@@ -13,6 +13,15 @@#include <linux/string.h> #include <linux/string_helpers.h> +const char *const string_units_10[] = { +"B" ,"kB" ,"MB" ,"GB" ,"TB" ,"PB" ,"EB" ,"ZB" ,"YB" , +}; +EXPORT_SYMBOL (string_units_10); +const char *const string_units_2[] = { +"B" ,"KiB" ,"MiB" ,"GiB" ,"TiB" ,"PiB" ,"EiB" ,"ZiB" ,"YiB" , +}; +EXPORT_SYMBOL (string_units_2); +/** * string_get_size - get the size in the specified units * @size: The size to be converted in blocks @@ -29,15 +38,9 @@void string_get_size (u64 size,u64 blk_size,const enum string_size_units units,char *buf,int len) { -static const char *const units_10[] = { -"B" ,"kB" ,"MB" ,"GB" ,"TB" ,"PB" ,"EB" ,"ZB" ,"YB" - }; -static const char *const units_2[] = { -"B" ,"KiB" ,"MiB" ,"GiB" ,"TiB" ,"PiB" ,"EiB" ,"ZiB", "YiB"
lib/string_helpers.c +2
-3- };static const char *const *const units_str[] = { - [STRING_UNITS_10 ] = units_10, - [STRING_UNITS_2 ] = units_2, + [STRING_UNITS_10 ] = string_units_10, + [STRING_UNITS_2 ] = string_units_2, };static const unsigned int divisor[] = { [STRING_UNITS_10 ] =1000 ,
lib/string_helpers.c void string_get_size(u64 size, u64 blk_size, const · line 99
Quoted 6 lines
lib/string_helpers.c +1
-1@@ -92,7 +95,7 @@ void string_get_size(u64 size, u64 blk_size, const enum string_size_units units, } out: -if (i >=ARRAY_SIZE (units_2)) +if (i >=ARRAY_SIZE (string_units_2))
so now, no-one other than string_helpers.c can tell the size of the array ... I don't think that's an improvement. Also for a trivial patch I'm starting to think there should be a three strikes rule: we get a large number of bugs from allegedly trivial reworks which wouldn't have happened if we'd retained the original working code in the first place.
After two attempts, doesn't it perhaps strike you that a helper function rather than a direct export would get over this difficulty?
It might also address the precision problem you introduced.
James
Re: [PATCH v3 1/4] lib/string_helpers: export string_units_{2,10} for others
Quoted 2 lines · James Bottomley
After two attempts, doesn't it perhaps strike you that a helper function rather than a direct export would get over this difficulty?
Yes, it would.
Quoted 1 line
It might also address the precision problem you introduced.
You mean the issue with a unit range in the other cases (non-efi)?
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v3 2/4 lib/string_helpers: fix indentation in few places
In reply to Andy ShevchenkoFix the indentation of label and put snprintf() to one line.
There is no functional change.
--- lib/string_helpers.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
lib/string_helpers.c +2 -3
@@ -94,14 +94,13 @@ void string_get_size(u64 size, u64 blk_size, const enum string_size_units units, tmp[j+1 ] ='\0' ; } - out: +out:if (i >=ARRAY_SIZE (string_units_2)) unit ="UNK" ;else unit = units_str[units][i]; -snprintf (buf, len,"%u%s %s" , (u32 )size, - tmp, unit); +snprintf (buf, len,"%u%s %s" , (u32 )size, tmp, unit); }EXPORT_SYMBOL (string_get_size);
Signature · 1 line
2.7.0.rc3
PATCH v3 3/4 x86/efi: print size in binary units in efi_print_memmap
In reply to Andy ShevchenkoFrom: Robert Elliott <[email protected]>
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)
--- arch/x86/platform/efi/efi.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
arch/x86/platform/efi/efi.c +16 -7
@@ -35,10 +35,12 @@#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> #include <linux/spinlock.h> +#include <linux/string_helpers.h> #include <linux/uaccess.h> #include <linux/time.h> #include <linux/io.h>
@@ -117,6 +119,14 @@ void efi_get_time(struct timespec *now) now->tv_nsec =0 ; } +static char *__init efi_size_format (char *buf,size_t size,u64 bytes) +{ +unsigned long i = bytes ?__ffs64 (bytes) /10 :0 ; + +snprintf (buf, size,"%llu %s" , bytes >> (i *10 ), string_units_2[i]); +return buf; +} +void __init efi_find_mirror (void ) {void *p;
@@ -225,21 +235,20 @@ int __init efi_memblock_x86_reserve_range(void)void __init efi_print_memmap (void ) {#ifdef EFI_DEBUG -efi_memory_desc_t *md;void *p;int i;for (p = memmap.map, i =0 ; p < memmap.map_end; p += memmap.desc_size, i++) { -char buf[64 ]; +efi_memory_desc_t *md = p; +u64 size = md->num_pages <<EFI_PAGE_SHIFT ; +char buf[64 ], buf3[32 ]; - md = p; -pr_info ("mem%02u: %s range=[0x%016llx-0x%016llx] (%lluMB)\n" , +pr_info ("mem%02u: %s range=[0x%016llx-0x%016llx] (%s)\n" , i,efi_md_typeattr_format (buf,sizeof (buf), md), - md->phys_addr, - md->phys_addr + (md->num_pages <<EFI_PAGE_SHIFT ) -1 , - (md->num_pages >> (20 -EFI_PAGE_SHIFT ))); + md->phys_addr, md->phys_addr + size -1 , +efi_size_format (buf3,sizeof (buf3), size)); }#endif /* EFI_DEBUG */ }
Signature · 1 line
2.7.0.rc3
Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
Quoted 42 lines · Andy Shevchenko
From: Robert Elliott <[email protected]>
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 <[email protected]>--- arch/x86/platform/efi/efi.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)arch/x86/platform/efi/efi.c +2
-0@@ -35,10 +35,12 @@#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> #include <linux/spinlock.h> +#include <linux/string_helpers.h> #include <linux/uaccess.h> #include <linux/time.h> #include <linux/io.h>
arch/x86/platform/efi/efi.c void efi_get_time(struct timespec *now) · line 125
Quoted 7 lines
arch/x86/platform/efi/efi.c +3
-0@@ -117,6 +119,14 @@ void efi_get_time(struct timespec *now) now->tv_nsec =0 ; } +static char *__init efi_size_format (char *buf,size_t size,u64 bytes) +{ +unsigned long i = bytes ?__ffs64 (bytes) /10 :0 ;
What if size is zero, which might happen on a UEFI screw up? Also it gives really odd results for non power of two memory sizes. 16384MB prints as 16GiB but 16385 prints as 16385MiB.
If the goal is to have a clean interface reporting only the first four significant figures and a size exponent, then a helper would be much better than trying to open code this ad hoc.
Not an attack on you patch per-se, but I really hate the IEC convention that was essentially a ploy by disk manufacturers to inflate their disk sizes by 10% simply by relabelling them. Everyone was happy when a GB was 2^30, now everyone's simply confused whenever they see GB. We had to pander to this in block devices because people got annoyed when we reported a size that was different from the label but are you sure we have to extend the madness to memory?
James
Quoted 41 lines
arch/x86/platform/efi/efi.c +10
-7+snprintf (buf, size,"%llu %s" , bytes >> (i *10 ), string_units_2[i]); +return buf; +} +void __init efi_find_mirror (void ) {void *p;@@ -225,21 +235,20 @@ int __init efi_memblock_x86_reserve_range(void)void __init efi_print_memmap (void ) {#ifdef EFI_DEBUG -efi_memory_desc_t *md;void *p;int i;for (p = memmap.map, i =0 ; p < memmap.map_end; p += memmap.desc_size, i++) { -char buf[64 ]; +efi_memory_desc_t *md = p; +u64 size = md->num_pages <<EFI_PAGE_SHIFT ; +char buf[64 ], buf3[32 ]; - md = p; -pr_info ("mem%02u: %s range=[0x%016llx-0x%016llx] (%lluMB)\n", + pr_info("mem%02u: %s range=[0x%016llx-0x%016llx] (%s)\n", i,efi_md_typeattr_format (buf,sizeof (buf), md), - md->phys_addr, - md->phys_addr + (md->num_pages <<EFI_PAGE_SHIFT ) -1 , - (md->num_pages >> (20 -EFI_PAGE_SHIFT ))); + md->phys_addr, md->phys_addr + size -1 , + efi_size_format(buf3, sizeof(buf3), size)); }#endif /* EFI_DEBUG */ }
Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
Quoted 8 lines · James Bottomley
arch/x86/platform/efi/efi.c void efi_get_time(struct timespec *now) · line 124
Quoted 4 lines · Andy Shevchenko
+static char *
__initefi_size_format(char *buf, size_t size, u64 bytes)arch/x86/platform/efi/efi.c +2
-0+{ +unsigned long i = bytes ?__ffs64 (bytes) /10 :0 ;What if size is zero, which might happen on a UEFI screw up?
size of what? Of input buffer?
Quoted 3 lines
Also it
gives really odd results for non power of two memory sizes. 16384MB prints as 16GiB but 16385 prints as 16385MiB.
Adaptive precision. I don't think the idea is to print a nearby numbers here.
Quoted 3 lines
If the goal is to have a clean interface reporting only the first four significant figures and a size exponent, then a helper would be much better than trying to open code this ad hoc.
No. You get it wrong. The initial idea was (actually not mine, see authorship) to print an exact number with units and reduce whenever it's possible, i.e number is a multiplication of certain unit.
Quoted 5 lines
Not an attack on you patch per-se, but I really hate the IEC convention that was essentially a ploy by disk manufacturers to inflate their disk sizes by 10% simply by relabelling them.
Everyone was happy when a GB was 2^30,
No, not everyone. It was a misspelling done by some first storage producer. Try to look at the problem from physics point of view. Units are essential part of a value. There is an agreement how to use multipliers and their code names. 1000 x Unit means kiloUnit. As per agreement.
Quoted 4 lines
now everyone's simply confused whenever they see GB. We had to pander to this in block devices because people got annoyed when we reported a size that was different from the label but are you sure we have to extend the madness to memory?
I actually don't know who is from us is being more conservative. I could call a madness to mess things from ancient (classical mathematics and physics) with something which has less than hundred years in development.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
Quoted 4 lines · Andy Shevchenko
Quoted 1 line · James Bottomley
On Sat, 2016-01-23 at 16:55 +0200, Andy Shevchenko wrote:
Quoted 8 lines
Quoted 6 lines
arch/x86/platform/efi/efi.c void efi_get_time(struct timespec *now) · line 124
Quoted 4 lines
+static char *
__initefi_size_format(char *buf, size_t size, u64 bytes)arch/x86/platform/efi/efi.c +2
-0+{ +unsigned long i = bytes ?__ffs64 (bytes) /10 :0 ;What if size is zero, which might happen on a UEFI screw up?
size of what? Of input buffer?
I mean when bytes == 0 ffs is undefined.
Quoted 5 lines
Quoted 2 lines
Also it gives really odd results for non power of two memory
sizes. 16384MB prints as 16GiB but 16385 prints as 16385MiB.Adaptive precision. I don't think the idea is to print a nearby numbers here.
Well either there's a point to reducing to the nearest exponent or we simply print everything in MB as the original did. Doing it inconsistently is asking for trouble ... and lots of user queries. I mean, supposing there's a range off by one ... now we print a huge number in B.
I really advise against hacking around like this. In any event if efi must have this, please don't involve the parts of the kernel that try to do this correctly, like lib/string_helpers.h
Quoted 7 lines
Quoted 3 lines
If the goal is to have a clean interface reporting only the first four significant figures and a size exponent, then a helper would be much better than trying to open code this ad hoc.
No. You get it wrong. The initial idea was (actually not mine, see authorship) to print an exact number with units and reduce whenever it's possible, i.e number is a multiplication of certain unit.
so you must implement the original idea no matter how inconsistent it leads us to be? Is it wrong to try to do better?
James
Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
Quoted 13 lines · James Bottomley
Quoted 12 lines · Andy Shevchenko
Quoted 9 lines · James Bottomley
Quoted 5 lines · Andy Shevchenko
+static char *
__initefi_size_format(char *buf,size_tsize, u64
bytes)
+{
+ unsigned long i = bytes ?__ffs64(bytes)/ 10 : 0;What if size is zero, which might happen on a UEFI screw up?
Quoted 3 lines
Quoted 1 line
size of what? Of input buffer?
I mean when bytes == 0 ffs is undefined.
Well, someone misread the above code ;-)
There is ternary operator exactly to serve this purpose.
Quoted 25 lines
Quoted 6 lines
Quoted 3 lines
Also it gives really odd results for non power of two memory sizes. 16384MB prints as 16GiB but 16385 prints as 16385MiB.
Adaptive precision. I don't think the idea is to print a nearby numbers here.
Well either there's a point to reducing to the nearest exponent or we simply print everything in MB as the original did. Doing it inconsistently is asking for trouble ... and lots of user queries. I mean, supposing there's a range off by one ... now we print a huge number in B.
I really advise against hacking around like this. In any event if efi
must have this, please don't involve the parts of the kernel that try to do this correctly, likelib/string_helpers.hQuoted 6 lines
Quoted 5 lines
If the goal is to have a clean interface reporting only the first
four significant figures and a size exponent, then a helper would
be much better than trying to open code this ad hoc.
Quoted 6 lines
Quoted 3 lines
No. You get it wrong. The initial idea was (actually not mine, see authorship) to print an exact number with units and reduce whenever it's possible, i.e number is a multiplication of certain unit.
so you must implement the original idea no matter how inconsistent it leads us to be? Is it wrong to try to do better?
For both comments I prefer to hear Matt's opinion as he is maintainer of EFI stuff.
My role in this all is to reduce the code base by avoiding 'not invented here' syndrome.
Signature · 2 lines
Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]> Intel Finland Oy
Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
Quoted 18 lines · Andy Shevchenko
Quoted 13 lines · James Bottomley
Quoted 11 lines · Andy Shevchenko
Quoted 5 lines
If the goal is to have a clean interface reporting only the first
four significant figures and a size exponent, then a helper would
be much better than trying to open code this ad hoc.No. You get it wrong. The initial idea was (actually not mine, see
authorship) to print an exact number with units and reduce whenever
it's possible, i.e number is a multiplication of certain unit.Quoted 3 lines
so you must implement the original idea no matter how inconsistent it
leads us to be? Is it wrong to try to do better?
Quoted 5 lines
For both comments I prefer to hear Matt's opinion as he is maintainer of EFI stuff.
My role in this all is to reduce the code base by avoiding 'not invented here' syndrome.
To get up to the starting blocks on that one, you need a usable interface. Neither of the series has that for lib/string_helper.c, so this is a NAK to both of those parts.
I already told you how to do it in a way that creates a maintainable interface. It looks obvious to me and I was politely waiting for you to produce it, but if you're saying your not able to, I suppose I can produce the patch.
James
Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
In reply to Andy ShevchenkoQuoted 8 lines · Andy Shevchenko
Quoted 5 lines · James Bottomley
Not an attack on you patch per-se, but I really hate the IEC convention
that was essentially a ploy by disk manufacturers to inflate their disk
sizes by 10% simply by relabelling them.
Quoted 4 lines
Quoted 1 line
Everyone was happy when a GB was 2^30,
No, not everyone. It was a misspelling done by some first storage producer.
No, it was the adopted convention in computer science to use units in 2^10 since all sizes were usually binary. It actually began with memory sizes. So a GB never meant 10^9 bytes before 2007 because the classical unit users had no idea what a byte was. The first bytes were counted in powers of 2.
Quoted 4 lines
Try to look at the problem from physics point of view. Units
are essential part of a value. There is an agreement how to use multipliers and their code names. 1000 x Unit means kiloUnit. As per agreement.
It's not about physics (and certainly astronomers, who often take pi to be 1 would be happy with 2^10 = 10^3) it's about politics: disk manufacturers wanted a way to report bigger sizes, so they made a huge fuss about the "inconsistency" of computer science using units in increments of 2^10 and forced through this IEC standard.
Quoted 9 lines
Quoted 4 lines
now everyone's simply confused whenever they see GB. We had to pander to this in block devices because people got annoyed when we reported a size that was different from the label but are you sure we have to extend the madness to memory?
I actually don't know who is from us is being more conservative. I could call a madness to mess things from ancient (classical mathematics and physics) with something which has less than hundred years in development.
In engineering terms, counting in powers of 2 makes a lot of sense for quantites using binary address busses and the IEC even recognised that by inventing a new unit for it. Having GB mean 2^30 up to 2007 and 10^9 after it is confusing for everyone born before about 1990.
James
Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
All a bit revisionist. Everyone else on the planet was upset about it because it broke things like calculating bit density because the prefixes for the bit capacity are not in metric form. BIPM (keeper of the SI units) never approved powers of two as an interpretation. IEC came into line in 1999, ISO followed.
Disk sizes have been decimal since at least the 1970s. The original IBM 10MB hard disc for example was 10MB not 10MiB.
Powers of two are only validly referred to as KiB, MiB, GiB as of all current standard body positions. Powers of 10 based units are kB, MB, GB)
(The best one is CD and DVD: DVD uses the proper definition, CD uses MiB, although given the multiple sector sizes and encodings on CD it's all manure anyway)
Alan
H. Peter Anvin
reviewerRe: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
Quoted 14 lines · One Thousand Gnomes
All a bit revisionist. Everyone else on the planet was upset about it because it broke things like calculating bit density because the prefixes
for the bit capacity are not in metric form. BIPM (keeper of the SI units) never approved powers of two as an interpretation. IEC came into line in 1999, ISO followed.Disk sizes have been decimal since at least the 1970s. The original IBM 10MB hard disc for example was 10MB not 10MiB.
Powers of two are only validly referred to as KiB, MiB, GiB as of all current standard body positions. Powers of 10 based units are kB, MB, GB)
Quoted 6 lines
(The best one is CD and DVD: DVD uses the proper definition, CD uses MiB,
although given the multiple sector sizes and encodings on CD it's all manure anyway)Alan
Then there are oddball definitions like 1 MB = 1,024,000, which IBM used for disk for a long time. At least IEC tried to come up with a unambiguous way to denote these prefixes. It was less of an issue for kilo- since the binary prefix was always capitalized.
Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse brevity and formatting.
RE: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
In reply to James BottomleyQuoted 22 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Saturday, January 23, 2016 10:44 AM
To: Andy Shevchenko <[email protected]>; Matt Fleming <[email protected]>; Thomas Gleixner <[email protected]>; Ingo Molnar <[email protected]>; H . Peter Anvin <[email protected]>; linux- [email protected]; Rasmus Villemoes <[email protected]>; Andrew Morton <[email protected]>; linux-kernel @ vger . kernel . org <[email protected]>
Cc: Elliott, Robert (Persistent Memory) <[email protected]>
Subject: Re: [PATCH v3 3/4] x86/efi: print size in binary units inefi_print_memmapQuoted 5 lines · Andy Shevchenko
From: Robert Elliott <[email protected]>
Print the size in the best-fit B, KiB, MiB, etc. units rather than always MiB. This avoids rounding, which can be misleading.
...
Quoted 8 lines
What if size is zero, which might happen on a UEFI screw up?
Also it gives really odd results for non power of two memory sizes. 16384MB prints as 16GiB but 16385 prints as 16385MiB.
If the goal is to have a clean interface reporting only the first four significant figures and a size exponent, then a helper would be much better than trying to open code this ad hoc.
An impetus for the patch was to stop rounding the sub-MiB values, which is misleading and can hide bugs. For my systems, the minimum size of a range happens to be 4 KiB, so I wanted at least that resolution. However, I don't want to print everything as KiB, because that makes big sizes less clear.
Example - old output:
efi: mem00: [Conventional Memory...] range=[0x0000000000000000-0x0000000000001000) (0MB)
efi: mem01: [Loader Data ...] range=[0x0000000000001000-0x0000000000002000) (0MB)
efi: mem02: [Conventional Memory...] range=[0x0000000000002000-0x0000000000093000) (0MB)
efi: mem03: [Reserved ...] range=[0x0000000000093000-0x0000000000094000) (0MB)
Proposed output:
efi: mem00: [Conventional Memory...] range=[0x0000000000000000-0x0000000000092fff] (588 KiB @ 0 B)
efi: mem01: [Reserved ...] range=[0x0000000000093000-0x0000000000093fff] (4 KiB @ 588 KiB)
efi: mem02: [Conventional Memory...] range=[0x0000000000094000-0x000000000009ffff] (48 KiB @ 592 KiB)
efi: mem03: [Loader Data ...] range=[0x0000000000100000-0x00000000013e8fff] (19364 KiB @ 1 MiB)
(notes:
- from a different system
- including both base and size
- Matt didn't like printing the base so that's been removed)
With persistent memory (NVDIMMs) bringing storage device capacities into the memory subsystem, MiB is too small. Seeing a 1 TiB NVDIMM as 1 TiB is a lot clearer than having to recognize 1048576 MiB as the same value (especially since these power-of-two quantities don't just chop off zeros on the right).
Examples:
efi: mem50: [Runtime Data ...] range=[0x00000000784ff000-0x00000000788fefff] (4 MiB @ 1971196 KiB)
efi: mem56: [Conventional Memory...] range=[0x0000000100000000-0x000000087fffffff] (30 GiB @ 4 GiB)
efi: mem58: [Memory Mapped I/O ...] range=[0x0000000080000000-0x000000008fffffff] (256 MiB @ 2 GiB)
efi: mem60: [Persistent Memory ...] range=[0x0000001480000000-0x0000001a7fffffff] (24 GiB @ 82 GiB)
---
Robert Elliott, HPE Persistent Memory
Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
Quoted 76 lines · Robert (Persistent Memory)
Quoted 27 lines
-----Original Message-----
From: James Bottomley [mailto:James.Bottomley-d9PhHud1JfjCXq6kfMZ53/[email protected]
]
Sent: Saturday, January 23, 2016 10:44 AM
To: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]>; Matt
Fleming
<matt-mF/unelCI9GS6iBeEJttW/[email protected]>; Thomas Gleixner <[email protected]>; Ingo
Molnar <[email protected]>; H . Peter Anvin <[email protected]>; linux- [email protected]; Rasmus Villemoes <linux-qQsb+v5E8BnlAoU/[email protected]>; Andrew
Morton <akpm-de/[email protected]>; linux-kernel @ vger . kernel .
org
<[email protected]>
Cc: Elliott, Robert (Persistent Memory) <[email protected]>
Subject: Re: [PATCH v3 3/4] x86/efi: print size in binary units inefi_print_memmapQuoted 6 lines · Andy Shevchenko
From: Robert Elliott <[email protected]>
Print the size in the best-fit B, KiB, MiB, etc. units rather than
always MiB. This avoids rounding, which can be misleading....
Quoted 10 lines
What if size is zero, which might happen on a UEFI screw up?
Also it gives really odd results for non power of two memory sizes. 16384MB prints as 16GiB but 16385 prints as 16385MiB.
If the goal is to have a clean interface reporting only the first four
significant figures and a size exponent, then a helper would be much
better than trying to open code this ad hoc.An impetus for the patch was to stop rounding the sub-MiB values, which is misleading and can hide bugs. For my systems, the minimum size of a range happens to be 4 KiB, so I wanted at least that resolution. However, I don't want to print everything as KiB, because that makes big sizes less clear.
Example - old output:
efi: mem00: [Conventional Memory...] range=[0x0000000000000000 -0x0000000000001000) (0MB)
efi: mem01: [Loader Data ...] range=[0x0000000000001000
-0x0000000000002000) (0MB)
efi: mem02: [Conventional Memory...] range=[0x0000000000002000 -0x0000000000093000) (0MB)
efi: mem03: [Reserved ...] range=[0x0000000000093000
-0x0000000000094000) (0MB)Proposed output:
efi: mem00: [Conventional Memory...] range=[0x0000000000000000 -0x0000000000092fff] (588 KiB @ 0 B)
efi: mem01: [Reserved ...] range=[0x0000000000093000
-0x0000000000093fff] (4 KiB @ 588 KiB)
efi: mem02: [Conventional Memory...] range=[0x0000000000094000 -0x000000000009ffff] (48 KiB @ 592 KiB)
efi: mem03: [Loader Data ...] range=[0x0000000000100000
-0x00000000013e8fff] (19364 KiB @ 1 MiB)
(notes:
- from a different system
- including both base and size
- Matt didn't like printing the base so that's been removed)With persistent memory (NVDIMMs) bringing storage device capacities into the memory subsystem, MiB is too small. Seeing a 1 TiB NVDIMM as 1 TiB is a lot clearer than having to recognize 1048576 MiB as the same value (especially since these power-of-two quantities don't just chop off zeros on the right).
Quoted 9 lines
Examples:
efi: mem50: [Runtime Data ...] range=[0x00000000784ff000
-0x00000000788fefff] (4 MiB @ 1971196 KiB)
efi: mem56: [Conventional Memory...] range=[0x0000000100000000 -0x000000087fffffff] (30 GiB @ 4 GiB)
efi: mem58: [Memory Mapped I/O ...] range=[0x0000000080000000 -0x000000008fffffff] (256 MiB @ 2 GiB)
efi: mem60: [Persistent Memory ...] range=[0x0000001480000000 -0x0000001a7fffffff] (24 GiB @ 82 GiB)
OK, this is getting a bit out of hand: I didn't say your aim was bad ... I think it's a reasonable desire; I said the proposed implementation was bad. Using ffs leads to precision runaway and exporting an array from string_helpers.c is simply the wrong way to do it.
Since we've now spent more time arguing about this than it would take to do a correct patch, this is what I was thinking. It extracts the precision reduction core from string_helpers.c and exposes it to all users who want to convert to units. I added a nozeros option becuase I think you want it to print 1 GiB rather than 1.00 GiB for exact powers of two. (OK, and I fixed a bug where it will report small amounts as 1.00 B instead of whole number of bytes). Absent the nozero option, you could simply have used string_get_size(), with a block size of 1.
James
---
include/linux/string_helpers.h +2 -0
@@ -10,6 +10,8 @@ enum string_size_units { STRING_UNITS_2, /* use binary powers of 2^10 */ }; +void string_get_units (u64 size,const enum string_size_units units, +char *buf,int len,bool nozeros);void string_get_size (u64 size,u64 blk_size,enum string_size_units units,char *buf,int len);
lib/string_helpers.c +89 -54
183 lines not on this page · raw message
Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
Quoted 4 lines · James Bottomley
On Mon, 2016-01-25 at 18:02 +0000, Elliott, Robert (Persistent Memory) wrote:
Using ffs leads to precision runaway
How exactly?!
Quoted 3 lines
and
exporting an array fromstring_helpers.cis simply the wrong way to do it.
This part I didn't object.
Quoted 8 lines
Since we've now spent more time arguing about this than it would take to do a correct patch, this is what I was thinking. It extracts the precision reduction core from
string_helpers.cand exposes it to all users who want to convert to units. I added a nozeros option becuase I think you want it to print 1 GiB rather than 1.00 GiB for exact powers of two. (OK, and I fixed a bug where it will report small amounts as 1.00 B instead of whole number of bytes). Absent the nozero option, you could simply have usedstring_get_size(), with a block size of 1.
It's good you are doing this better, but I still vote for __ffs64(), since it would be faster on binary units.
Also, in one version I tried to convert couple of other users which are using only KM (in general whatever range it would be) units. Any ideas how to modify to support them?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
Quoted 9 lines · Andy Shevchenko
Quoted 5 lines · James Bottomley
On Mon, 2016-01-25 at 18:02 +0000, Elliott, Robert (Persistent Memory)
wrote:Using ffs leads to precision runaway
How exactly?!
Off by one. A size of 0xffffffffffffffff prints 18446744073709551615 B rather than 20 GiB.
Quoted 24 lines
Quoted 4 lines
and
exporting an array fromstring_helpers.cis simply the wrong way to do
it.This part I didn't object.
Quoted 8 lines
Since we've now spent more time arguing about this than it would take
to do a correct patch, this is what I was thinking. It extracts the
precision reduction core fromstring_helpers.cand exposes it to all
users who want to convert to units. I added a nozeros option becuase IQuoted 8 lines
think you want it to print 1 GiB rather than 1.00 GiB for exact powers
of two. (OK, and I fixed a bug where it will report small amounts as
1.00 B instead of whole number of bytes). Absent the nozero option,
you could simply have usedstring_get_size(), with a block size of 1.
Quoted 2 lines
It's good you are doing this better, but I still vote for
__ffs64(), since it would be faster on binary units.
Is speed of a start of day print a particular concern?
Quoted 3 lines
Also, in one version I tried to convert couple of other users which are using only KM (in general whatever range it would be) units. Any ideas how to modify to support them?
You mean units in odd increments of 6 digits (so K, M, T ...)? no. The logarithmic reduction is done to the base of the unit increment (1000 or 1024) so it doesn't really fit this case and it would be hard to adjust because we don't have enough precision in the remainder.
However, unless there's a huge need to keep it, I'd just fit to the
closest 3 digit increment and then everything would work.
James
Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
Quoted 7 lines · James Bottomley
Quoted 6 lines · Andy Shevchenko
Quoted 3 lines · James Bottomley
On Mon, 2016-01-25 at 18:02 +0000, Elliott, Robert (Persistent Memory)
wrote:
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Using ffs leads to precision runaway
How exactly?!
Off by one. A size of
0xffffffffffffffffprints 18446744073709551615 B rather than 20 GiB.
Because it's not a 20 GiB. It's exactly 20 GiB - 1 B.
AFAIU, the intention was to show _exact_ size.
Quoted 4 lines
Quoted 2 lines
It's good you are doing this better, but I still vote for
__ffs64(), since it would be faster on binary units.Is speed of a start of day print a particular concern?
If it's cheap to do, why not to do?
Quoted 10 lines
Quoted 3 lines
Also, in one version I tried to convert couple of other users which are using only KM (in general whatever range it would be) units. Any ideas how to modify to support them?
You mean units in odd increments of 6 digits (so K, M, T ...)? no. The logarithmic reduction is done to the base of the unit increment (1000 or 1024) so it doesn't really fit this case and it would be hard to adjust because we don't have enough precision in the remainder.
However, unless there's a huge need to keep it, I'd just fit to the
closest 3 digit increment and then everything would work.
KM case:
K) if 1 MiB > value >= 0 — prints in KiB
M) if ∞ > value >= 1 MiB — prints in MiB.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
Quoted 13 lines · Andy Shevchenko
Quoted 11 lines · James Bottomley
Quoted 9 lines · Andy Shevchenko
Quoted 5 lines · James Bottomley
On Mon, 2016-01-25 at 18:02 +0000, Elliott, Robert (Persistent Memory)
wrote:Using ffs leads to precision runaway
How exactly?!
Quoted 7 lines
Quoted 3 lines
Off by one. A size of
0xffffffffffffffffprints
18446744073709551615 B
rather than 20 GiB.Because it's not a 20 GiB. It's exactly 20 GiB - 1 B.
AFAIU, the intention was to show _exact_ size.
I think that's a bad idea: The range shows you the exact stuff in hex, so all the information is present if you want precision. What's printed in brackets is for humans to read. I'd have to reach for a calculator to work out that 18446744073709551615 is actually around 20 GiB.
James
RE: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
In reply to Andy Shevchenko---
Robert Elliott, HPE Persistent Memory
Quoted 25 lines
-----Original Message-----
From: Andy Shevchenko [mailto:[email protected]]
Sent: Monday, January 25, 2016 2:01 PM
To: James Bottomley <[email protected]>
Cc: Elliott, Robert (Persistent Memory) <[email protected]>; Andy Shevchenko <[email protected]>; Matt Fleming <[email protected]>; Thomas Gleixner <[email protected]>; Ingo Molnar <[email protected]>; H . Peter Anvin <[email protected]>; linux- [email protected]; Rasmus Villemoes <[email protected]>; Andrew Morton <[email protected]>; linux-kernel @ vger . kernel . org <[email protected]>
Subject: Re: [PATCH v3 3/4] x86/efi: print size in binary units inefi_print_memmapQuoted 9 lines · James Bottomley
Quoted 8 lines · Andy Shevchenko
Quoted 5 lines · James Bottomley
On Mon, 2016-01-25 at 18:02 +0000, Elliott, Robert (Persistent Memory)
wrote:Using ffs leads to precision runaway
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
How exactly?!
Off by one. A size of
0xffffffffffffffffprints 18446744073709551615 B rather than 20 GiB.Because it's not a 20 GiB. It's exactly 20 GiB - 1 B.
AFAIU, the intention was to show _exact_ size.
For the UEFI memory map, that was indeed my intention. I don't want it silently round to "20 GiB". Even rounding to "19.999 GiB" is imprecise.
Another option could be to use a "~" prefix for imperfect values, like "~20 GiB". That would serve as a warning that something's not quite right.
Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
Quoted 4 lines · Robert (Persistent Memory)
For the UEFI memory map, that was indeed my intention. I don't want it silently round to "20 GiB". Even rounding to "19.999 GiB" is imprecise.
OK, let's just go with your original patch Robert (minus the @ addr bit) since it's pretty small and does what we want for this specific case.
Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
Quoted 10 lines · Matt Fleming
Quoted 4 lines · Robert (Persistent Memory)
For the UEFI memory map, that was indeed my intention. I don't want it silently round to "20 GiB". Even rounding to "19.999 GiB" is imprecise.
OK, let's just go with your original patch Robert (minus the @ addr bit) since it's pretty small and does what we want for this specific case.
However I am against this, but seems reviewers do not leave a chance to us, I would propose to copy-and-paste table of binary prefixes and use __ffs64().
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
Quoted 8 lines · Andy Shevchenko
Quoted 7 lines · Matt Fleming
Quoted 4 lines · Robert (Persistent Memory)
For the UEFI memory map, that was indeed my intention. I don't want it silently round to "20 GiB". Even rounding to "19.999 GiB" is imprecise.
Quoted 7 lines
Quoted 3 lines
OK, let's just go with your original patch Robert (minus the @ addr bit) since it's pretty small and does what we want for this specific case.
However I am against this, but seems reviewers do not leave a chance to us, I would propose to copy-and-paste table of binary prefixes and use
__ffs64().
Is there a benefit to this approach other than __ffs64() being faster? It is a neglibible performance gain anyway because this is hidden behind efi=debug, and so by definition you're not looking for ultra performance.
Which makes picking between __ffs64() and non-__ffs64() a wash if we're not going to be reusing existing code.
Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
Quoted 22 lines · Matt Fleming
Quoted 15 lines · Andy Shevchenko
Quoted 8 lines · Matt Fleming
Quoted 4 lines · Robert (Persistent Memory)
For the UEFI memory map, that was indeed my intention. I don't want it silently round to "20 GiB". Even rounding to "19.999 GiB" is imprecise.
Quoted 5 lines
OK, let's just go with your original patch Robert (minus the @ addr
bit) since it's pretty small and does what we want for this specific
case.Quoted 5 lines
However I am against this, but seems reviewers do not leave a chance to
us, I would propose to copy-and-paste table of binary prefixes and use__ffs64().
Quoted 8 lines
Is there a benefit to this approach other than
__ffs64()being faster?
It is a neglibible performance gain anyway because this is hidden behind efi=debug, and so by definition you're not looking for ultra performance.Which makes picking between
__ffs64()and non-__ffs64() a wash if we're not going to be reusing existing code.
For me it looks cleaner, smaller, thus better to maintenance, and faster. So, my variant below, though it's up to you what to choose.
Quoted 1 line
From
e16660cf999aec754a0f7a95604b8f9e86c40d55Mon Sep 17 00:00:00 2001
From: Robert Elliott <[email protected]>
Date: Tue, 12 Jan 2016 15:13:06 +0200
Subject: [PATCH 1/1] x86/efi: print size in binary units in efi_print_memmap
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)
---
arch/x86/platform/efi/efi.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
arch/x86/platform/efi/efi.c +0 -0
@@ -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"
+ };
+ unsigned long i = bytes ? __ffs64(bytes) / 10 : 0;
+
+ snprintf(buf, size, "%llu %s", bytes >> (i * 10), units_2[i]);
+ return buf;
+}
+
void __init efi_find_mirror(void)
{
void *p;
@@ -225,21 +237,20 @@ int __init efi_memblock_x86_reserve_range(void) void __init efi_print_memmap(void)
{
#ifdef EFI_DEBUG
- efi_memory_desc_t *md;
void *p;
int i;
for (p = memmap.map, i = 0;
p < memmap.map_end;
p += memmap.desc_size, i++) {
- char buf[64];
+ efi_memory_desc_t *md = p;
+ u64 size = md->num_pages << EFI_PAGE_SHIFT;
+ char buf[64], buf3[32];
- md = p;
- pr_info("mem%02u: %s range=[0x%016llx-0x%016llx]
(%lluMB)\n",
+ pr_info("mem%02u: %s range=[0x%016llx-0x%016llx]
(%s)\n",
i, efi_md_typeattr_format(buf, sizeof(buf), md),
- md->phys_addr,
- md->phys_addr + (md->num_pages <<EFI_PAGE_SHIFT) - 1,
- (md->num_pages >> (20 - EFI_PAGE_SHIFT)));
+ md->phys_addr, md->phys_addr + size - 1,
+ efi_size_format(buf3, sizeof(buf3), size));
}
#endif /* EFI_DEBUG */
}
--
2.7.0.rc3
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Re: [PATCH v3 3/4] x86/efi: print size in binary units in efi_print_memmap
In reply to Andy ShevchenkoQuoted 17 lines · Andy Shevchenko
Quoted 7 lines · James Bottomley
Quoted 5 lines · Andy Shevchenko
Also, in one version I tried to convert couple of other users which
are using only KM (in general whatever range it would be) units. Any
ideas how to modify to support them?Quoted 7 lines
You mean units in odd increments of 6 digits (so K, M, T ...)? no.
The logarithmic reduction is done to the base of the unit
increment (1000 or 1024) so it doesn't really fit this case and it would be hard to adjust because we don't have enough precision in the remainder. However, unless there's a huge need to keep it, I'd just fit to the closest 3 digit increment and then everything would work.
Quoted 3 lines
KM case:
K) if 1 MiB > value >= 0 — prints in KiB
M) if ∞ > value >= 1 MiB — prints in MiB.
Actually there is a way to do this: add a fixed precision argument that would stop the logarithmic reduction when the desired precision were reached. You'd still have to do the precision discrimination in the call, so something like
num > 1Mib ? call for precision of 6 : call for precision of 3
James
PATCH v3 4/4 x86/efi: Use proper units in efi_find_mirror()
In reply to Andy ShevchenkoLike in efi_print_mmap() use the proper units when printing sizes.
Currently it's hardcoded to 'MiB', though it might be changed to adaptive efi_size_format() in the future.
--- arch/x86/platform/efi/efi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/platform/efi/efi.c +2 -2
@@ -144,8 +144,8 @@ void __init efi_find_mirror(void) } }if (mirror_size) -pr_info ("Memory: %lldM/%lldM mirrored memory\n" , - mirror_size>>20 , total_size>>20 ); +pr_info ("Memory: %lld MiB/%lld MiB mirrored memory\n" , + mirror_size >>20 , total_size >>20 ); }/*
Signature · 1 line
2.7.0.rc3
Quoted 9 lines · Andy Shevchenko
The patch series exports the arrays of binary and decimal units as it's
described by IEC.First user of it is EFI code which would print sizes and other values using
binary prefix.James, is this now okay to you?
Patch 2 is still pointless. I happen to like the <tab><space>label:
convention. I realise others don't but an entire patch simply to change my convention to your convention is a bit overkill.
I'll comment on the rest in the patches.
James
Quoted 20 lines
Matt, I suppose we need to update the stuff in your tree.
Since v2:
- address James comment (don't nail array size)
- fix a title and commit message for patch 3 to be in align with the changeAndy Shevchenko (3):
lib/string_helpers: export string_units_{2,10} for otherslib/string_helpers: fix indentation in few places x86/efi: Use proper units inefi_find_mirror()Robert Elliott (1):
x86/efi: print size in binary units inefi_print_memmaparch/x86/platform/efi/efi.c | 27 ++++++++++++++++++--------- include/linux/string_helpers.h | 3 +++ lib/string_helpers.c | 26 ++++++++++++++------------ 3 files changed, 35 insertions(+), 21 deletions(-)
Quoted 5 lines · James Bottomley
Quoted 4 lines · Andy Shevchenko
The patch series exports the arrays of binary and decimal units as it's
described by IEC.
Quoted 8 lines
Quoted 5 lines
First user of it is EFI code which would print sizes and other values using
binary prefix.James, is this now okay to you?
Patch 2 is still pointless. I happen to like the <tab><space>label:
convention.
Even there it's just <space>label:
Quoted 2 lines
I realise others don't but an entire patch simply to
change my convention to your convention is a bit overkill.
Main point of that patch is to bring snprintf() to one line. Is it also your style?
Signature · 2 lines
With Best Regards, Andy Shevchenko