high cpu load on omap3 using musb

From: Adam Wozniak
Date: Wed Jan 29 2014 - 11:44:28 EST


With a USB 2.0 webcam attached to the OTG port on an OMAP3 (applies to overo gumstix, beagleboard, probably others) we see a high CPU load in a kworker thread.

Between 2.6.33 and 2.6.34 musb_core.c changed.

IRQ handlers changed with the result that a worker in musb_core.c got scheduled far more frequently than needed.

I've included a patch below against 3.7, but i think it'll apply against mainline.
[I apologize for any whitespace mangling. I've also attached the patch.]

I'd like more eyeballs to tell me if this is right. I'd also like to know who I need to talk to to get this pushed into mainline.

--Adam

# The MUSB IRQ schedules work on every interrupt.
# This is unnecessary, and causes excessive CPU load.
#
# Here we only schedule work if there is something for
# the worker to do.

Index: git/drivers/usb/musb/musb_core.c
===================================================================
--- git.orig/drivers/usb/musb/musb_core.c
+++ git/drivers/usb/musb/musb_core.c
@@ -925,7 +925,9 @@ b_host:
}
#endif

- schedule_work(&musb->irq_work);
+ if (musb->xceiv->state != musb->xceiv_old_state) {
+ schedule_work(&musb->irq_work);
+ }

return handled;
}

# The MUSB IRQ schedules work on every interrupt.
# This is unnecessary, and causes excessive CPU load.
#
# Here we only schedule work if there is something for
# the worker to do.

Index: git/drivers/usb/musb/musb_core.c
===================================================================
--- git.orig/drivers/usb/musb/musb_core.c
+++ git/drivers/usb/musb/musb_core.c
@@ -925,7 +925,9 @@ b_host:
}
#endif

- schedule_work(&musb->irq_work);
+ if (musb->xceiv->state != musb->xceiv_old_state) {
+ schedule_work(&musb->irq_work);
+ }

return handled;
}