ChangeSet 1.1832.55.34, 2004/09/08 11:08:27-07:00, [EMAIL PROTECTED] [PATCH] USB: EHCI SMP fix
This addresses an SMP-only issue with the EHCI driver, where only one CPU should scan the schedule at a time (scanning is not re-entrant) but either the IRQ handler or a watchdog timer could end up starting it. Many thanks to Olaf Hering for isolating the failure mode, and testing this fix! Once once CPU starts scanning, any other might as well finish right away. This fix just adds a flag to detect that case. Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> drivers/usb/host/ehci-hcd.c | 9 +++++++++ drivers/usb/host/ehci.h | 1 + 2 files changed, 10 insertions(+) diff -Nru a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c --- a/drivers/usb/host/ehci-hcd.c 2004-10-19 08:17:30 -07:00 +++ b/drivers/usb/host/ehci-hcd.c 2004-10-19 08:17:30 -07:00 @@ -695,9 +695,18 @@ timer_action_done (ehci, TIMER_IO_WATCHDOG); if (ehci->reclaim_ready) end_unlink_async (ehci, regs); + + /* another CPU may drop ehci->lock during a schedule scan while + * it reports urb completions. this flag guards against bogus + * attempts at re-entrant schedule scanning. + */ + if (ehci->scanning) + return; + ehci->scanning = 1; scan_async (ehci, regs); if (ehci->next_uframe != -1) scan_periodic (ehci, regs); + ehci->scanning = 0; /* the IO watchdog guards against hardware or driver bugs that * misplace IRQs, and should let us run completely without IRQs. diff -Nru a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h --- a/drivers/usb/host/ehci.h 2004-10-19 08:17:30 -07:00 +++ b/drivers/usb/host/ehci.h 2004-10-19 08:17:30 -07:00 @@ -53,6 +53,7 @@ struct ehci_qh *async; struct ehci_qh *reclaim; unsigned reclaim_ready : 1; + unsigned scanning : 1; /* periodic schedule support */ #define DEFAULT_I_TDPS 1024 /* some HCs can do less */ ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel