public inbox for virtualization@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: Dragos Tatulea <dtatulea@nvidia.com>
To: "eperezma@redhat.com" <eperezma@redhat.com>
Cc: "xuanzhuo@linux.alibaba.com" <xuanzhuo@linux.alibaba.com>,
	Parav Pandit <parav@nvidia.com>, Gal Pressman <gal@nvidia.com>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"si-wei.liu@oracle.com" <si-wei.liu@oracle.com>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	Saeed Mahameed <saeedm@nvidia.com>,
	"mst@redhat.com" <mst@redhat.com>,
	"leon@kernel.org" <leon@kernel.org>
Subject: Re: [PATCH vhost v4 02/15] vdpa: Add VHOST_BACKEND_F_CHANGEABLE_VQ_ADDR_IN_SUSPEND flag
Date: Thu, 21 Dec 2023 15:07:22 +0000	[thread overview]
Message-ID: <17abeefd02c843cddf64efbeadde49ad15c365a1.camel@nvidia.com> (raw)
In-Reply-To: <CAJaqyWevZX5TKpaLiJwu2nD7PHFsHg+TEZ=iPdWvrH4jyPV+cA@mail.gmail.com>

On Thu, 2023-12-21 at 15:55 +0100, Eugenio Perez Martin wrote:
> On Thu, Dec 21, 2023 at 3:38 PM Dragos Tatulea <dtatulea@nvidia.com> wrote:
> > 
> > On Thu, 2023-12-21 at 13:08 +0100, Eugenio Perez Martin wrote:
> > > On Thu, Dec 21, 2023 at 12:52 PM Dragos Tatulea <dtatulea@nvidia.com> wrote:
> > > > 
> > > > On Thu, 2023-12-21 at 08:46 +0100, Eugenio Perez Martin wrote:
> > > > > On Thu, Dec 21, 2023 at 3:03 AM Jason Wang <jasowang@redhat.com> wrote:
> > > > > > 
> > > > > > On Wed, Dec 20, 2023 at 9:32 PM Eugenio Perez Martin
> > > > > > <eperezma@redhat.com> wrote:
> > > > > > > 
> > > > > > > On Wed, Dec 20, 2023 at 5:06 AM Jason Wang <jasowang@redhat.com> wrote:
> > > > > > > > 
> > > > > > > > On Wed, Dec 20, 2023 at 11:46 AM Jason Wang <jasowang@redhat.com> wrote:
> > > > > > > > > 
> > > > > > > > > On Wed, Dec 20, 2023 at 2:09 AM Dragos Tatulea <dtatulea@nvidia.com> wrote:
> > > > > > > > > > 
> > > > > > > > > > The virtio spec doesn't allow changing virtqueue addresses after
> > > > > > > > > > DRIVER_OK. Some devices do support this operation when the device is
> > > > > > > > > > suspended. The VHOST_BACKEND_F_CHANGEABLE_VQ_ADDR_IN_SUSPEND flag
> > > > > > > > > > advertises this support as a backend features.
> > > > > > > > > 
> > > > > > > > > There's an ongoing effort in virtio spec to introduce the suspend state.
> > > > > > > > > 
> > > > > > > > > So I wonder if it's better to just allow such behaviour?
> > > > > > > > 
> > > > > > > > Actually I mean, allow drivers to modify the parameters during suspend
> > > > > > > > without a new feature.
> > > > > > > > 
> > > > > > > 
> > > > > > > That would be ideal, but how do userland checks if it can suspend +
> > > > > > > change properties + resume?
> > > > > > 
> > > > > > As discussed, it looks to me the only device that supports suspend is
> > > > > > simulator and it supports change properties.
> > > > > > 
> > > > > > E.g:
> > > > > > 
> > > > > > static int vdpasim_set_vq_address(struct vdpa_device *vdpa, u16 idx,
> > > > > >                                   u64 desc_area, u64 driver_area,
> > > > > >                                   u64 device_area)
> > > > > > {
> > > > > >         struct vdpasim *vdpasim = vdpa_to_sim(vdpa);
> > > > > >         struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];
> > > > > > 
> > > > > >         vq->desc_addr = desc_area;
> > > > > >         vq->driver_addr = driver_area;
> > > > > >         vq->device_addr = device_area;
> > > > > > 
> > > > > >         return 0;
> > > > > > }
> > > > > > 
> > > > > 
> > > > > So in the current kernel master it is valid to set a different vq
> > > > > address while the device is suspended in vdpa_sim. But it is not valid
> > > > > in mlx5, as the FW will not be updated in resume (Dragos, please
> > > > > correct me if I'm wrong). Both of them return success.
> > > > > 
> > > > In the current state, there is no resume. HW Virtqueues will just get re-created
> > > > with the new address.
> > > > 
> > > 
> > > Oh, then all of this is effectively transparent to the userspace
> > > except for the time it takes?
> > > 
> > Not quite: mlx5_vdpa_set_vq_address will save the vq address only on the SW vq
> > representation. Only later will it will call into the FW to update the FW. Later
> > means:
> > - On DRIVER_OK state, when the VQs get created.
> > - On .set_map when the VQs get re-created (before this series) / updated (after
> > this series)
> > - On .resume (after this series).
> > 
> > So if the .set_vq_address is called when the VQ is in DRIVER_OK but not
> > suspended those addresses will be set later for later.
> > 
> 
> Ouch, that is more in the line of my thoughts :(.
> 
> > > In that case you're right, we don't need feature flags. But I think it
> > > would be great to also move the error return in case userspace tries
> > > to modify vq parameters out of suspend state.
> > > 
> > On the driver side or on the core side?
> > 
> 
> Core side.
> 
Checking my understanding: instead of the feature flags there would be a check
(for .set_vq_addr and .set_vq_state) to return an error if they are called under
DRIVER_OK and not suspended state?

> It does not have to be part of this series, I meant it can be proposed
> in a separate series and applied before the parent driver one.
> 
> > Thanks
> > > Thanks!
> > > 
> > > 
> > > > > How can we know in the destination QEMU if it is valid to suspend &
> > > > > set address? Should we handle this as a bugfix and backport the
> > > > > change?
> > > > > 
> > > > > > > 
> > > > > > > The only way that comes to my mind is to make sure all parents return
> > > > > > > error if userland tries to do it, and then fallback in userland.
> > > > > > 
> > > > > > Yes.
> > > > > > 
> > > > > > > I'm
> > > > > > > ok with that, but I'm not sure if the current master & previous kernel
> > > > > > > has a coherent behavior. Do they return error? Or return success
> > > > > > > without changing address / vq state?
> > > > > > 
> > > > > > We probably don't need to worry too much here, as e.g set_vq_address
> > > > > > could fail even without suspend (just at uAPI level).
> > > > > > 
> > > > > 
> > > > > I don't get this, sorry. I rephrased my point with an example earlier
> > > > > in the mail.
> > > > > 
> > > > 
> > > 
> > 
> 


  reply	other threads:[~2023-12-21 15:07 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19 18:08 [PATCH vhost v4 00/15] vdpa/mlx5: Add support for resumable vqs Dragos Tatulea
2023-12-19 18:08 ` [PATCH mlx5-vhost v4 01/15] vdpa/mlx5: Expose resumable vq capability Dragos Tatulea
2023-12-20  3:46   ` Jason Wang
2023-12-19 18:08 ` [PATCH vhost v4 02/15] vdpa: Add VHOST_BACKEND_F_CHANGEABLE_VQ_ADDR_IN_SUSPEND flag Dragos Tatulea
2023-12-20  3:46   ` Jason Wang
2023-12-20  4:05     ` Jason Wang
2023-12-20 12:57       ` Dragos Tatulea
2023-12-20 13:32       ` Eugenio Perez Martin
2023-12-21  2:03         ` Jason Wang
2023-12-21  7:46           ` Eugenio Perez Martin
2023-12-21 11:52             ` Dragos Tatulea
2023-12-21 12:08               ` Eugenio Perez Martin
2023-12-21 14:38                 ` Dragos Tatulea
2023-12-21 14:55                   ` Eugenio Perez Martin
2023-12-21 15:07                     ` Dragos Tatulea [this message]
2023-12-22  7:30                       ` Eugenio Perez Martin
2023-12-22  8:29                       ` Michael S. Tsirkin
2023-12-22 10:51                         ` Dragos Tatulea
2023-12-25 13:45                           ` Dragos Tatulea
2023-12-22  2:50             ` Jason Wang
2023-12-20 16:09   ` Eugenio Perez Martin
2023-12-19 18:08 ` [PATCH vhost v4 03/15] vdpa: Add VHOST_BACKEND_F_CHANGEABLE_VQ_STATE_IN_SUSPEND flag Dragos Tatulea
2023-12-20 16:10   ` Eugenio Perez Martin
2023-12-19 18:08 ` [PATCH vhost v4 04/15] vdpa: Accept VHOST_BACKEND_F_CHANGEABLE_VQ_ADDR_IN_SUSPEND backend feature Dragos Tatulea
2023-12-20 16:11   ` Eugenio Perez Martin
2023-12-19 18:08 ` [PATCH vhost v4 05/15] vdpa: Accept VHOST_BACKEND_F_CHANGEABLE_VQ_STATE_IN_SUSPEND " Dragos Tatulea
2023-12-20 16:12   ` Eugenio Perez Martin
2023-12-19 18:08 ` [PATCH vhost v4 06/15] vdpa: Track device suspended state Dragos Tatulea
2023-12-20  3:46   ` Jason Wang
2023-12-20 12:55     ` Dragos Tatulea
2023-12-22 11:22       ` Dragos Tatulea
2023-12-25  4:11         ` Jason Wang
2023-12-19 18:08 ` [PATCH vhost v4 07/15] vdpa: Block vq address change in DRIVER_OK unless device supports it Dragos Tatulea
2023-12-20 16:31   ` Eugenio Perez Martin
2023-12-19 18:08 ` [PATCH vhost v4 08/15] vdpa: Block vq state " Dragos Tatulea
2023-12-20 16:32   ` Eugenio Perez Martin
2023-12-19 18:08 ` [PATCH vhost v4 09/15] vdpa/mlx5: Allow modifying multiple vq fields in one modify command Dragos Tatulea
2023-12-20  3:46   ` Jason Wang
2023-12-19 18:08 ` [PATCH vhost v4 10/15] vdpa/mlx5: Introduce per vq and device resume Dragos Tatulea
2023-12-20  3:47   ` Jason Wang
2023-12-19 18:08 ` [PATCH vhost v4 11/15] vdpa/mlx5: Mark vq addrs for modification in hw vq Dragos Tatulea
2023-12-19 18:08 ` [PATCH vhost v4 12/15] vdpa/mlx5: Mark vq state " Dragos Tatulea
2023-12-20  3:47   ` Jason Wang
2023-12-19 18:08 ` [PATCH vhost v4 13/15] vdpa/mlx5: Use vq suspend/resume during .set_map Dragos Tatulea
2023-12-20  3:47   ` Jason Wang
2023-12-19 18:08 ` [PATCH vhost v4 14/15] vdpa/mlx5: Introduce reference counting to mrs Dragos Tatulea
2023-12-20  3:47   ` Jason Wang
2023-12-19 18:08 ` [PATCH vhost v4 15/15] vdpa/mlx5: Add mkey leak detection Dragos Tatulea
2023-12-25 14:41 ` [PATCH vhost v4 00/15] vdpa/mlx5: Add support for resumable vqs Michael S. Tsirkin
2023-12-25 15:05   ` Dragos Tatulea

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=17abeefd02c843cddf64efbeadde49ad15c365a1.camel@nvidia.com \
    --to=dtatulea@nvidia.com \
    --cc=eperezma@redhat.com \
    --cc=gal@nvidia.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=parav@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=si-wei.liu@oracle.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xuanzhuo@linux.alibaba.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox