Skip to contentSkip to conversation

kho: Remove redundant 0x prefixes

PATCH Applied Thorsten Blum 3 participants 6 messages Nov 4

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 kho: Remove redundant 0x prefixes

The %pa format specifier already includes the 0x prefix. Remove the redundant prefixes to avoid printing 0x0x.

Use phys_addr_t for size to match the expected type.

Fixes c609c144b0e8 ("kexec: add KHO parsing support")

---
Changes in v2:
- Use phys_addr_t for size as suggested by Arnd (thanks!)
- v1: https://lore.kernel.org/r/[email protected]/

 kernel/liveupdate/kexec_handover.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/liveupdate/kexec_handover.c +3 -3
index 6f1f55fe3181..6a7600a0a7d5 100644
@@ -2010,16 +2010,16 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len,
 	 */
 	for (int i = 0; i < bootmem_cnt; i++) {
 		struct kho_bootmem *area = &bootmem[i];
-		u64 size = area->size;
+		phys_addr_t size = area->size;
 
 		memblock_add(area->addr, size);
 		err = memblock_mark_kho_noprsrv(area->addr, size);
 		if (err) {
-			pr_warn("failed to mark the bootmem region 0x%pa+0x%pa: %pe",
+			pr_warn("failed to mark the bootmem region %pa+%pa: %pe",
 				&area->addr, &size, ERR_PTR(err));
 			goto unmap_bootmem;
 		}
-		pr_debug("Marked 0x%pa+0x%pa as bootmem", &area->addr, &size);
+		pr_debug("Marked %pa+%pa as bootmem", &area->addr, &size);
 	}
 
 	memblock_reserve(bootmem_phys, bootmem_len);
maintainer
#2 lore raw
In reply to Thorsten Blum
Quoted 13 lines

The %pa format specifier already includes the 0x prefix. Remove the redundant prefixes to avoid printing 0x0x.

Use phys_addr_t for size to match the expected type.

Fixes c609c144b0e8 ("kexec: add KHO parsing support")
kernel/liveupdate/kexec_handover.c +0 -0
index 6f1f55fe3181..6a7600a0a7d5 100644

kernel/liveupdate/kexec_handover.c void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len, · line 2013

Quoted 5 lines
kernel/liveupdate/kexec_handover.c +1 -1
@@ -2010,16 +2010,16 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len,
 	 */
 	for (int i = 0; i < bootmem_cnt; i++) {
 		struct kho_bootmem *area = &bootmem[i];
-		u64 size = area->size;
+		phys_addr_t size = area->size;

I am not sure; having a variable size of type phys_addr_t looks strange to me. Furthermore, KHO only works on 64-bit platforms because of how our radix tree is designed, and we do not plan to add support for 32-bit systems.

I would keep u64, or if using %pa for u64 is still an eyesore, use 0x%llx for the size field.

Signature · 1 line
Pasha
#3 lore raw
Quoted 24 lines · Pasha Tatashin
Quoted 13 lines

The %pa format specifier already includes the 0x prefix. Remove the redundant prefixes to avoid printing 0x0x.

Use phys_addr_t for size to match the expected type.

Fixes c609c144b0e8 ("kexec: add KHO parsing support")
kernel/liveupdate/kexec_handover.c +0 -0
index 6f1f55fe3181..6a7600a0a7d5 100644

kernel/liveupdate/kexec_handover.c void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len, · line 2013

Quoted 5 lines
kernel/liveupdate/kexec_handover.c +1 -1
@@ -2010,16 +2010,16 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len,
 	 */
 	for (int i = 0; i < bootmem_cnt; i++) {
 		struct kho_bootmem *area = &bootmem[i];
-		u64 size = area->size;
+		phys_addr_t size = area->size;

I am not sure; having a variable size of type phys_addr_t looks strange to me. Furthermore, KHO only works on 64-bit platforms because of how our radix tree is designed, and we do not plan to add support for 32-bit systems.

Quoted 2 lines

I would keep u64, or if using %pa for u64 is still an eyesore, use 0x%llx for the size field.

area->size is also a phys_addr_t, so using a local variable of the same type makes sense for consistency.

Arnd

maintainer
#4 lore raw
Quoted 26 lines · Arnd Bergmann
Quoted 24 lines · Pasha Tatashin
Quoted 13 lines

The %pa format specifier already includes the 0x prefix. Remove the redundant prefixes to avoid printing 0x0x.

Use phys_addr_t for size to match the expected type.

Fixes c609c144b0e8 ("kexec: add KHO parsing support")
kernel/liveupdate/kexec_handover.c +0 -0
index 6f1f55fe3181..6a7600a0a7d5 100644

kernel/liveupdate/kexec_handover.c void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len, · line 2013

Quoted 5 lines
kernel/liveupdate/kexec_handover.c +1 -1
@@ -2010,16 +2010,16 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len,
      */
     for (int i = 0; i < bootmem_cnt; i++) {
             struct kho_bootmem *area = &bootmem[i];
-            u64 size = area->size;
+            phys_addr_t size = area->size;

I am not sure; having a variable size of type phys_addr_t looks strange to me. Furthermore, KHO only works on 64-bit platforms because of how our radix tree is designed, and we do not plan to add support for 32-bit systems.

Quoted 5 lines
Quoted 2 lines

I would keep u64, or if using %pa for u64 is still an eyesore, use 0x%llx for the size field.

area->size is also a phys_addr_t, so using a local variable of the same type makes sense for consistency.

True, that makes sense.

Thanks,
Pasha

Quoted 2 lines

Arnd