[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220603100944.871727-1-eperezma@redhat.com>
Date: Fri, 3 Jun 2022 12:09:40 +0200
From: Eugenio Pérez <eperezma@...hat.com>
To: kvm@...r.kernel.org, Jason Wang <jasowang@...hat.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
virtualization@...ts.linux-foundation.org
Cc: Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Longpeng <longpeng2@...wei.com>,
Stefano Garzarella <sgarzare@...hat.com>, dinang@...inx.com,
Piotr.Uminski@...el.com, martinpo@...inx.com, tanuj.kamde@....com,
Parav Pandit <parav@...dia.com>,
Zhang Min <zhang.min9@....com.cn>, habetsm.xilinx@...il.com,
Zhu Lingshan <lingshan.zhu@...el.com>, lulu@...hat.com,
hanand@...inx.com, martinh@...inx.com,
Si-Wei Liu <si-wei.liu@...cle.com>, gautam.dawar@....com,
Xie Yongji <xieyongji@...edance.com>, ecree.xilinx@...il.com,
pabloc@...inx.com, lvivier@...hat.com, Eli Cohen <elic@...dia.com>,
Wu Zongyong <wuzongyong@...ux.alibaba.com>,
Dan Carpenter <dan.carpenter@...cle.com>
Subject: [PATCH v5 0/4] Implement vdpasim suspend operation
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
Powered by blists - more mailing lists