aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2024-10-25 17:52:22 +0000
committerMark Johnston <markj@FreeBSD.org>2024-10-25 17:53:11 +0000
commit1f6f247b3526abd4d5927684735012220aefe373 (patch)
tree188b43ef5d04becd1ed9f5a3846a3fdee9af97a3
parentfff518117b40cbc3bca49073eed85dc725ebae4c (diff)
downloadsrc-1f6f247b3526.tar.gz
src-1f6f247b3526.zip
virtio_p9fs: Check for completions after enabling interrupts
Otherwise we can end up with a lost interrupt, causing lost request completion wakeups and hangs in the filesystem layer. Continue processing until we enable interrupts and then observe an empty queue, like other virtio drivers do. Sponsored by: Klara, Inc.
-rw-r--r--sys/dev/virtio/p9fs/virtio_p9fs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c
index 42f47a4f63cb..dae38a507428 100644
--- a/sys/dev/virtio/p9fs/virtio_p9fs.c
+++ b/sys/dev/virtio/p9fs/virtio_p9fs.c
@@ -222,11 +222,15 @@ vt9p_intr_complete(void *xsc)
P9_DEBUG(TRANS, "%s: completing\n", __func__);
VT9P_LOCK(chan);
+again:
while ((curreq = virtqueue_dequeue(vq, NULL)) != NULL) {
curreq->rc->tag = curreq->tc->tag;
wakeup_one(curreq);
}
- virtqueue_enable_intr(vq);
+ if (virtqueue_enable_intr(vq) != 0) {
+ virtqueue_disable_intr(vq);
+ goto again;
+ }
cv_signal(&chan->submit_cv);
VT9P_UNLOCK(chan);
}