1
0
mirror of https://git.yoctoproject.org/meta-ti synced 2026-05-06 19:39:17 +00:00

linux-ti33x-psp: Check if scheduling is required after DMA

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>
This commit is contained in:
Joel A Fernandes
2011-11-13 09:11:18 -06:00
committed by Koen Kooi
parent 77208efef6
commit c4310e7216
2 changed files with 44 additions and 1 deletions

View File

@@ -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

View File

@@ -11,7 +11,7 @@ MULTI_CONFIG_BASE_SUFFIX = ""
BRANCH = "v3.1-staging"
SRCREV = "1d84d8853fa30cf3db2571a5aec572accca4e29d"
MACHINE_KERNEL_PR_append = "q+gitr${SRCREV}"
MACHINE_KERNEL_PR_append = "r+gitr${SRCREV}"
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://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 \