All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: sebastien.boeuf@intel.com
Cc: eperezma@redhat.com, mst@redhat.com,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH v2 3/4] vhost-vdpa: uAPI to resume the device
Date: Mon, 17 Oct 2022 15:22:29 +0800	[thread overview]
Message-ID: <CACGkMEv48juaqvNx04wfuc0JeKp31rUaHVCEspBq7HvFXSZBLg@mail.gmail.com> (raw)
In-Reply-To: <d23b16abdc15f5e2aa1430cf48101dd256638809.1665745877.git.sebastien.boeuf@intel.com>

On Fri, Oct 14, 2022 at 7:15 PM <sebastien.boeuf@intel.com> wrote:
>
> From: Sebastien Boeuf <sebastien.boeuf@intel.com>
>
> This new ioctl adds support for resuming the device from userspace.
>
> This is required when trying to restore the device in a functioning
> state after it's been suspended. It is already possible to reset a
> suspended device,

Nit: And should we allow resume a non suspended device? Do we need to
document this requirement somewhere?

> but that means the device must be reconfigured and
> all the IOMMU/IOTLB mappings must be recreated. This new operation
> allows the device to be resumed without going through a full reset.
>
> This is particularly useful when trying to perform offline migration of
> a virtual machine (also known as snapshot/restore) as it allows the VMM
> to resume the virtual machine back to a running state after the snapshot
> is performed.
>
> Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>

Acked-by: Jason Wang <jasowang@redhat.com>

> ---
>  drivers/vhost/vdpa.c       | 18 ++++++++++++++++++
>  include/uapi/linux/vhost.h |  8 ++++++++
>  2 files changed, 26 insertions(+)
>
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index 833617d00ef6..1db7bd39fb63 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -502,6 +502,21 @@ static long vhost_vdpa_suspend(struct vhost_vdpa *v)
>         return ops->suspend(vdpa);
>  }
>
> +/* After a successful return of this ioctl the device resumes processing
> + * virtqueue descriptors. The device becomes fully operational the same way it
> + * was before it was suspended.
> + */
> +static long vhost_vdpa_resume(struct vhost_vdpa *v)
> +{
> +       struct vdpa_device *vdpa = v->vdpa;
> +       const struct vdpa_config_ops *ops = vdpa->config;
> +
> +       if (!ops->resume)
> +               return -EOPNOTSUPP;
> +
> +       return ops->resume(vdpa);
> +}
> +
>  static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
>                                    void __user *argp)
>  {
> @@ -687,6 +702,9 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep,
>         case VHOST_VDPA_SUSPEND:
>                 r = vhost_vdpa_suspend(v);
>                 break;
> +       case VHOST_VDPA_RESUME:
> +               r = vhost_vdpa_resume(v);
> +               break;
>         default:
>                 r = vhost_dev_ioctl(&v->vdev, cmd, argp);
>                 if (r == -ENOIOCTLCMD)
> diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h
> index f9f115a7c75b..92e1b700b51c 100644
> --- a/include/uapi/linux/vhost.h
> +++ b/include/uapi/linux/vhost.h
> @@ -180,4 +180,12 @@
>   */
>  #define VHOST_VDPA_SUSPEND             _IO(VHOST_VIRTIO, 0x7D)
>
> +/* Resume a device so it can resume processing virtqueue requests
> + *
> + * After the return of this ioctl the device will have restored all the
> + * necessary states and it is fully operational to continue processing the
> + * virtqueue descriptors.
> + */
> +#define VHOST_VDPA_RESUME              _IO(VHOST_VIRTIO, 0x7E)
> +
>  #endif
> --
> 2.34.1
>
> ---------------------------------------------------------------------
> Intel Corporation SAS (French simplified joint stock company)
> Registered headquarters: "Les Montalets"- 2, rue de Paris,
> 92196 Meudon Cedex, France
> Registration Number:  302 456 199 R.C.S. NANTERRE
> Capital: 5 208 026.16 Euros
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
>

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2022-10-17  7:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1665745877.git.sebastien.boeuf@intel.com>
     [not found] ` <491fb8fe786739958eb9ff3df2250a4188b0bbe5.1665745877.git.sebastien.boeuf@intel.com>
2022-10-17  7:19   ` [PATCH v2 1/4] vdpa: Add resume operation Jason Wang
2022-10-18  0:12     ` Si-Wei Liu
2022-10-18  6:13       ` Michael S. Tsirkin
     [not found] ` <df57ddc44ed8950dc79c63597e3091b1da551959.1665745877.git.sebastien.boeuf@intel.com>
2022-10-17  7:20   ` [PATCH v2 2/4] vhost-vdpa: Introduce RESUME backend feature bit Jason Wang
     [not found] ` <d23b16abdc15f5e2aa1430cf48101dd256638809.1665745877.git.sebastien.boeuf@intel.com>
2022-10-17  7:22   ` Jason Wang [this message]
     [not found] ` <bdbf1921652c93e372b1e283cd9367a9b5f31447.1665745877.git.sebastien.boeuf@intel.com>
2022-10-17  7:26   ` [PATCH v2 4/4] vdpa_sim: Implement resume vdpa op Jason Wang
     [not found]     ` <2f9a1b3a32d35ab6c40a87fe158f55430ebeb2e2.camel@intel.com>
     [not found]       ` <CAJaqyWeLi+mmOFi8-+65XwurFbBcAnCe5XFKjQ=4Gbo4hwhdUw@mail.gmail.com>
     [not found]         ` <82ae5fc04bb24019c27552a9cc8a973919f1088d.camel@intel.com>
2022-10-18  6:14           ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACGkMEv48juaqvNx04wfuc0JeKp31rUaHVCEspBq7HvFXSZBLg@mail.gmail.com \
    --to=jasowang@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=mst@redhat.com \
    --cc=sebastien.boeuf@intel.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.