]> git.baikalelectronics.ru Git - kernel.git/commit
kyber: fix another domain token wait queue hang
authorOmar Sandoval <osandov@fb.com>
Wed, 6 Dec 2017 06:57:43 +0000 (22:57 -0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 6 Dec 2017 19:33:07 +0000 (12:33 -0700)
commitad99d259d5b18410ca8607aad026f008f07adcdc
tree0e6b81c6bb908381eb851ef1a334a56943e9be6d
parent801e5e26cc5ea4b1605798e8aa077abea774915f
kyber: fix another domain token wait queue hang

Commit 74517b21aa4b ("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: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/kyber-iosched.c