Skip to contentSkip to conversation

DMA: PL330: allow submitting 2 requests at a time

PATCH New Alvaro Moran 2 participants 6 messages Feb 7, 2013 – Feb 13, 2013 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 DMA: PL330: allow submitting 2 requests at a time

Due to the original driver design, only one request was processed at a time by the driver, even if the low-level part of the driver was able to handle 2 requests.
With this patch we are able to create 2 microcodes per thread and to launch the second transfer on the interrupt handler of the first one, instead of having to wait for the tasklet to generate the microcode.

---
 drivers/dma/pl330.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/dma/pl330.c +9 -2
index 80680ee..7814f8e 100644
@@ -486,6 +486,8 @@ struct pl330_thread {
 	/* Index of the last submitted request or -1 if the DMA is stopped */
 	int req_running;
 };
+/* We handle two requests at a time */
+#define NR_MAX_REQUESTS	2
 
 enum pl330_dmac_state {
 	UNINIT,
@@ -2276,13 +2278,18 @@ static inline void handle_cyclic_desc_list(struct list_head *list)
 static inline void fill_queue(struct dma_pl330_chan *pch)
 {
 	struct dma_pl330_desc *desc;
+	int busy_reqs = 0;
 	int ret;
 
 	list_for_each_entry(desc, &pch->work_list, node) {
 
 		/* If already submitted */
-		if (desc->status == BUSY)
-			break;
+		if (desc->status == BUSY) {
+			busy_reqs++;
+			if (busy_reqs == NR_MAX_REQUESTS)
+				break;
+			continue;
+		}
 
 		ret = pl330_submit_req(pch->pl330_chid,
 						&desc->req);
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 DMA: PL330: allow submitting 2 requests at a time

Quoted 7 lines · Alvaro Moran

Due to the original driver design, only one request was processed at a time by the driver, even if the low-level part of the driver was able to handle 2 requests.
With this patch we are able to create 2 microcodes per thread and to launch the second transfer on the interrupt handler of the first one, instead of having to wait for the tasklet to generate the microcode.

The following seems more appropriate and complete. Does it fix your problem?

drivers/dma/pl330.c +0 -0
index 758122f..a821d71 100644
@@ -2292,13 +2292,12 @@ static inline void fill_queue(struct

dma_pl330_chan *pch)

/* If already submitted */
if (desc->status == BUSY)
- break;
+ continue;

ret = pl330_submit_req(pch->pl330_chid,
&desc->req);
if (!ret) {
desc->status = BUSY;
- break;
} else if (ret == -EAGAIN) {
/* QFull or DMAC Dying */ break;

author
#2 lore raw

PATCH 1/1 DMA: PL330: allow submitting 2 requests at a time

Quoted 29 lines · Jassi Brar
Quoted 7 lines · Alvaro Moran

Due to the original driver design, only one request was processed at a time by the driver, even if the low-level part of the driver was able to handle 2 requests.
With this patch we are able to create 2 microcodes per thread and to launch the second transfer on the interrupt handler of the first one, instead of having to wait for the tasklet to generate the microcode.

The following seems more appropriate and complete. Does it fix your problem?

drivers/dma/pl330.c +1 -2
index 758122f..a821d71 100644
@@ -2292,13 +2292,12 @@ static inline void fill_queue(struct
 dma_pl330_chan *pch)
 
  		/* If already submitted */
  		if (desc->status == BUSY)
-			break;
+			continue;
 
  		ret = pl330_submit_req(pch->pl330_chid,
  						&desc->req);
  		if (!ret) {
  			desc->status = BUSY;
-			break;
  		} else if (ret == -EAGAIN) {
  			/* QFull or DMAC Dying */
Quoted 1 line

break;

Actually that isn't good enough. With your patch it will keep on looping on the pch->work_list entries, but it will call pl330_submit_req the first time only. I want it to call the function twice, so it will generate 2 microcodes (one per available request) and it will be ready the moment we get into the interrupt handler.

#3 lore raw

PATCH 1/1 DMA: PL330: allow submitting 2 requests at a time

Quoted 26 lines · On Thu, Feb 7, 2013 at 7:16 PM, dirac3000 <[email protected]> wrote:
Quoted 24 lines · Jassi Brar
Quoted 8 lines · Alvaro Moran

Due to the original driver design, only one request was processed at a time by the driver, even if the low-level part of the driver was able to handle 2 requests.
With this patch we are able to create 2 microcodes per thread and to launch the second transfer on the interrupt handler of the first one, instead of having to wait for the tasklet to generate the microcode.

The following seems more appropriate and complete. Does it fix your problem?

drivers/dma/pl330.c +1 -1
index 758122f..a821d71 100644
@@ -2292,13 +2292,12 @@ static inline void fill_queue(struct
 dma_pl330_chan *pch)
 
                /* If already submitted */
                if (desc->status == BUSY)
-                       break;
+                       continue;
 
Quoted 16 lines
Quoted 8 lines
drivers/dma/pl330.c +0 -1
                ret = pl330_submit_req(pch->pl330_chid,
                                                &desc->req);
                if (!ret) {
                        desc->status = BUSY;
-                       break;
                } else if (ret == -EAGAIN) {
                        /* QFull or DMAC Dying */
                        break;

Actually that isn't good enough. With your patch it will keep on looping on the pch->work_list entries, but it will call pl330_submit_req the first time only. I want it to call the function twice, so it will generate 2 microcodes (one per available request) and it will be ready the moment we get into the interrupt handler.

Why would it "keep on looping"? It's a for loop that will exit after iterating over the list once or when the lower layer indicates QFull - whichever comes first. Practically it achieves the same effect only without introducing a new local variable 'busy_reqs'
Did you actually test the patch? If yes and it didn't work, please share some log suitable log.
thnx.

author
#4 lore raw

PATCH 1/1 DMA: PL330: allow submitting 2 requests at a time

Quoted 44 lines · Jassi Brar
Quoted 26 lines · On Thu, Feb 7, 2013 at 7:16 PM, dirac3000<[email protected]> wrote:
Quoted 24 lines · Jassi Brar
Quoted 8 lines · Alvaro Moran

Due to the original driver design, only one request was processed at a time by the driver, even if the low-level part of the driver was able to handle 2 requests.
With this patch we are able to create 2 microcodes per thread and to launch the second transfer on the interrupt handler of the first one, instead of having to wait for the tasklet to generate the microcode.

The following seems more appropriate and complete. Does it fix your problem?

drivers/dma/pl330.c +1 -1
index 758122f..a821d71 100644
@@ -2292,13 +2292,12 @@ static inline void fill_queue(struct
 dma_pl330_chan *pch)
 
                 /* If already submitted */
                 if (desc->status == BUSY)
-                       break;
+                       continue;
 
Quoted 16 lines
Quoted 8 lines
drivers/dma/pl330.c +0 -1
                 ret = pl330_submit_req(pch->pl330_chid,
                                                 &desc->req);
                 if (!ret) {
                         desc->status = BUSY;
-                       break;
                 } else if (ret == -EAGAIN) {
                         /* QFull or DMAC Dying */
                         break;

Actually that isn't good enough. With your patch it will keep on looping on the pch->work_list entries, but it will call pl330_submit_req the first time only. I want it to call the function twice, so it will generate 2 microcodes (one per available request) and it will be ready the moment we get into the interrupt handler.

Quoted 7 lines

Why would it "keep on looping"? It's a for loop that will exit after iterating over the list once or when the lower layer indicates QFull - whichever comes first. Practically it achieves the same effect only without introducing a new local variable 'busy_reqs'
Did you actually test the patch? If yes and it didn't work, please share some log suitable log.
thnx.

Oh, my fault, you are right, I didn't read it carefully!
Now I actually tested the patch, so I am 100% sure it works and it increases the performance of the requests when they are correctly queued.

Thanks,

-Alvaro

author
#5 lore raw

PATCH 1/1 DMA: PL330: allow submitting 2 requests at a time

Quoted 61 lines · On 02/07/2013 06:08 PM, dirac3000 wrote:
Quoted 50 lines · Jassi Brar
Quoted 40 lines · On Thu, Feb 7, 2013 at 7:16 PM, dirac3000<[email protected]> wrote:
Quoted 33 lines · Jassi Brar
Quoted 9 lines · Alvaro Moran

Due to the original driver design, only one request was processed at a time by the driver, even if the low-level part of the driver was able to
handle 2 requests.
With this patch we are able to create 2 microcodes per thread and to launch the second transfer on the interrupt handler of the first one, instead of having to wait for the tasklet to generate the microcode.

The following seems more appropriate and complete. Does it fix your problem?

drivers/dma/pl330.c +1 -2
index 758122f..a821d71 100644
@@ -2292,13 +2292,12 @@ static inline void fill_queue(struct
 dma_pl330_chan *pch)
 
 /* If already submitted */
 if (desc->status == BUSY)
- break;
+ continue;
 
 ret = pl330_submit_req(pch->pl330_chid,
 &desc->req);
 if (!ret) {
 desc->status = BUSY;
- break;
 } else if (ret == -EAGAIN) {
 /* QFull or DMAC Dying */
Quoted 1 line

break;

Actually that isn't good enough. With your patch it will keep on

Quoted 8 lines

looping on
the pch->work_list entries, but it will call pl330_submit_req the first time
only. I want it to call the function twice, so it will generate 2 microcodes
(one per available request) and it will be ready the moment we get into the
interrupt handler.

Quoted 7 lines

Why would it "keep on looping"? It's a for loop that will exit after iterating over the list once or when the lower layer indicates QFull - whichever comes first. Practically it achieves the same effect only without introducing a new local variable 'busy_reqs'
Did you actually test the patch? If yes and it didn't work, please share some log suitable log.
thnx.

Quoted 7 lines

Oh, my fault, you are right, I didn't read it carefully!
Now I actually tested the patch, so I am 100% sure it works and it increases the performance of the requests when they are correctly queued.

Thanks,

-Alvaro

As I told you in a previous email I tested the patch and it works fine. Any chance of seeing it accepted in the next version?