Re: question on xhci_handle_stopped_cmd_ring()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, back from a long sick leave

On 10.01.2019 11:39, Oliver Neukum wrote:
Hi,

looking at this code:


         /* ring command ring doorbell to restart the command ring */
         if ((xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) &&
             !(xhci->xhc_state & XHCI_STATE_DYING)) {
                 xhci->current_cmd = cur_cmd;
                 xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT);
                 xhci_ring_cmd_db(xhci);
         }

Something looks fishy to me. The timer is started before the door bell
is rung. I cannot see how you can guarantee the timeout given that
order. Should it be reversed?


Could be reversed as we took spin_lock_irqsave() before this, so it shouldn't
cause any race issues with command completion canceling the timeout timer
before it is started.

Then again, the command timeout is 5 seconds, spin lock is taken with local
irqs disabled. The only possible problem case I can see is a 5 second SMI
between starting the timer and ringing the doorbell.

Sound more like a theoretical issues, or am I missing something?

Anyways, If you send a patch I can apply it

-Mathias


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux