]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - block/kyber-iosched.c
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)
commitfcf38cdf332a81b20a59e3ebaea81f6b316bbe0c
tree0e6b81c6bb908381eb851ef1a334a56943e9be6d
parentae64f9bd1d3621b5e60d7363bc20afb46aede215
kyber: fix another domain token wait queue hang

Commit 8cf466602028 ("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