Skip to contentSkip to conversation

irqchip: Use %px to print pointer value

PATCH In review Jaedon Shin 5 participants 7 messages Feb 9, 2018 – Feb 12, 2018

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

PATCH 1/1 irqchip: Use %px to print pointer value

Since commit ad67b74d2469 ("printk: hash addresses printed with %p") pointers printed with %p are hashed. Use %px instead of %p to print pointer value.

---
 drivers/irqchip/irq-bcm7038-l1.c | 2 +-
 drivers/irqchip/irq-bcm7120-l2.c | 2 +-
 drivers/irqchip/irq-brcmstb-l2.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/irqchip/irq-bcm7038-l1.c +1 -1
index 55cfb986225b..f604c1d89b3b 100644
@@ -339,7 +339,7 @@ int __init bcm7038_l1_of_init(struct device_node *dn,
 		goto out_unmap;
 	}
 
-	pr_info("registered BCM7038 L1 intc (mem: 0x%p, IRQs: %d)\n",
+	pr_info("registered BCM7038 L1 intc (mem: 0x%px, IRQs: %d)\n",
 		intc->cpus[0]->map_base, IRQS_PER_WORD * intc->n_words);
 
 	return 0;
drivers/irqchip/irq-bcm7120-l2.c +1 -1
index 983640eba418..1cc4dd1d584a 100644
@@ -318,7 +318,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,
 		}
 	}
 
