Skip to content

RFC virtio: add new notify() callback to virtio_driver

Heinz Graalfs virtualization 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest3 patches 6 repliesIn review
  2. v1 RFC3 patches 8 repliesSuperseded

Changes in v2 from the cover letter

- add include of linux/notifier.h (I also added it to the 3rd patch)
- get queue lock in order to be able to use safe queue_flag_set() functions in virtblk_notify() handler

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3virtio: add notify() callback to virtio_driverdrivers/virtio/virtio.c include/linux/virtio.h+19 -01 reply
2/3virtio_blk: add virtblk_notify() as virtio_driver's notify() callbackdrivers/block/virtio_blk.c+17 -00 replies
3/3virtio_ccw: invoke virtio_driver's notify() on CIO_GONE notificationdrivers/s390/kvm/virtio_ccw.c+13 -25 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 RFC 0/3] virtio: add new notify() callback to virtio_driver

Hi, here is an updated patch-set with changes as suggested by Michael Tsirkin.

When an active virtio block device is hot-unplugged from a KVM guest, running affected guest user applications are not aware of any errors that occur due to the lost device. This patch-set adds code to avoid further request queueing when a lost block device is detected, resulting in appropriate error info.

On System z there exists no handshake mechanism between host and guest when a device is hot-unplugged. The device is removed and no further I/O is possible.

When an online channel device disappears on System z the kernel's CIO layer informs the driver (virtio_ccw) about the lost device.

It's just the block device drivers that care to provide a notify callback.

Here are some more error details:

For a particular block device virtio's request function virtblk_request() is called by the block layer to queue requests to be handled by the host. In case of a lost device requests can still be queued, but an appropriate subsequent host kick usually fails. This leads to situations where no error feedback is shown.

In order to prevent request queueing for lost devices appropriate settings in the block layer should be made. Exploiting System z's CIO notify handler callback, and adding a corresponding new virtio_driver notify() handler to 'inform' the block layer, solve this task.

v1->v2 changes:
- add include of linux/notifier.h (I also added it to the 3rd patch)
- get queue lock in order to be able to use safe queue_flag_set() functions in virtblk_notify() handler

Patch 1 adds an optional notify() callback to virtio_driver.

Patch 2 adds a new notify() callback for the virtio_blk driver. When called for a lost device settings are made to prevent future request queueing.

Patch 3 modifies the CIO notify handler in virtio_ccw's transport layer to pass on the lost device info to virtio's backend driver virtio_blk.

Heinz Graalfs (3):
virtio: add notify() callback to virtio_driver
virtio_blk: add virtblk_notify() as virtio_driver's notify() callback
virtio_ccw: invoke virtio_driver's notify() on CIO_GONE notification

 drivers/block/virtio_blk.c    | 17 +++++++++++++++++
 drivers/s390/kvm/virtio_ccw.c | 15 +++++++++++++--
 drivers/virtio/virtio.c       |  9 +++++++++
 include/linux/virtio.h        | 10 ++++++++++
 4 files changed, 49 insertions(+), 2 deletions(-)
Signature · 1 line
1.8.3.1