From: Jason Wang <jasowang@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: "Stefano Garzarella" <sgarzare@redhat.com>,
"Shannon Nelson" <shannon.nelson@amd.com>,
virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, "Eugenio Pérez" <eperezma@redhat.com>,
"Tiwei Bie" <tiwei.bie@intel.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vhost-vdpa: filter VIRTIO_F_RING_PACKED feature
Date: Fri, 9 Jun 2023 10:16:50 +0800 [thread overview]
Message-ID: <CACGkMEvirfb8g0ev=b0CjpL5_SPJabqiQKxdwuRNqG2E=N7iGA@mail.gmail.com> (raw)
In-Reply-To: <20230608102259-mutt-send-email-mst@kernel.org>
On Thu, Jun 8, 2023 at 10:23 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Thu, Jun 08, 2023 at 05:29:58PM +0800, Jason Wang wrote:
> > On Thu, Jun 8, 2023 at 5:21 PM Stefano Garzarella <sgarzare@redhat.com> wrote:
> > >
> > > On Thu, Jun 08, 2023 at 05:00:00PM +0800, Jason Wang wrote:
> > > >On Thu, Jun 8, 2023 at 4:00 PM Stefano Garzarella <sgarzare@redhat.com> wrote:
> > > >>
> > > >> On Thu, Jun 08, 2023 at 03:46:00PM +0800, Jason Wang wrote:
> > > >>
> > > >> [...]
> > > >>
> > > >> >> > > > > I have a question though, what if down the road there
> > > >> >> > > > > is a new feature that needs more changes? It will be
> > > >> >> > > > > broken too just like PACKED no?
> > > >> >> > > > > Shouldn't vdpa have an allowlist of features it knows how
> > > >> >> > > > > to support?
> > > >> >> > > >
> > > >> >> > > > It looks like we had it, but we took it out (by the way, we were
> > > >> >> > > > enabling packed even though we didn't support it):
> > > >> >> > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6234f80574d7569444d8718355fa2838e92b158b
> > > >> >> > > >
> > > >> >> > > > The only problem I see is that for each new feature we have to modify
> > > >> >> > > > the kernel.
> > > >> >> > > > Could we have new features that don't require handling by vhost-vdpa?
> > > >> >> > > >
> > > >> >> > > > Thanks,
> > > >> >> > > > Stefano
> > > >> >> > >
> > > >> >> > > Jason what do you say to reverting this?
> > > >> >> >
> > > >> >> > I may miss something but I don't see any problem with vDPA core.
> > > >> >> >
> > > >> >> > It's the duty of the parents to advertise the features it has. For example,
> > > >> >> >
> > > >> >> > 1) If some kernel version that is packed is not supported via
> > > >> >> > set_vq_state, parents should not advertise PACKED features in this
> > > >> >> > case.
> > > >> >> > 2) If the kernel has support packed set_vq_state(), but it's emulated
> > > >> >> > cvq doesn't support, parents should not advertise PACKED as well
> > > >> >> >
> > > >> >> > If a parent violates the above 2, it looks like a bug of the parents.
> > > >> >> >
> > > >> >> > Thanks
> > > >> >>
> > > >> >> Yes but what about vhost_vdpa? Talking about that not the core.
> > > >> >
> > > >> >Not sure it's a good idea to workaround parent bugs via vhost-vDPA.
> > > >>
> > > >> Sorry, I'm getting lost...
> > > >> We were talking about the fact that vhost-vdpa doesn't handle
> > > >> SET_VRING_BASE/GET_VRING_BASE ioctls well for packed virtqueue before
> > > >> that series [1], no?
> > > >>
> > > >> The parents seem okay, but maybe I missed a few things.
> > > >>
> > > >> [1] https://lore.kernel.org/virtualization/20230424225031.18947-1-shannon.nelson@amd.com/
> > > >
> > > >Yes, more below.
> > > >
> > > >>
> > > >> >
> > > >> >> Should that not have a whitelist of features
> > > >> >> since it interprets ioctls differently depending on this?
> > > >> >
> > > >> >If there's a bug, it might only matter the following setup:
> > > >> >
> > > >> >SET_VRING_BASE/GET_VRING_BASE + VDUSE.
> > > >> >
> > > >> >This seems to be broken since VDUSE was introduced. If we really want
> > > >> >to backport something, it could be a fix to filter out PACKED in
> > > >> >VDUSE?
> > > >>
> > > >> mmm it doesn't seem to be a problem in VDUSE, but in vhost-vdpa.
> > > >> I think VDUSE works fine with packed virtqueue using virtio-vdpa
> > > >> (I haven't tried), so why should we filter PACKED in VDUSE?
> > > >
> > > >I don't think we need any filtering since:
> > > >
> > > >PACKED features has been advertised to userspace via uAPI since
> > > >6234f80574d7569444d8718355fa2838e92b158b. Once we relax in uAPI, it
> > > >would be very hard to restrict it again. For the userspace that tries
> > > >to negotiate PACKED:
> > > >
> > > >1) if it doesn't use SET_VRING_BASE/GET_VRING_BASE, everything works well
> > > >2) if it uses SET_VRING_BASE/GET_VRING_BASE. it might fail or break silently
> > > >
> > > >If we backport the fixes to -stable, we may break the application at
> > > >least in the case 1).
> > >
> > > Okay, I see now, thanks for the details!
> > >
> > > Maybe instead of "break silently", we can return an explicit error for
> > > SET_VRING_BASE/GET_VRING_BASE in stable branches.
> > > But if there are not many cases, we can leave it like that.
> >
> > A second thought, if we need to do something for stable. is it better
> > if we just backport Shannon's series to stable?
> >
> > >
> > > I was just concerned about how does the user space understand that it
> > > can use SET_VRING_BASE/GET_VRING_BASE for PACKED virtqueues in a given
> > > kernel or not.
> >
> > My understanding is that if packed is advertised, the application
> > should assume SET/GET_VRING_BASE work.
> >
> > Thanks
>
>
> Let me ask you this. This is a bugfix yes?
Not sure since it may break existing user space applications which
make it hard to be backported to -stable.
Before the fix, PACKED might work if SET/GET_VRING_BASE is not used.
After the fix, PACKED won't work at all.
Thanks
What is the appropriate Fixes
> tag?
>
> > >
> > > Thanks,
> > > Stefano
> > >
>
next prev parent reply other threads:[~2023-06-09 2:17 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 11:06 [PATCH] vhost-vdpa: filter VIRTIO_F_RING_PACKED feature Stefano Garzarella
2023-06-05 12:41 ` Michael S. Tsirkin
2023-06-05 12:54 ` Stefano Garzarella
2023-06-05 13:00 ` Michael S. Tsirkin
2023-06-05 13:30 ` Stefano Garzarella
2023-06-05 13:54 ` Michael S. Tsirkin
2023-06-05 14:56 ` Stefano Garzarella
2023-06-05 21:44 ` Michael S. Tsirkin
2023-06-06 10:09 ` Stefano Garzarella
2023-06-07 20:52 ` Michael S. Tsirkin
2023-06-06 1:29 ` Jason Wang
2023-06-06 10:18 ` Stefano Garzarella
2023-06-06 12:58 ` Michael S. Tsirkin
2023-06-07 8:39 ` Stefano Garzarella
2023-06-07 9:43 ` Michael S. Tsirkin
2023-06-08 0:42 ` Jason Wang
2023-06-08 6:03 ` Michael S. Tsirkin
2023-06-08 7:46 ` Jason Wang
2023-06-08 7:59 ` Stefano Garzarella
2023-06-08 9:00 ` Jason Wang
2023-06-08 9:21 ` Stefano Garzarella
2023-06-08 9:29 ` Jason Wang
2023-06-08 9:47 ` Stefano Garzarella
2023-06-08 14:23 ` Michael S. Tsirkin
2023-06-09 2:16 ` Jason Wang [this message]
2023-06-09 7:17 ` Michael S. Tsirkin
2023-06-09 7:37 ` Stefano Garzarella
2023-06-08 13:46 ` Michael S. Tsirkin
2023-06-08 13:43 ` Michael S. Tsirkin
2023-06-22 11:37 ` Michael S. Tsirkin
2023-06-22 12:28 ` Stefano Garzarella
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='CACGkMEvirfb8g0ev=b0CjpL5_SPJabqiQKxdwuRNqG2E=N7iGA@mail.gmail.com' \
--to=jasowang@redhat.com \
--cc=eperezma@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=sgarzare@redhat.com \
--cc=shannon.nelson@amd.com \
--cc=tiwei.bie@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).