Skip to contentSkip to conversation

dma: fix vchan_cookie_complete() debug print

PATCH Superseded Jonas Jensen 4 participants 9 messages Dec 6, 2013 – Jan 26, 2014 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma: fix vchan_cookie_complete() debug print

vd->tx.cookie is set zero on dma_cookie_complete(), save to local before printing it.

---

Notes:
dev_vdbg() could also be moved to happen earlier, what do you prefer?

Applies to next-20131206

 drivers/dma/virt-dma.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/virt-dma.h +3 -1
index 85c19d6..181b9526 100644
@@ -84,10 +84,12 @@ static inline bool vchan_issue_pending(struct virt_dma_chan *vc)
 static inline void vchan_cookie_complete(struct virt_dma_desc *vd)
 {
 	struct virt_dma_chan *vc = to_virt_chan(vd->tx.chan);
+	dma_cookie_t cookie;
 
+	cookie = vd->tx.cookie;
 	dma_cookie_complete(&vd->tx);
 	dev_vdbg(vc->chan.device->dev, "txd %p[%x]: marked complete\n",
-		vd, vd->tx.cookie);
+		 vd, cookie);
 	list_add_tail(&vd->node, &vc->desc_completed);
 
 	tasklet_schedule(&vc->task);
Signature · 1 line
1.8.2.1
#1 lore raw
Quoted 20 lines · Jonas Jensen

vd->tx.cookie is set zero on dma_cookie_complete(), save to local before printing it.

---

Notes:
dev_vdbg() could also be moved to happen earlier, what do you prefer?

Applies to next-20131206

 drivers/dma/virt-dma.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/virt-dma.h +0 -0
index 85c19d6..181b9526 100644
@@ -84,10 +84,12 @@ static inline bool vchan_issue_pending(struct virt_dma_chan *vc)
 static inline void vchan_cookie_complete(struct virt_dma_desc *vd)

drivers/dma/virt-dma.h static inline bool vchan_issue_pending(struct virt_dma_chan *vc) · line 93

Quoted 10 lines
drivers/dma/virt-dma.h +3 -1
 {
        struct virt_dma_chan *vc = to_virt_chan(vd->tx.chan);
+       dma_cookie_t cookie;
 
+       cookie = vd->tx.cookie;
        dma_cookie_complete(&vd->tx);
        dev_vdbg(vc->chan.device->dev, "txd %p[%x]: marked complete\n",
-               vd, vd->tx.cookie);
+                vd, cookie);
        list_add_tail(&vd->node, &vc->desc_completed);

This is a bit smaller:

