git: 1f6f247b3526 - main - virtio_p9fs: Check for completions after enabling interrupts
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 25 Oct 2024 18:19:59 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=1f6f247b3526abd4d5927684735012220aefe373
commit 1f6f247b3526abd4d5927684735012220aefe373
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-10-25 17:52:22 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-10-25 17:53:11 +0000
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.
---
sys/dev/virtio/p9fs/virtio_p9fs.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
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);
}