Re: Fwd: [PATCH 1/1] of/fdt: failed to mark hotplug range message

From: Heinrich Schuchardt
Date: Thu Dec 22 2016 - 17:58:52 EST


On 12/22/2016 10:49 PM, Reza Arbab wrote:
> On Thu, Dec 22, 2016 at 06:52:45AM +0100, Heinrich Schuchardt wrote:
>> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
>> index c9b5cac03b36..fd129b6e5396 100644
>> --- a/drivers/of/fdt.c
>> +++ b/drivers/of/fdt.c
>> @@ -1057,7 +1057,7 @@ int __init early_init_dt_scan_memory(unsigned
>> long node, const char *uname,
>>
>> if (early_init_dt_mark_hotplug_memory_arch(base, size))
>> pr_warn("failed to mark hotplug range 0x%llx - 0x%llx\n",
>> - base, base + size);
>> + base, base + size - 1);
>> }
>>
>> return 0;
>
> Isn't it implied that ranges printed this way are [start, end)?
>
> If not, the entire file should be fixed, not just this occurrence.
>
The output in the file drivers/of/fdt.c is currently inconsistent.
Alternative output formats are

pr_err("Reserved memory not supported, ignoring range %pa - %pa%s\n",
&base, &size, nomap ? " (nomap)" : "");

and

pr_debug("Reserved memory: reserved region for node '%s': base %pa, size
%ld MiB\n", uname, &base, (unsigned long)size / SZ_1M);

(Here we will see size = 0 for values less then 1 MiB.)

I expect intervals to be closed and not half open if not explicitly
indicated otherwise.

So I suggest we change all occurrences of interval output in
drivers/of/fdt.c to
0xfirstbyte - 0xlastbyte
where firstbyte = base and lastbyte = base + size - 1.

Using the %pa format code ensures that the length of the output matches
the bitness of address pointers in the system.

Best regards

Heinrich Schuchardt