Skip to contentSkip to conversation

PATCH] mbuf: rte_pktmbuf_dump: don't add 0x when using %p in format strings

PATCH Applied Simon Kagstrom 6 participants 9 messages Jun 20, 2016 – Jun 24, 2016

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

I.e., avoid dump messages with double 0x0x, e.g.,

dump mbuf at 0x0x7fac7b17c800, phys=17b17c880, buf_len=2176

    pkt_len=2064, ol_flags=0, nb_segs=1, in_port=255
    segment at 0x0x7fac7b17c800, data=0x0x7fac7b17c8f0, data_len=2064
---
 lib/librte_mbuf/rte_mbuf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_mbuf/rte_mbuf.c +2 -2
index dc0467c..523e219 100644
@@ -218,7 +218,7 @@ rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)
 
 	__rte_mbuf_sanity_check(m, 1);
 
-	fprintf(f, "dump mbuf at 0x%p, phys=%"PRIx64", buf_len=%u\n",
+	fprintf(f, "dump mbuf at %p, phys=%"PRIx64", buf_len=%u\n",
 	       m, (uint64_t)m->buf_physaddr, (unsigned)m->buf_len);
 	fprintf(f, "  pkt_len=%"PRIu32", ol_flags=%"PRIx64", nb_segs=%u, "
 	       "in_port=%u\n", m->pkt_len, m->ol_flags,
@@ -228,7 +228,7 @@ rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)
 	while (m && nb_segs != 0) {
 		__rte_mbuf_sanity_check(m, 0);
 
-		fprintf(f, "  segment at 0x%p, data=0x%p, data_len=%u\n",
+		fprintf(f, "  segment at %p, data=%p, data_len=%u\n",
 			m, rte_pktmbuf_mtod(m, void *), (unsigned)m->data_len);
 		len = dump_len;
 		if (len > m->data_len)
Signature · 1 line
1.9.1
#1 lore raw
Quoted 7 lines · On Mon, 20 Jun 2016 12:44:35 +0200 Simon Kagstrom…

I.e., avoid dump messages with double 0x0x, e.g.,

dump mbuf at 0x0x7fac7b17c800, phys=17b17c880, buf_len=2176

    pkt_len=2064, ol_flags=0, nb_segs=1, in_port=255
    segment at 0x0x7fac7b17c800, data=0x0x7fac7b17c8f0, data_len=2064

Agreed. Many other places have same glitch.

$ git grep '0x%p'
drivers/net/vmxnet3/vmxnet3_rxtx.c:                "RXQ: cmd0 base : 0x%p cmd1 base : 0x%p comp ring base : 0x%p.",
drivers/net/vmxnet3/vmxnet3_rxtx.c:     PMD_TX_LOG(DEBUG, "TXQ: cmd base : 0x%p comp ring base : 0x%p data ring base : 0x%p.",
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c:      printk(KERN_DEBUG "ixgbe_get_regs_2 0x%p\n", hw->hw_addr);
lib/librte_eal/linuxapp/kni/kni_misc.c: KNI_PRINT("tx_phys:      0x%016llx, tx_q addr:      0x%p\n",
lib/librte_eal/linuxapp/kni/kni_misc.c: KNI_PRINT("rx_phys:      0x%016llx, rx_q addr:      0x%p\n",
lib/librte_eal/linuxapp/kni/kni_misc.c: KNI_PRINT("alloc_phys:   0x%016llx, alloc_q addr:   0x%p\n",
lib/librte_eal/linuxapp/kni/kni_misc.c: KNI_PRINT("free_phys:    0x%016llx, free_q addr:    0x%p\n",
lib/librte_eal/linuxapp/kni/kni_misc.c: KNI_PRINT("req_phys:     0x%016llx, req_q addr:     0x%p\n",
lib/librte_eal/linuxapp/kni/kni_misc.c: KNI_PRINT("resp_phys:    0x%016llx, resp_q addr:    0x%p\n",
lib/librte_eal/linuxapp/kni/kni_misc.c: KNI_PRINT("mbuf_phys:    0x%016llx, mbuf_kva:       0x%p\n",
lib/librte_eal/linuxapp/kni/kni_misc.c: KNI_PRINT("mbuf_va:      0x%p\n", dev_info.mbuf_va);
lib/librte_eal/linuxapp/kni/kni_misc.c:                 KNI_DBG("PCI found: pci=0x%p, lad_dev=0x%p\n",
lib/librte_mbuf/rte_mbuf.c:     fprintf(f, "dump mbuf at 0x%p, phys=%"PRIx64", buf_len=%u\n",
lib/librte_mbuf/rte_mbuf.c:             fprintf(f, "  segment at 0x%p, data=0x%p, data_len=%u\n",
#2 lore raw
Quoted 5 lines · Stephen Hemminger
Quoted 2 lines · On Mon, 20 Jun 2016 12:44:35 +0200 Simon Kagstrom…

I.e., avoid dump messages with double 0x0x, e.g.,

Quoted 8 lines
Quoted 5 lines

dump mbuf at 0x0x7fac7b17c800, phys=17b17c880, buf_len=2176

    pkt_len=2064, ol_flags=0, nb_segs=1, in_port=255
    segment at 0x0x7fac7b17c800, data=0x0x7fac7b17c8f0, data_len=2064

Agreed. Many other places have same glitch.

Hi Simon,

Are you planning to extend your patch to fix all, or I can send a patch for kni and vmxnet3?

Thanks,
ferruh

#3 lore raw
Quoted 10 lines · Ferruh Yigit
Quoted 9 lines · Stephen Hemminger
Quoted 6 lines · On Mon, 20 Jun 2016 12:44:35 +0200 Simon Kagstrom…

I.e., avoid dump messages with double 0x0x, e.g.,

dump mbuf at 0x0x7fac7b17c800, phys=17b17c880, buf_len=2176

    pkt_len=2064, ol_flags=0, nb_segs=1, in_port=255
    segment at 0x0x7fac7b17c800, data=0x0x7fac7b17c8f0, data_len=2064
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Agreed. Many other places have same glitch.

Are you planning to extend your patch to fix all, or I can send a patch for kni and vmxnet3?

I wasn't planning on that (this is something I just stumbled upon), so please go ahead!

// Simon

#4 lore raw

PATCH 1/1 vmxnet3: remove 0x prefix for %p format

To prevent double 0x in logs

---
 drivers/net/vmxnet3/vmxnet3_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/vmxnet3/vmxnet3_rxtx.c +2 -2
index ccafc0c..1e0fde0 100644
@@ -96,7 +96,7 @@ vmxnet3_rxq_dump(struct vmxnet3_rx_queue *rxq)
 		return;
 
 	PMD_RX_LOG(DEBUG,
-		   "RXQ: cmd0 base : 0x%p cmd1 base : 0x%p comp ring base : 0x%p.",
+		   "RXQ: cmd0 base : %p cmd1 base : %p comp ring base : %p.",
 		   rxq->cmd_ring[0].base, rxq->cmd_ring[1].base, rxq->comp_ring.base);
 	PMD_RX_LOG(DEBUG,
 		   "RXQ: cmd0 basePA : 0x%lx cmd1 basePA : 0x%lx comp ring basePA : 0x%lx.",
@@ -126,7 +126,7 @@ vmxnet3_txq_dump(struct vmxnet3_tx_queue *txq)
 	if (txq == NULL)
 		return;
 
-	PMD_TX_LOG(DEBUG, "TXQ: cmd base : 0x%p comp ring base : 0x%p data ring base : 0x%p.",
+	PMD_TX_LOG(DEBUG, "TXQ: cmd base : %p comp ring base : %p data ring base : %p.",
 		   txq->cmd_ring.base, txq->comp_ring.base, txq->data_ring.base);
 	PMD_TX_LOG(DEBUG, "TXQ: cmd basePA : 0x%lx comp ring basePA : 0x%lx data ring basePA : 0x%lx.",
 		   (unsigned long)txq->cmd_ring.basePA,
Signature · 1 line
2.5.5
#7 lore raw
In reply to Simon Kågström
Quoted 13 lines · Simon Kågström
Quoted 12 lines · Ferruh Yigit
Quoted 11 lines · Stephen Hemminger
Quoted 7 lines · On Mon, 20 Jun 2016 12:44:35 +0200 Simon Kagstrom…

I.e., avoid dump messages with double 0x0x, e.g.,

dump mbuf at 0x0x7fac7b17c800, phys=17b17c880, buf_len=2176

    pkt_len=2064, ol_flags=0, nb_segs=1, in_port=255
    segment at 0x0x7fac7b17c800, data=0x0x7fac7b17c8f0, data_len=2064
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Agreed. Many other places have same glitch.

Are you planning to extend your patch to fix all, or I can send a patch for kni and vmxnet3?

I wasn't planning on that (this is something I just stumbled upon), so please go ahead!

For KNI, 0x%p is valid usage for printk(), so only sending patch for vmxnet3.

Thanks,
ferruh

Acked-by on v1 1/1
#5 lore raw

Re: [PATCH] vmxnet3: remove 0x prefix for %p format

In reply to Ferruh Yigit
Quoted 6 lines · Ferruh Yigit

To prevent double 0x in logs

—

Quoted 28 lines

drivers/net/vmxnet3/vmxnet3_rxtx.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/vmxnet3/vmxnet3_rxtx.c +2 -2
index ccafc0c..1e0fde0 100644
@@ -96,7 +96,7 @@ vmxnet3_rxq_dump(struct vmxnet3_rx_queue *rxq)
 		return;
 
 	PMD_RX_LOG(DEBUG,
-		   "RXQ: cmd0 base : 0x%p cmd1 base : 0x%p comp ring base : 0x%p.",
+		   "RXQ: cmd0 base : %p cmd1 base : %p comp ring base : %p.",
 		   rxq->cmd_ring[0].base, rxq->cmd_ring[1].base, rxq->comp_ring.base);
 	PMD_RX_LOG(DEBUG,
 		   "RXQ: cmd0 basePA : 0x%lx cmd1 basePA : 0x%lx comp ring basePA : 0x%lx.",
@@ -126,7 +126,7 @@ vmxnet3_txq_dump(struct vmxnet3_tx_queue *txq)
 	if (txq == NULL)
 		return;
 
-	PMD_TX_LOG(DEBUG, "TXQ: cmd base : 0x%p comp ring base : 0x%p data ring base : 0x%p.",
+	PMD_TX_LOG(DEBUG, "TXQ: cmd base : %p comp ring base : %p data ring base : %p.",
 		   txq->cmd_ring.base, txq->comp_ring.base, txq->data_ring.base);
 	PMD_TX_LOG(DEBUG, "TXQ: cmd basePA : 0x%lx comp ring basePA : 0x%lx data ring basePA : 0x%lx.",
 		   (unsigned long)txq->cmd_ring.basePA,
Signature · 1 line
2.5.5