public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/4] Implement vdpasim suspend operation
@ 2022-06-03 10:09 Eugenio Pérez
  2022-06-03 10:09 ` [PATCH v5 1/4] vdpa: Add " Eugenio Pérez
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Eugenio Pérez @ 2022-06-03 10:09 UTC (permalink / raw)
  To: kvm, Jason Wang, Michael S. Tsirkin, linux-kernel, netdev,
	virtualization
  Cc: Christophe JAILLET, Longpeng, Stefano Garzarella, dinang,
	Piotr.Uminski, martinpo, tanuj.kamde, Parav Pandit, Zhang Min,
	habetsm.xilinx, Zhu Lingshan, lulu, hanand, martinh, Si-Wei Liu,
	gautam.dawar, Xie Yongji, ecree.xilinx, pabloc, lvivier,
	Eli Cohen, Wu Zongyong, Dan Carpenter

Implement suspend operation for vdpa_sim devices, so vhost-vdpa will offer
that backend feature and userspace can effectively suspend the device.

This is a must before getting virtqueue indexes (base) for live migration,
since the device could modify them after userland gets them. There are
individual ways to perform that action for some devices
(VHOST_NET_SET_BACKEND, VHOST_VSOCK_SET_RUNNING, ...) but there was no
way to perform it for any vhost device (and, in particular, vhost-vdpa).

After a successful return of ioctl with suspend = 1, the device must not
process more virtqueue descriptors, and it must not send any config
interrupt. The device can answer to read or writes of config fields as
if it were not suspended. In particular, writing to "queue_enable" with
a value of 1 will not make the device start processing buffers of the
virtqueue until the device is resumed (suspend = 0).

After a successful return of ioctl with suspend = 0, the device will
start processing data of the virtqueues if other expected conditions are
met (queue is enabled, DRIVER_OK has already been set to status, etc.)
If not, the device should be in the same state as if no call to suspend
callback with suspend = 1 has been performed.

In the future, we will provide features similar to
VHOST_USER_GET_INFLIGHT_FD so the device can save pending operations.

Comments are welcome.

v6:
* s/stop/suspend/ to differentiate more from reset.
* Clarify scope of the suspend operation.

v5:
* s/not stop/resume/ in doc.

v4:
* Replace VHOST_STOP to VHOST_VDPA_STOP in vhost ioctl switch case too.

v3:
* s/VHOST_STOP/VHOST_VDPA_STOP/
* Add documentation and requirements of the ioctl above its definition.

v2:
* Replace raw _F_STOP with BIT_ULL(_F_STOP).
* Fix obtaining of stop ioctl arg (it was not obtained but written).
* Add stop to vdpa_sim_blk.

Eugenio Pérez (4):
  vdpa: Add suspend operation
  vhost-vdpa: introduce SUSPEND backend feature bit
  vhost-vdpa: uAPI to suspend the device
  vdpa_sim: Implement suspend vdpa op

 drivers/vdpa/vdpa_sim/vdpa_sim.c     | 21 +++++++++++++
 drivers/vdpa/vdpa_sim/vdpa_sim.h     |  1 +
 drivers/vdpa/vdpa_sim/vdpa_sim_blk.c |  3 ++
 drivers/vdpa/vdpa_sim/vdpa_sim_net.c |  3 ++
 drivers/vhost/vdpa.c                 | 47 +++++++++++++++++++++++++++-
 include/linux/vdpa.h                 |  5 +++
 include/uapi/linux/vhost.h           | 14 +++++++++
 include/uapi/linux/vhost_types.h     |  2 ++
 8 files changed, 95 insertions(+), 1 deletion(-)

--
2.31.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-06-03 10:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-03 10:09 [PATCH v5 0/4] Implement vdpasim suspend operation Eugenio Pérez
2022-06-03 10:09 ` [PATCH v5 1/4] vdpa: Add " Eugenio Pérez
2022-06-03 10:09 ` [PATCH v5 2/4] vhost-vdpa: introduce SUSPEND backend feature bit Eugenio Pérez
2022-06-03 10:09 ` [PATCH v5 3/4] vhost-vdpa: uAPI to suspend the device Eugenio Pérez
2022-06-03 10:09 ` [PATCH v5 4/4] vdpa_sim: Implement suspend vdpa op Eugenio Pérez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox