]> 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)
commita6c9bebf30975e70485deab89eb396f39bb27472
tree0e6b81c6bb908381eb851ef1a334a56943e9be6d
parent0093d2df02d4e11e0da02e94f52cf63263b16c41
kyber: fix another domain token wait queue hang

Commit 889cf6e3996b ("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