drivers/dma/virt-dma.h +0 -0
index 85c19d63f9fb..7d6f611c7654 100644
@@ -85,9 +85,9 @@ static inline void vchan_cookie_complete(struct

virt_dma_desc *vd)

 {
        struct virt_dma_chan *vc = to_virt_chan(vd->tx.chan);
-       dma_cookie_complete(&vd->tx);
        dev_vdbg(vc->chan.device->dev, "txd %p[%x]: marked complete\n",
                vd, vd->tx.cookie);
+       dma_cookie_complete(&vd->tx);
        list_add_tail(&vd->node, &vc->desc_completed);
#2 lore raw

PATCH v2 1/1 dma: fix vchan_cookie_complete() debug print

In reply to Jonas Jensen

vchan_cookie_complete() is supposed to print the cookie value but it's always zero because:

dma_cookie_complete() is called prior to dev_vdbg()

Move the call, place it after dev_vdbg().

---

Notes:
Changes since v1:

1. remove local dma_cookie_t
2. call dma_cookie_complete() after dev_vdbg()

Applies to next-20131209

 drivers/dma/virt-dma.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/virt-dma.h +1 -1
index 85c19d6..7d6f611 100644
@@ -85,9 +85,9 @@ static inline void vchan_cookie_complete(struct virt_dma_desc *vd)
 {
 	struct virt_dma_chan *vc = to_virt_chan(vd->tx.chan);
 
-	dma_cookie_complete(&vd->tx);
 	dev_vdbg(vc->chan.device->dev, "txd %p[%x]: marked complete\n",
 		vd, vd->tx.cookie);
+	dma_cookie_complete(&vd->tx);
 	list_add_tail(&vd->node, &vc->desc_completed);
 
 	tasklet_schedule(&vc->task);
Signature · 1 line
1.8.2.1
Applied
#3 lore raw
Quoted 8 lines · Jonas Jensen

vchan_cookie_complete() is supposed to print the cookie value but it's always zero because:

dma_cookie_complete() is called prior to dev_vdbg()

Move the call, place it after dev_vdbg().

Applied, thanks

--
~Vinod

Quoted 31 lines

---

Notes:
Changes since v1:

1. remove local dma_cookie_t
2. call dma_cookie_complete() after dev_vdbg()

Applies to next-20131209

 drivers/dma/virt-dma.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/virt-dma.h +1 -1
index 85c19d6..7d6f611 100644
@@ -85,9 +85,9 @@ static inline void vchan_cookie_complete(struct virt_dma_desc *vd)
 {
 	struct virt_dma_chan *vc = to_virt_chan(vd->tx.chan);
 
-	dma_cookie_complete(&vd->tx);
 	dev_vdbg(vc->chan.device->dev, "txd %p[%x]: marked complete\n",
 		vd, vd->tx.cookie);
+	dma_cookie_complete(&vd->tx);
 	list_add_tail(&vd->node, &vc->desc_completed);
 
 	tasklet_schedule(&vc->task);
Signature · 1 line
1.8.2.1
#4 lore raw
In reply to Jonas Jensen
Quoted 8 lines · Jonas Jensen

vd->tx.cookie is set zero on dma_cookie_complete(), save to local before printing it.

---

Notes:
dev_vdbg() could also be moved to happen earlier, what do you prefer?

This would be preferred IMHO. Also pls cc dmaengine at vger on this

--
~Vinod

Quoted 27 lines
    
    Applies to next-20131206
 drivers/dma/virt-dma.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/virt-dma.h +3 -1
index 85c19d6..181b9526 100644
@@ -84,10 +84,12 @@ static inline bool vchan_issue_pending(struct virt_dma_chan *vc)
 static inline void vchan_cookie_complete(struct virt_dma_desc *vd)
 {
 	struct virt_dma_chan *vc = to_virt_chan(vd->tx.chan);
+	dma_cookie_t cookie;
 
+	cookie = vd->tx.cookie;
 	dma_cookie_complete(&vd->tx);
 	dev_vdbg(vc->chan.device->dev, "txd %p[%x]: marked complete\n",
-		vd, vd->tx.cookie);
+		 vd, cookie);
 	list_add_tail(&vd->node, &vc->desc_completed);
 
 	tasklet_schedule(&vc->task);
Signature · 1 line
1.8.2.1
#5 lore raw
Quoted 10 lines · Vinod Koul
Quoted 8 lines · Jonas Jensen

vd->tx.cookie is set zero on dma_cookie_complete(), save to local before printing it.

---

Notes:
dev_vdbg() could also be moved to happen earlier, what do you prefer?

This would be preferred IMHO. Also pls cc dmaengine at vger on this

I prefer this version - it means that the verbose debug printk doesn't impact the completion timing when printk is expensive (eg, because its outputting via a serial port.)

Signature · 3 lines
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
#6 lore raw
Quoted 8 lines · Russell King - ARM Linux
Quoted 7 lines · Vinod Koul
Quoted 6 lines · Jonas Jensen

vd->tx.cookie is set zero on dma_cookie_complete(), save to local before printing it.

---

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

Notes:
dev_vdbg() could also be moved to happen earlier, what do you prefer?

This would be preferred IMHO. Also pls cc dmaengine at vger on this

I prefer this version - it means that the verbose debug printk doesn't impact the completion timing when printk is expensive (eg, because its outputting via a serial port.)

But if you know your printk is costly, do you want to enable these?

Signature · 1 line
~Vinod
#7 lore raw
Quoted 9 lines · Vinod Koul
Quoted 8 lines · Russell King - ARM Linux
Quoted 7 lines · Vinod Koul
Quoted 6 lines · Jonas Jensen

vd->tx.cookie is set zero on dma_cookie_complete(), save to local before printing it.

---

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

Notes:
dev_vdbg() could also be moved to happen earlier, what do you prefer?

This would be preferred IMHO. Also pls cc dmaengine at vger on this

I prefer this version - it means that the verbose debug printk doesn't impact the completion timing when printk is expensive (eg, because its outputting via a serial port.)

But if you know your printk is costly, do you want to enable these?

dev_vdbg() is for verbose debugging - you only enable it if you really need to. Even so, it should have _minimal_ impact where possible. That's why I prefer the first patch, because we mark the cookie as being complete _before_ we call the verbose debugging, which isn't going to add milliseconds to that.

If you don't care about debugging, then getting rid of the dev_vdbg(). But really, I could pull rank and say that this is *my* file, I get to choose how stuff should be done here - I'd prefer not to but...

Signature · 3 lines
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
#8 lore raw
Quoted 17 lines · Russell King - ARM Linux
Quoted 16 lines · Vinod Koul
Quoted 15 lines · Russell King - ARM Linux
Quoted 10 lines · Vinod Koul
Quoted 8 lines · Jonas Jensen

vd->tx.cookie is set zero on dma_cookie_complete(), save to local before printing it.

---

Notes:
dev_vdbg() could also be moved to happen earlier, what do you prefer?

This would be preferred IMHO. Also pls cc dmaengine at vger on this

I prefer this version - it means that the verbose debug printk doesn't impact the completion timing when printk is expensive (eg, because its outputting via a serial port.)

Quoted 7 lines
Quoted 1 line

But if you know your printk is costly, do you want to enable these?

dev_vdbg() is for verbose debugging - you only enable it if you really need to. Even so, it should have _minimal_ impact where possible. That's why I prefer the first patch, because we mark the cookie as being complete _before_ we call the verbose debugging, which isn't going to add milliseconds to that.

Sure this version is better approach in that respect as it makes it debug aognostic! Both mine and Dan's comment were trying to simlify by ignoring debug option, but yes i do agree to you point here. So this patch will be applied!

Quoted 3 lines

If you don't care about debugging, then getting rid of the dev_vdbg(). But really, I could pull rank and say that this is *my* file, I get to choose how stuff should be done here - I'd prefer not to but...

That is not required!

--
~Vinod