Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-8431

USBOHCI driver is using WorkQueue API on raised IRQL (in ISR)




      when testing Uniata driver with enable logging keyboard/mouse freeze was osbserved.
      (see http://jira.reactos.org/browse/CORE-8359)
      I've found the following messages in log:

      AtapiInterrupt(base): set CHECK_INTR_IDLE (2)
      AtapiInterrupt(base): exit with status 0x0
      (ntoskrnl/ex/work.c:351) EX: Work Queue Deadlock detected: 1
      (ntoskrnl/ex/work.c:353) Dynamic threads queued 1
      (lib/drivers/libusb/hub_controller.cpp:315) [USBOHCI] SCE Request B71AA140 TransferBufferLength 12 Flags 3 MDL 00000000
      (lib/drivers/libusb/hub_controller.cpp:326) [USBOHCI] Port 0: Status 0, Change 0
      (lib/drivers/libusb/hub_controller.cpp:326) [USBOHCI] Port 1: Status 0, Change 0
      (lib/drivers/libusb/hub_controller.cpp:326) [USBOHCI] Port 2: Status 0, Change 1
      Intr: VendorID+DeviceID/Rev 0x439c1002/0x0 (ex 0)
      unexpected, 1st chance

      Uniata doesn't use Work Queue, we were in ISR context, so the problem seems to be in USBOHCI.
      I mean using Work Queue API inside USBOHCI ISR.

      Work Queue API shall not be used on raised IRQL (e.g. in ISR).
      DPC must be used instead.
      If all necessary work can be done on DISPATCH level, do it inside DPC routine.
      Note, that thread creation, waiting on events, access to non-paged pool and most inter-thread communication is not allowed in this context.
      If some operations requires IRQL = PASSIVE_LEVEL, the following algorithm shoul be used:
      1. Special queue/list/etc. protected with SpinLock must be created
      2. Special Event must be created to notify thread about new tasks in the queue/list created
      3. WorkerThread shall process the queue and wait after that on the Event created
      4. DPC must initialize new item, insert in into the queue and notify Worker thread by setting associated Event and immediately exit.
      Note, DPC is not allowed to wait.


          Issue Links



              • Assignee:
                j_anderw Johannes Anderwald
                alter-1 alter-1
              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created: