Skip to content
  • Omar Sandoval's avatar
    kyber: fix another domain token wait queue hang · fcf38cdf
    Omar Sandoval authored
    Commit 8cf46660
    
     ("kyber: fix hang on domain token wait queue") fixed
    a hang caused by leaving wait entries on the domain token wait queue
    after the __sbitmap_queue_get() retry succeeded, making that wait entry
    a "dud" which won't in turn wake more entries up. However, we can also
    get a dud entry if kyber_get_domain_token() fails once but is then
    called again and succeeds. This can happen if the hardware queue is
    rerun for some other reason, or, more likely, kyber_dispatch_request()
    tries the same domain twice.
    
    The fix is to remove our entry from the wait queue whenever we
    successfully get a token. The only complication is that we might be on
    one of many wait queues in the struct sbitmap_queue, but that's easily
    fixed by remembering which wait queue we were put on.
    
    While we're here, only initialize the wait queue entry once instead of
    on every wait, and use spin_lock_irq() instead of spin_lock_irqsave(),
    since this is always called from process context with irqs enabled.
    
    Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    fcf38cdf