summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.1/0006-usb-musb-cppi41_dma-Check-if-scheduling-is-required-.patch68
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp_3.1.bb2
2 files changed, 57 insertions, 13 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.1/0006-usb-musb-cppi41_dma-Check-if-scheduling-is-required-.patch b/recipes-kernel/linux/linux-ti33x-psp-3.1/0006-usb-musb-cppi41_dma-Check-if-scheduling-is-required-.patch
index 701c09d8..db7a7f22 100644
--- a/recipes-kernel/linux/linux-ti33x-psp-3.1/0006-usb-musb-cppi41_dma-Check-if-scheduling-is-required-.patch
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.1/0006-usb-musb-cppi41_dma-Check-if-scheduling-is-required-.patch
@@ -1,7 +1,7 @@
1From b564457d26931a00f8c5645981a00c1eb78e9a90 Mon Sep 17 00:00:00 2001 1From c5a0664fa68a8541c1400bf7330a072581b12c38 Mon Sep 17 00:00:00 2001
2From: Joel A Fernandes <joelagnel@ti.com> 2From: Joel A Fernandes <joelagnel@ti.com>
3Date: Sat, 12 Nov 2011 23:42:26 -0600 3Date: Sat, 12 Nov 2011 23:42:26 -0600
4Subject: [PATCH] usb::musb::cppi41_dma: Check if scheduling is required after DMA 4Subject: [PATCH v2] usb::musb::cppi41_dma: Check if scheduling is required after DMA
5 5
6Even after TX DMA, data can still be in the FIFO and we would keep 6Even after TX DMA, data can still be in the FIFO and we would keep
7rescheduling the worker thread in a polling fashion taking up a lot 7rescheduling the worker thread in a polling fashion taking up a lot
@@ -11,19 +11,64 @@ is required and sleep if so.
11This fixes high CPU load issue seen with g_mass_storage on a BeagleBone 11This fixes high CPU load issue seen with g_mass_storage on a BeagleBone
12and could potentially fix similar issues seen with other gadget drivers. 12and could potentially fix similar issues seen with other gadget drivers.
13 13
14v2 changes:
15Avoid rescheduling a "worker", this process involves a lot of workqueue
16related crunching that is unnecessary. If we're polling, we might as well
17do it with minimum overhead, and giving other processes CPU time at the
18same time.
19
14Signed-off-by: Joel A Fernandes <joelagnel@ti.com> 20Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
15--- 21---
16 drivers/usb/musb/cppi41_dma.c | 10 ++++++++++ 22 drivers/usb/musb/cppi41_dma.c | 30 ++++++++++++++++++------------
17 1 files changed, 10 insertions(+), 0 deletions(-) 23 1 files changed, 18 insertions(+), 12 deletions(-)
18 24
19diff --git a/drivers/usb/musb/cppi41_dma.c b/drivers/usb/musb/cppi41_dma.c 25diff --git a/drivers/usb/musb/cppi41_dma.c b/drivers/usb/musb/cppi41_dma.c
20index a24707c..e68c5d7 100644 26index a24707c..3ac58b1 100644
21--- a/drivers/usb/musb/cppi41_dma.c 27--- a/drivers/usb/musb/cppi41_dma.c
22+++ b/drivers/usb/musb/cppi41_dma.c 28+++ b/drivers/usb/musb/cppi41_dma.c
23@@ -1319,6 +1319,16 @@ void txdma_completion_work(struct work_struct *data) 29@@ -1283,6 +1283,7 @@ void cppi41_check_fifo_empty(struct cppi41 *cppi)
30 for (index = 0; index < USB_CPPI41_NUM_CH; index++) {
31 void __iomem *epio;
32 u16 csr;
33+ unsigned long flags;
34
35 tx_ch = &cppi->tx_cppi_ch[index];
36 if (tx_ch->tx_complete) {
37@@ -1299,29 +1300,34 @@ void cppi41_check_fifo_empty(struct cppi41 *cppi)
38 epio = tx_ch->end_pt->regs;
39 csr = musb_readw(epio, MUSB_TXCSR);
40
41- if (csr & (MUSB_TXCSR_TXPKTRDY |
42- MUSB_TXCSR_FIFONOTEMPTY))
43- resched = 1;
44- else {
45- tx_ch->tx_complete = 0;
46- musb_dma_completion(musb, index+1, 1);
47+ while (1) {
48+ csr = musb_readw(epio, MUSB_TXCSR);
49+ if(!(csr & (MUSB_TXCSR_TXPKTRDY |
50+ MUSB_TXCSR_FIFONOTEMPTY)))
51+ break;
52+ cond_resched();
53 }
54+ tx_ch->tx_complete = 0;
55+ spin_lock_irqsave(&musb->lock, flags);
56+ musb_dma_completion(musb, index+1, 1);
57+ spin_unlock_irqrestore(&musb->lock, flags);
58 }
59 }
60-
61- if (resched)
62- schedule_work(&cppi->txdma_work);
63 }
64
65 void txdma_completion_work(struct work_struct *data)
66 {
67 struct cppi41 *cppi = container_of(data, struct cppi41, txdma_work);
24 struct musb *musb = cppi->musb; 68 struct musb *musb = cppi->musb;
25 unsigned long flags; 69- unsigned long flags;
26 70
71- spin_lock_irqsave(&musb->lock, flags);
27+ /* 72+ /*
28+ * txdma worker thread can call schedule_work on itself and cause 73+ * txdma worker thread can call schedule_work on itself and cause
29+ * itself to be scheduled immediately and because the data might still 74+ * itself to be scheduled immediately and because the data might still
@@ -31,12 +76,11 @@ index a24707c..e68c5d7 100644
31+ * the worker to consume lot of CPU when the controller is slow, so we 76+ * the worker to consume lot of CPU when the controller is slow, so we
32+ * reschedule if necessary. 77+ * reschedule if necessary.
33+ */ 78+ */
34+ if (need_resched())
35+ cond_resched();
36+
37 spin_lock_irqsave(&musb->lock, flags);
38 cppi41_check_fifo_empty(cppi); 79 cppi41_check_fifo_empty(cppi);
39 spin_unlock_irqrestore(&musb->lock, flags); 80- spin_unlock_irqrestore(&musb->lock, flags);
81 }
82
83 /**
40-- 84--
411.7.4.1 851.7.4.1
42 86
diff --git a/recipes-kernel/linux/linux-ti33x-psp_3.1.bb b/recipes-kernel/linux/linux-ti33x-psp_3.1.bb
index 37f59cad..556ad5ab 100644
--- a/recipes-kernel/linux/linux-ti33x-psp_3.1.bb
+++ b/recipes-kernel/linux/linux-ti33x-psp_3.1.bb
@@ -11,7 +11,7 @@ MULTI_CONFIG_BASE_SUFFIX = ""
11 11
12BRANCH = "v3.1-staging" 12BRANCH = "v3.1-staging"
13SRCREV = "1d84d8853fa30cf3db2571a5aec572accca4e29d" 13SRCREV = "1d84d8853fa30cf3db2571a5aec572accca4e29d"
14MACHINE_KERNEL_PR_append = "r+gitr${SRCREV}" 14MACHINE_KERNEL_PR_append = "s+gitr${SRCREV}"
15 15
16COMPATIBLE_MACHINE = "(ti33x)" 16COMPATIBLE_MACHINE = "(ti33x)"
17 17