-	pr_info("registered %s intc (mem: 0x%p, parent IRQ(s): %d)\n",
+	pr_info("registered %s intc (mem: 0x%px, parent IRQ(s): %d)\n",
 			intc_name, data->map_base[0], data->num_parent_irqs);
 
 	return 0;
drivers/irqchip/irq-brcmstb-l2.c +1 -1
index 691d20eb0bec..6760edeeb666 100644
@@ -262,7 +262,7 @@ static int __init brcmstb_l2_intc_of_init(struct device_node *np,
 		ct->chip.irq_set_wake = irq_gc_set_wake;
 	}
 
-	pr_info("registered L2 intc (mem: 0x%p, parent irq: %d)\n",
+	pr_info("registered L2 intc (mem: 0x%px, parent irq: %d)\n",
 			base, parent_irq);
 
 	return 0;
Signature · 1 line
2.16.1
#1 lore raw

Hi Jaedon,

Quoted 5 lines · Jaedon Shin

Since commit ad67b74d2469 ("printk: hash addresses printed with %p") pointers printed with %p are hashed. Use %px instead of %p to print pointer value.

Thanks for your patch!

drivers/irqchip/irq-bcm7038-l1.c int __init bcm7038_l1_of_init(struct device_node *dn, · line 343

Quoted 9 lines
drivers/irqchip/irq-bcm7038-l1.c +1 -1
@@ -339,7 +339,7 @@ int __init bcm7038_l1_of_init(struct device_node *dn,
                goto out_unmap;
        }
 
-       pr_info("registered BCM7038 L1 intc (mem: 0x%p, IRQs: %d)\n",
+       pr_info("registered BCM7038 L1 intc (mem: 0x%px, IRQs: %d)\n",
                intc->cpus[0]->map_base, IRQS_PER_WORD * intc->n_words);

I believe the printing of this value should just be removed. Printing virtual addresses of mapped registers is usually not helpful, except for an attacker.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#2 lore raw
In reply to Jaedon Shin
Quoted 43 lines · Jaedon Shin

Since commit ad67b74d2469 ("printk: hash addresses printed with %p") pointers printed with %p are hashed. Use %px instead of %p to print pointer value.

---
 drivers/irqchip/irq-bcm7038-l1.c | 2 +-
 drivers/irqchip/irq-bcm7120-l2.c | 2 +-
 drivers/irqchip/irq-brcmstb-l2.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/irqchip/irq-bcm7038-l1.c +1 -1
index 55cfb986225b..f604c1d89b3b 100644
@@ -339,7 +339,7 @@ int __init bcm7038_l1_of_init(struct device_node *dn,
 		goto out_unmap;
 	}
 
-	pr_info("registered BCM7038 L1 intc (mem: 0x%p, IRQs: %d)\n",
+	pr_info("registered BCM7038 L1 intc (mem: 0x%px, IRQs: %d)\n",
 		intc->cpus[0]->map_base, IRQS_PER_WORD * intc->n_words);
 
 	return 0;
drivers/irqchip/irq-bcm7120-l2.c +1 -1
index 983640eba418..1cc4dd1d584a 100644
@@ -318,7 +318,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,
 		}
 	}
 
-	pr_info("registered %s intc (mem: 0x%p, parent IRQ(s): %d)\n",
+	pr_info("registered %s intc (mem: 0x%px, parent IRQ(s): %d)\n",
 			intc_name, data->map_base[0], data->num_parent_irqs);
 
 	return 0;
drivers/irqchip/irq-brcmstb-l2.c +0 -0
index 691d20eb0bec..6760edeeb666 100644

drivers/irqchip/irq-brcmstb-l2.c static int __init brcmstb_l2_intc_of_init(struct device_node *np, · line 268

Quoted 8 lines
drivers/irqchip/irq-brcmstb-l2.c +1 -1
@@ -262,7 +262,7 @@ static int __init brcmstb_l2_intc_of_init(struct device_node *np,
 		ct->chip.irq_set_wake = irq_gc_set_wake;
 	}
 
-	pr_info("registered L2 intc (mem: 0x%p, parent irq: %d)\n",
+	pr_info("registered L2 intc (mem: 0x%px, parent irq: %d)\n",
 			base, parent_irq);
 
 	return 0;

Why is that something useful to do? This just tells you where the device is mapped in the VA space, and I doubt that's a useful information, hashed pointers or not. Am I missing something obvious?

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#3 lore raw
Quoted 56 lines · Marc Zyngier
Quoted 4 lines · Jaedon Shin

Since commit ad67b74d2469 ("printk: hash addresses printed with %p") pointers printed with %p are hashed. Use %px instead of %p to print pointer value.

Review

Quoted 8 lines
---
 drivers/irqchip/irq-bcm7038-l1.c | 2 +-
 drivers/irqchip/irq-bcm7120-l2.c | 2 +-
 drivers/irqchip/irq-brcmstb-l2.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/irqchip/irq-bcm7038-l1.c

drivers/irqchip/irq-bcm7038-l1.c int __init bcm7038_l1_of_init(struct device_node

Quoted 4 lines

index 55cfb986225b..f604c1d89b3b 100644

drivers/irqchip/irq-bcm7038-l1.c +0 -0
@@ -339,7 +339,7 @@ int __init bcm7038_l1_of_init(struct device_node

*dn,

Review

Quoted 9 lines
drivers/irqchip/irq-bcm7038-l1.c +1 -1
 		goto out_unmap;
 	}
 
-	pr_info("registered BCM7038 L1 intc (mem: 0x%p, IRQs: %d)\n",
+	pr_info("registered BCM7038 L1 intc (mem: 0x%px, IRQs: %d)\n",
 		intc->cpus[0]->map_base, IRQS_PER_WORD * intc->n_words);
 
 	return 0;
(quoted diff) +0 -0

b/drivers/irqchip/irq-bcm7120-l2.c

drivers/irqchip/irq-bcm7120-l2.c static int __init bcm7120_l2_intc_probe(struct

Quoted 4 lines

index 983640eba418..1cc4dd1d584a 100644

drivers/irqchip/irq-bcm7120-l2.c +0 -0
@@ -318,7 +318,7 @@ static int __init bcm7120_l2_intc_probe(struct

device_node *dn,

Review

Quoted 9 lines
drivers/irqchip/irq-bcm7120-l2.c +1 -1
 		}
 	}
 
-	pr_info("registered %s intc (mem: 0x%p, parent IRQ(s): %d)\n",
+	pr_info("registered %s intc (mem: 0x%px, parent IRQ(s): %d)\n",
 			intc_name, data->map_base[0], data->num_parent_irqs);
 
 	return 0;
(quoted diff) +0 -0

b/drivers/irqchip/irq-brcmstb-l2.c

drivers/irqchip/irq-brcmstb-l2.c static int __init brcmstb_l2_intc_of_init(struct

Quoted 4 lines

index 691d20eb0bec..6760edeeb666 100644

drivers/irqchip/irq-brcmstb-l2.c +0 -0
@@ -262,7 +262,7 @@ static int __init brcmstb_l2_intc_of_init(struct

device_node *np,

Quoted 7 lines
drivers/irqchip/irq-brcmstb-l2.c +1 -1
 		ct->chip.irq_set_wake = irq_gc_set_wake;
 	}
 
-	pr_info("registered L2 intc (mem: 0x%p, parent irq: %d)\n",
+	pr_info("registered L2 intc (mem: 0x%px, parent irq: %d)\n",
 			base, parent_irq);
 
Quoted 7 lines

drivers/irqchip/irq-brcmstb-l2.c static int __init brcmstb_l2_intc_of_init(struct · line 268

Quoted 2 lines
drivers/irqchip/irq-brcmstb-l2.c +0 -0
 	return 0;

Why is that something useful to do? This just tells you where the device
is mapped in the VA space, and I doubt that's a useful information, hashed pointers or not. Am I missing something obvious?

No you are right there is not much value in printing the register virtual address (sometimes there is e.g: on MIPS) either we fix the prints to show the physical address of the base register or we could possibly drop the prints entirely.

Signature · 1 line
Florian
#4 lore raw
Quoted 65 lines · Florian Fainelli
Quoted 56 lines · Marc Zyngier
Quoted 4 lines · Jaedon Shin

Since commit ad67b74d2469 ("printk: hash addresses printed with %p") pointers printed with %p are hashed. Use %px instead of %p to print pointer value.

Review

Quoted 8 lines
---
 drivers/irqchip/irq-bcm7038-l1.c | 2 +-
 drivers/irqchip/irq-bcm7120-l2.c | 2 +-
 drivers/irqchip/irq-brcmstb-l2.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/irqchip/irq-bcm7038-l1.c

drivers/irqchip/irq-bcm7038-l1.c int __init bcm7038_l1_of_init(struct device_node

Quoted 4 lines

index 55cfb986225b..f604c1d89b3b 100644

drivers/irqchip/irq-bcm7038-l1.c +0 -0
@@ -339,7 +339,7 @@ int __init bcm7038_l1_of_init(struct device_node

*dn,

Review

Quoted 9 lines
drivers/irqchip/irq-bcm7038-l1.c +1 -1
 		goto out_unmap;
 	}
 
-	pr_info("registered BCM7038 L1 intc (mem: 0x%p, IRQs: %d)\n",
+	pr_info("registered BCM7038 L1 intc (mem: 0x%px, IRQs: %d)\n",
 		intc->cpus[0]->map_base, IRQS_PER_WORD * intc->n_words);
 
 	return 0;
(quoted diff) +0 -0

b/drivers/irqchip/irq-bcm7120-l2.c

drivers/irqchip/irq-bcm7120-l2.c static int __init bcm7120_l2_intc_probe(struct

Quoted 4 lines

index 983640eba418..1cc4dd1d584a 100644

drivers/irqchip/irq-bcm7120-l2.c +0 -0
@@ -318,7 +318,7 @@ static int __init bcm7120_l2_intc_probe(struct

device_node *dn,

Review

Quoted 9 lines
drivers/irqchip/irq-bcm7120-l2.c +1 -1
 		}
 	}
 
-	pr_info("registered %s intc (mem: 0x%p, parent IRQ(s): %d)\n",
+	pr_info("registered %s intc (mem: 0x%px, parent IRQ(s): %d)\n",
 			intc_name, data->map_base[0], data->num_parent_irqs);
 
 	return 0;
(quoted diff) +0 -0

b/drivers/irqchip/irq-brcmstb-l2.c

drivers/irqchip/irq-brcmstb-l2.c static int __init brcmstb_l2_intc_of_init(struct

Quoted 4 lines

index 691d20eb0bec..6760edeeb666 100644

drivers/irqchip/irq-brcmstb-l2.c +0 -0
@@ -262,7 +262,7 @@ static int __init brcmstb_l2_intc_of_init(struct

device_node *np,

Quoted 7 lines
drivers/irqchip/irq-brcmstb-l2.c +1 -1
 		ct->chip.irq_set_wake = irq_gc_set_wake;
 	}
 
-	pr_info("registered L2 intc (mem: 0x%p, parent irq: %d)\n",
+	pr_info("registered L2 intc (mem: 0x%px, parent irq: %d)\n",
 			base, parent_irq);
 
Quoted 7 lines

drivers/irqchip/irq-brcmstb-l2.c static int __init brcmstb_l2_intc_of_init(struct · line 268

Quoted 2 lines
drivers/irqchip/irq-brcmstb-l2.c +0 -0
 	return 0;

Why is that something useful to do? This just tells you where the device
is mapped in the VA space, and I doubt that's a useful information, hashed pointers or not. Am I missing something obvious?

Quoted 4 lines

No you are right there is not much value in printing the register virtual address (sometimes there is e.g: on MIPS) either we fix the prints to show the physical address of the base register or we could possibly drop the prints entirely.

Displaying the PA can be useful if you have several identical blocks in your system and you want to be able to identify them. Given that there is probably only one of these controllers per system, the address is pretty pointless.

If you send me a patch removing the prints, I'll queue it.

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#5 lore raw
Quoted 80 lines · Marc Zyngier
Quoted 65 lines · Florian Fainelli
Quoted 56 lines · Marc Zyngier
Quoted 4 lines · Jaedon Shin

Since commit ad67b74d2469 ("printk: hash addresses printed with %p") pointers printed with %p are hashed. Use %px instead of %p to print pointer value.

Review

Quoted 8 lines

---

drivers/irqchip/irq-bcm7038-l1.c | 2 +-
drivers/irqchip/irq-bcm7120-l2.c | 2 +-
drivers/irqchip/irq-brcmstb-l2.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/irqchip/irq-bcm7038-l1.c

drivers/irqchip/irq-bcm7038-l1.c int __init bcm7038_l1_of_init(struct device_node

Quoted 4 lines

index 55cfb986225b..f604c1d89b3b 100644

drivers/irqchip/irq-bcm7038-l1.c +0 -0
@@ -339,7 +339,7 @@ int __init bcm7038_l1_of_init(struct device_node

*dn,

Review

Quoted 9 lines
drivers/irqchip/irq-bcm7038-l1.c +1 -1
 		goto out_unmap;
 	}
 
-	pr_info("registered BCM7038 L1 intc (mem: 0x%p, IRQs: %d)\n",
+	pr_info("registered BCM7038 L1 intc (mem: 0x%px, IRQs: %d)\n",
 		intc->cpus[0]->map_base, IRQS_PER_WORD * intc->n_words);
 
 	return 0;
(quoted diff) +0 -0

b/drivers/irqchip/irq-bcm7120-l2.c

drivers/irqchip/irq-bcm7120-l2.c static int __init bcm7120_l2_intc_probe(struct

Quoted 4 lines

index 983640eba418..1cc4dd1d584a 100644

drivers/irqchip/irq-bcm7120-l2.c +0 -0
@@ -318,7 +318,7 @@ static int __init bcm7120_l2_intc_probe(struct

device_node *dn,

Review

Quoted 9 lines
drivers/irqchip/irq-bcm7120-l2.c +1 -1
 		}
 	}
 
-	pr_info("registered %s intc (mem: 0x%p, parent IRQ(s): %d)\n",
+	pr_info("registered %s intc (mem: 0x%px, parent IRQ(s): %d)\n",
 			intc_name, data->map_base[0], data->num_parent_irqs);
 
 	return 0;
(quoted diff) +0 -0

b/drivers/irqchip/irq-brcmstb-l2.c

drivers/irqchip/irq-brcmstb-l2.c static int __init brcmstb_l2_intc_of_init(struct

Quoted 4 lines

index 691d20eb0bec..6760edeeb666 100644

drivers/irqchip/irq-brcmstb-l2.c +0 -0
@@ -262,7 +262,7 @@ static int __init brcmstb_l2_intc_of_init(struct

device_node *np,

Quoted 7 lines
drivers/irqchip/irq-brcmstb-l2.c +1 -1
 		ct->chip.irq_set_wake = irq_gc_set_wake;
 	}
 
-	pr_info("registered L2 intc (mem: 0x%p, parent irq: %d)\n",
+	pr_info("registered L2 intc (mem: 0x%px, parent irq: %d)\n",
 			base, parent_irq);
 
Quoted 7 lines

drivers/irqchip/irq-brcmstb-l2.c static int __init brcmstb_l2_intc_of_init(struct · line 268

Quoted 2 lines
drivers/irqchip/irq-brcmstb-l2.c +0 -0
 	return 0;

Why is that something useful to do? This just tells you where the device
is mapped in the VA space, and I doubt that's a useful information, hashed pointers or not. Am I missing something obvious?

Quoted 4 lines

No you are right there is not much value in printing the register virtual address (sometimes there is e.g: on MIPS) either we fix the prints to show the physical address of the base register or we could possibly drop the prints entirely.

Displaying the PA can be useful if you have several identical blocks in your system and you want to be able to identify them. Given that there is probably only one of these controllers per system, the address is pretty pointless.

Quoted 7 lines

If you send me a patch removing the prints, I'll queue it.

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...

I'll submit a new one to drop the entire print.

Thanks,
Jaedon

#6 lore raw
In reply to Marc Zyngier
Quoted 71 lines · Marc Zyngier
Quoted 65 lines · Florian Fainelli
Quoted 56 lines · Marc Zyngier
Quoted 4 lines · Jaedon Shin

Since commit ad67b74d2469 ("printk: hash addresses printed with %p") pointers printed with %p are hashed. Use %px instead of %p to print pointer value.

Review

Quoted 8 lines
---
 drivers/irqchip/irq-bcm7038-l1.c | 2 +-
 drivers/irqchip/irq-bcm7120-l2.c | 2 +-
 drivers/irqchip/irq-brcmstb-l2.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/irqchip/irq-bcm7038-l1.c

drivers/irqchip/irq-bcm7038-l1.c int __init bcm7038_l1_of_init(struct device_node

Quoted 4 lines

index 55cfb986225b..f604c1d89b3b 100644

drivers/irqchip/irq-bcm7038-l1.c +0 -0
@@ -339,7 +339,7 @@ int __init bcm7038_l1_of_init(struct device_node

*dn,

Review

Quoted 9 lines
drivers/irqchip/irq-bcm7038-l1.c +1 -1
            goto out_unmap;
    }
 
-   pr_info("registered BCM7038 L1 intc (mem: 0x%p, IRQs: %d)\n",
+   pr_info("registered BCM7038 L1 intc (mem: 0x%px, IRQs: %d)\n",
            intc->cpus[0]->map_base, IRQS_PER_WORD * intc->n_words);
 
    return 0;
(quoted diff) +0 -0

b/drivers/irqchip/irq-bcm7120-l2.c

drivers/irqchip/irq-bcm7120-l2.c static int __init bcm7120_l2_intc_probe(struct

Quoted 4 lines

index 983640eba418..1cc4dd1d584a 100644

drivers/irqchip/irq-bcm7120-l2.c +0 -0
@@ -318,7 +318,7 @@ static int __init bcm7120_l2_intc_probe(struct

device_node *dn,

Review

Quoted 9 lines
drivers/irqchip/irq-bcm7120-l2.c +1 -1
            }
    }
 
-   pr_info("registered %s intc (mem: 0x%p, parent IRQ(s): %d)\n",
+   pr_info("registered %s intc (mem: 0x%px, parent IRQ(s): %d)\n",
                    intc_name, data->map_base[0], data->num_parent_irqs);
 
    return 0;
(quoted diff) +0 -0

b/drivers/irqchip/irq-brcmstb-l2.c

drivers/irqchip/irq-brcmstb-l2.c static int __init brcmstb_l2_intc_of_init(struct

Quoted 4 lines

index 691d20eb0bec..6760edeeb666 100644

drivers/irqchip/irq-brcmstb-l2.c +0 -0
@@ -262,7 +262,7 @@ static int __init brcmstb_l2_intc_of_init(struct

device_node *np,

Quoted 7 lines
drivers/irqchip/irq-brcmstb-l2.c +1 -1
            ct->chip.irq_set_wake = irq_gc_set_wake;
    }
 
-   pr_info("registered L2 intc (mem: 0x%p, parent irq: %d)\n",
+   pr_info("registered L2 intc (mem: 0x%px, parent irq: %d)\n",
                    base, parent_irq);
 
Quoted 7 lines

drivers/irqchip/irq-brcmstb-l2.c static int __init brcmstb_l2_intc_of_init(struct · line 268

Quoted 2 lines
drivers/irqchip/irq-brcmstb-l2.c +0 -0
    return 0;

Why is that something useful to do? This just tells you where the device
is mapped in the VA space, and I doubt that's a useful information, hashed pointers or not. Am I missing something obvious?

Quoted 4 lines

No you are right there is not much value in printing the register virtual address (sometimes there is e.g: on MIPS) either we fix the prints to show the physical address of the base register or we could possibly drop the prints entirely.

Quoted 4 lines

Displaying the PA can be useful if you have several identical blocks in your system and you want to be able to identify them. Given that there is probably only one of these controllers per system, the address is pretty pointless.

Multiple instances are actually quite common in the STB SoCs, e.g. bcm7362 has one instance of bcm7038-l1, two instances of bcm7120-l2 and four instances of brcmstb-l2.

Regards
Jonas

P.S: Also What about bcm6345-l1? It also prints it's mapped VAs, not the PAs.