linux-ti33x-psp: Check if scheduling is required after DMA
authorJoel A Fernandes <joelagnel@ti.com>
Sun, 13 Nov 2011 15:11:18 +0000 (09:11 -0600)
committerKoen Kooi <koen@dominion.thruhere.net>
Sun, 13 Nov 2011 15:19:46 +0000 (16:19 +0100)
After processing one DMA completion, checking if rescheduling is
required instead of scheduling another completion request if the
FIFO is non empty.

This fixes high CPU load issue seen with g_mass_storage on a beaglebone
and could potentially fix similar issues seen with other gadget drivers

Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
recipes-kernel/linux/linux-ti33x-psp-3.1/0006-usb-musb-cppi41_dma-Check-if-scheduling-is-required-.patch [new file with mode: 0644]
recipes-kernel/linux/linux-ti33x-psp_3.1.bb

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
new file mode 100644 (file)
index 0000000..701c09d
--- /dev/null
@@ -0,0 +1,42 @@
+From b564457d26931a00f8c5645981a00c1eb78e9a90 Mon Sep 17 00:00:00 2001
+From: Joel A Fernandes <joelagnel@ti.com>
+Date: Sat, 12 Nov 2011 23:42:26 -0600
+Subject: [PATCH] usb::musb::cppi41_dma: Check if scheduling is required after DMA
+
+Even after TX DMA, data can still be in the FIFO and we would keep
+rescheduling the worker thread in a polling fashion taking up a lot
+of CPU if the controller was slow to respond. We check if rescheduling
+is required and sleep if so.
+
+This fixes high CPU load issue seen with g_mass_storage on a BeagleBone
+and could potentially fix similar issues seen with other gadget drivers.
+
+Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
+---
+ drivers/usb/musb/cppi41_dma.c |   10 ++++++++++
+ 1 files changed, 10 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/usb/musb/cppi41_dma.c b/drivers/usb/musb/cppi41_dma.c
+index a24707c..e68c5d7 100644
+--- a/drivers/usb/musb/cppi41_dma.c
++++ b/drivers/usb/musb/cppi41_dma.c
+@@ -1319,6 +1319,16 @@ void txdma_completion_work(struct work_struct *data)
+       struct musb *musb = cppi->musb;
+       unsigned long flags;
++      /*
++       * txdma worker thread can call schedule_work on itself and cause
++       * itself to be scheduled immediately and because the data might still
++       * be in FIFO if it hasn't been pushed out after DMA, it is possible for
++       * the worker to consume lot of CPU when the controller is slow, so we
++       * reschedule if necessary.
++       */
++      if (need_resched())
++              cond_resched();
++
+       spin_lock_irqsave(&musb->lock, flags);
+       cppi41_check_fifo_empty(cppi);
+       spin_unlock_irqrestore(&musb->lock, flags);
+-- 
+1.7.4.1
+
index c4cdfea9394744bf9f605fc86eecb367519ffddf..37f59cad635fc457bab5506d1c180610d2107d59 100644 (file)
@@ -11,7 +11,7 @@ MULTI_CONFIG_BASE_SUFFIX = ""
 
 BRANCH = "v3.1-staging"
 SRCREV = "1d84d8853fa30cf3db2571a5aec572accca4e29d"
 
 BRANCH = "v3.1-staging"
 SRCREV = "1d84d8853fa30cf3db2571a5aec572accca4e29d"
-MACHINE_KERNEL_PR_append = "q+gitr${SRCREV}"
+MACHINE_KERNEL_PR_append = "r+gitr${SRCREV}"
 
 COMPATIBLE_MACHINE = "(ti33x)"
 
 
 COMPATIBLE_MACHINE = "(ti33x)"
 
@@ -35,6 +35,7 @@ PATCHES_OVER_PSP = " \
        file://0003-arm-omap-mcspi-correct-memory-range-when-requesting-.patch \
        file://0004-arm-omap-mcspi-follow-proper-pm_runtime-enable-disab.patch \
        file://0005-arm-omap-mcspi-follow-proper-probe-remove-steps.patch \
        file://0003-arm-omap-mcspi-correct-memory-range-when-requesting-.patch \
        file://0004-arm-omap-mcspi-follow-proper-pm_runtime-enable-disab.patch \
        file://0005-arm-omap-mcspi-follow-proper-probe-remove-steps.patch \
+       file://0006-usb-musb-cppi41_dma-Check-if-scheduling-is-required-.patch \
        file://can/0001-can-d_can-Added-support-for-Bosch-D_CAN-controller.patch \
        file://can/0002-can-d_can-Added-platform-data-for-am33xx-device.patch \
        file://can/0003-can-d_can-DCAN-config-added-to-am335x_evm_defconfig.patch \
        file://can/0001-can-d_can-Added-support-for-Bosch-D_CAN-controller.patch \
        file://can/0002-can-d_can-Added-platform-data-for-am33xx-device.patch \
        file://can/0003-can-d_can-DCAN-config-added-to-am335x_evm_defconfig.patch \