Skip to contentSkip to conversation

virtio-pmem: ignore empty queue notifications

PATCH In review Li Chen 3 participants 3 messages Jan 6 – Feb 5

lore
Share & tools
lore

Li Chen

author
#0 lore raw

PATCH 1/1 virtio-pmem: ignore empty queue notifications

From: Li Chen <[email protected]>

virtio_pmem_flush() treats a NULL return from virtqueue_pop() as a fatal error and calls virtio_error(), which puts the device into NEEDS_RESET.

However, virtqueue handlers can be invoked when no element is available, so an empty queue should be handled as a benign no-op.

With a Linux guest this avoids spurious NEEDS_RESET and the resulting -EIO propagation (e.g. EXT4 journal abort and remount-ro).

---
 hw/virtio/virtio-pmem.c | 1 -
 1 file changed, 1 deletion(-)
hw/virtio/virtio-pmem.c +0 -1
index 3416ea1827..cec1072f78 100644
@@ -74,7 +74,6 @@ static void virtio_pmem_flush(VirtIODevice *vdev, VirtQueue *vq)
     trace_virtio_pmem_flush_request();
     req_data = virtqueue_pop(vq, sizeof(VirtIODeviceRequest));
     if (!req_data) {
-        virtio_error(vdev, "virtio-pmem missing request data");
         return;
     }
 
Signature · 1 line
2.52.0
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Li Chen

From: Li Chen <[email protected]>

virtio_pmem_flush() treats a NULL return from virtqueue_pop() as a fatal error and calls virtio_error(), which puts the device into NEEDS_RESET.

Quoted 7 lines

However, virtqueue handlers can be invoked when no element is available, so an empty queue should be handled as a benign no-op.

With a Linux guest this avoids spurious NEEDS_RESET and the resulting -EIO propagation (e.g. EXT4 journal abort and remount-ro).

Quoted 18 lines
---
 hw/virtio/virtio-pmem.c | 1 -
 1 file changed, 1 deletion(-)
hw/virtio/virtio-pmem.c +0 -1
index 3416ea1827..cec1072f78 100644
@@ -74,7 +74,6 @@ static void virtio_pmem_flush(VirtIODevice *vdev, VirtQueue *vq)
     trace_virtio_pmem_flush_request();
     req_data = virtqueue_pop(vq, sizeof(VirtIODeviceRequest));
     if (!req_data) {
-        virtio_error(vdev, "virtio-pmem missing request data");
         return;
     }
 
Signature · 1 line
2.52.0
#2 lore raw
In reply to Li Chen
Quoted 10 lines · Li Chen

From: Li Chen <[email protected]>

virtio_pmem_flush() treats a NULL return from virtqueue_pop() as a fatal error and calls virtio_error(), which puts the device into NEEDS_RESET.

However, virtqueue handlers can be invoked when no element is available, so an empty queue should be handled as a benign no-op.

With a Linux guest this avoids spurious NEEDS_RESET and the resulting -EIO propagation (e.g. EXT4 journal abort and remount-ro).

This feels like a qemu-stable material.

Please let me know if it isn't.

Thanks,

/mjt

Quoted 17 lines
---
  hw/virtio/virtio-pmem.c | 1 -
  1 file changed, 1 deletion(-)
hw/virtio/virtio-pmem.c +0 -1
index 3416ea1827..cec1072f78 100644
@@ -74,7 +74,6 @@ static void virtio_pmem_flush(VirtIODevice *vdev, VirtQueue *vq)
      trace_virtio_pmem_flush_request();
      req_data = virtqueue_pop(vq, sizeof(VirtIODeviceRequest));
      if (!req_data) {
-        virtio_error(vdev, "virtio-pmem missing request data");
          return;
      }