[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2] xen/arm: Add 0x prefix when printing memory size in construct_domU
Hi Stefano, On 04/01/2023 23:47, Stefano Stabellini wrote: On Tue, 3 Jan 2023, Michal Orzel wrote:Printing memory size in hex without 0x prefix can be misleading, so add it. Also, take the opportunity to adhere to 80 chars line length limit by moving the printk arguments to the next line. Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx> --- Changes in v2: - was: "Print memory size in decimal in construct_domU" - stick to hex but add a 0x prefix - adhere to 80 chars line length limitHonestly I prefer decimal but also hex is fine. decimal is perfect for very small values, but as we print the amount in KB it will become a big mess. Here some examples (decimal first, then hexadecimal): 512MB: 524288 vs 0x80000 555MB: 568320 vs 0x8ac00 1GB: 1048576 vs 0x100000 512GB: 536870912 vs 0x20000000 1TB: 1073741824 vs 0x40000000For power of two values, you might be able to find your way with decimal. It is more difficult for non power of two unless you have a calculator in hand. The other option I suggested in v1 is to print the amount in KB/GB/MB. Would that be better? That said, to be honest, I am not entirely sure why we are actually printing in KB. It would seems strange that someone would create a guest with memory not aligned to 1MB. So I would consider to check the size is 1MB-aligned and then print the value in KB. This will remove one order of magnitude and make the value more readable in decimal. Cheers, -- Julien Grall
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |