All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, parav@nvidia.com, elic@nvidia.com
Subject: Re: [RFC PATCH] vdpa: mandate 1.0 device
Date: Mon, 12 Apr 2021 05:09:55 -0400	[thread overview]
Message-ID: <20210412050730-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <42891807-cb24-5352-f8cb-798e9d1a1854@redhat.com>

On Mon, Apr 12, 2021 at 02:35:07PM +0800, Jason Wang wrote:
> 
> 在 2021/4/10 上午12:04, Michael S. Tsirkin 写道:
> > On Fri, Apr 09, 2021 at 12:47:55PM +0800, Jason Wang wrote:
> > > 在 2021/4/8 下午11:59, Michael S. Tsirkin 写道:
> > > > On Thu, Apr 08, 2021 at 04:26:48PM +0800, Jason Wang wrote:
> > > > > This patch mandates 1.0 for vDPA devices. The goal is to have the
> > > > > semantic of normative statement in the virtio spec and eliminate the
> > > > > burden of transitional device for both vDPA bus and vDPA parent.
> > > > > 
> > > > > uAPI seems fine since all the vDPA parent mandates
> > > > > VIRTIO_F_ACCESS_PLATFORM which implies 1.0 devices.
> > > > > 
> > > > > For legacy guests, it can still work since Qemu will mediate when
> > > > > necessary (e.g doing the endian conversion).
> > > > > 
> > > > > Signed-off-by: Jason Wang <jasowang@redhat.com>
> > > > Hmm. If we do this, don't we still have a problem with
> > > > legacy drivers which don't ack 1.0?
> > > 
> > > Yes, but it's not something that is introduced in this commit. The legacy
> > > driver never work ...
> > My point is this neither fixes or prevents this.
> > 
> > So my suggestion is to finally add ioctls along the lines
> > of PROTOCOL_FEATURES of vhost-user.
> > 
> > Then that one can have bits for legacy le, legacy be and modern.
> > 
> > BTW I looked at vhost-user and it does not look like that
> > has a solution for this problem either, right?
> 
> 
> Right.
> 
> 
> > 
> > 
> > > > Note 1.0 affects ring endianness which is not mediated in QEMU
> > > > so QEMU can't pretend to device guest is 1.0.
> > > 
> > > Right, I plan to send patches to do mediation in the Qemu to unbreak legacy
> > > drivers.
> > > 
> > > Thanks
> > I frankly think we'll need PROTOCOL_FEATURES anyway, it's too useful ...
> > so why not teach drivers about it and be done with it? You can't emulate
> > legacy on modern in a cross endian situation because of vring
> > endian-ness ...
> 
> 
> So the problem still. This can only work when the hardware can support
> legacy vring endian-ness.
> 
> Consider:
> 
> 1) the leagcy driver support is non-normative in the spec
> 2) support a transitional device in the kenrel may requires the hardware
> support and a burden of kernel codes
> 
> I'd rather simply drop the legacy driver support


My point is this patch does not drop legacy support. It merely mandates
modern support.

> to have a simple and easy
> abstarction in the kenrel. For legacy driver in the guest, hypervisor is in
> charge of the mediation:
> 
> 1) config space access endian conversion
> 2) using shadow virtqueue to change the endian in the vring
> 
> Thanks

I'd like to avoid shadow virtqueue hacks if at all possible.
Last I checked performance wasn't much better than just emulating
virtio in software.

> 
> > 
> > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > > ---
> > > > >    include/linux/vdpa.h | 6 ++++++
> > > > >    1 file changed, 6 insertions(+)
> > > > > 
> > > > > diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
> > > > > index 0fefeb976877..cfde4ec999b4 100644
> > > > > --- a/include/linux/vdpa.h
> > > > > +++ b/include/linux/vdpa.h
> > > > > @@ -6,6 +6,7 @@
> > > > >    #include <linux/device.h>
> > > > >    #include <linux/interrupt.h>
> > > > >    #include <linux/vhost_iotlb.h>
> > > > > +#include <uapi/linux/virtio_config.h>
> > > > >    /**
> > > > >     * vDPA callback definition.
> > > > > @@ -317,6 +318,11 @@ static inline int vdpa_set_features(struct vdpa_device *vdev, u64 features)
> > > > >    {
> > > > >            const struct vdpa_config_ops *ops = vdev->config;
> > > > > +        /* Mandating 1.0 to have semantics of normative statements in
> > > > > +         * the spec. */
> > > > > +        if (!(features & BIT_ULL(VIRTIO_F_VERSION_1)))
> > > > > +		return -EINVAL;
> > > > > +
> > > > >    	vdev->features_valid = true;
> > > > >            return ops->set_features(vdev, features);
> > > > >    }
> > > > > -- 
> > > > > 2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: elic@nvidia.com, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: Re: [RFC PATCH] vdpa: mandate 1.0 device
Date: Mon, 12 Apr 2021 05:09:55 -0400	[thread overview]
Message-ID: <20210412050730-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <42891807-cb24-5352-f8cb-798e9d1a1854@redhat.com>

On Mon, Apr 12, 2021 at 02:35:07PM +0800, Jason Wang wrote:
> 
> 在 2021/4/10 上午12:04, Michael S. Tsirkin 写道:
> > On Fri, Apr 09, 2021 at 12:47:55PM +0800, Jason Wang wrote:
> > > 在 2021/4/8 下午11:59, Michael S. Tsirkin 写道:
> > > > On Thu, Apr 08, 2021 at 04:26:48PM +0800, Jason Wang wrote:
> > > > > This patch mandates 1.0 for vDPA devices. The goal is to have the
> > > > > semantic of normative statement in the virtio spec and eliminate the
> > > > > burden of transitional device for both vDPA bus and vDPA parent.
> > > > > 
> > > > > uAPI seems fine since all the vDPA parent mandates
> > > > > VIRTIO_F_ACCESS_PLATFORM which implies 1.0 devices.
> > > > > 
> > > > > For legacy guests, it can still work since Qemu will mediate when
> > > > > necessary (e.g doing the endian conversion).
> > > > > 
> > > > > Signed-off-by: Jason Wang <jasowang@redhat.com>
> > > > Hmm. If we do this, don't we still have a problem with
> > > > legacy drivers which don't ack 1.0?
> > > 
> > > Yes, but it's not something that is introduced in this commit. The legacy
> > > driver never work ...
> > My point is this neither fixes or prevents this.
> > 
> > So my suggestion is to finally add ioctls along the lines
> > of PROTOCOL_FEATURES of vhost-user.
> > 
> > Then that one can have bits for legacy le, legacy be and modern.
> > 
> > BTW I looked at vhost-user and it does not look like that
> > has a solution for this problem either, right?
> 
> 
> Right.
> 
> 
> > 
> > 
> > > > Note 1.0 affects ring endianness which is not mediated in QEMU
> > > > so QEMU can't pretend to device guest is 1.0.
> > > 
> > > Right, I plan to send patches to do mediation in the Qemu to unbreak legacy
> > > drivers.
> > > 
> > > Thanks
> > I frankly think we'll need PROTOCOL_FEATURES anyway, it's too useful ...
> > so why not teach drivers about it and be done with it? You can't emulate
> > legacy on modern in a cross endian situation because of vring
> > endian-ness ...
> 
> 
> So the problem still. This can only work when the hardware can support
> legacy vring endian-ness.
> 
> Consider:
> 
> 1) the leagcy driver support is non-normative in the spec
> 2) support a transitional device in the kenrel may requires the hardware
> support and a burden of kernel codes
> 
> I'd rather simply drop the legacy driver support


My point is this patch does not drop legacy support. It merely mandates
modern support.

> to have a simple and easy
> abstarction in the kenrel. For legacy driver in the guest, hypervisor is in
> charge of the mediation:
> 
> 1) config space access endian conversion
> 2) using shadow virtqueue to change the endian in the vring
> 
> Thanks

I'd like to avoid shadow virtqueue hacks if at all possible.
Last I checked performance wasn't much better than just emulating
virtio in software.

> 
> > 
> > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > > ---
> > > > >    include/linux/vdpa.h | 6 ++++++
> > > > >    1 file changed, 6 insertions(+)
> > > > > 
> > > > > diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
> > > > > index 0fefeb976877..cfde4ec999b4 100644
> > > > > --- a/include/linux/vdpa.h
> > > > > +++ b/include/linux/vdpa.h
> > > > > @@ -6,6 +6,7 @@
> > > > >    #include <linux/device.h>
> > > > >    #include <linux/interrupt.h>
> > > > >    #include <linux/vhost_iotlb.h>
> > > > > +#include <uapi/linux/virtio_config.h>
> > > > >    /**
> > > > >     * vDPA callback definition.
> > > > > @@ -317,6 +318,11 @@ static inline int vdpa_set_features(struct vdpa_device *vdev, u64 features)
> > > > >    {
> > > > >            const struct vdpa_config_ops *ops = vdev->config;
> > > > > +        /* Mandating 1.0 to have semantics of normative statements in
> > > > > +         * the spec. */
> > > > > +        if (!(features & BIT_ULL(VIRTIO_F_VERSION_1)))
> > > > > +		return -EINVAL;
> > > > > +
> > > > >    	vdev->features_valid = true;
> > > > >            return ops->set_features(vdev, features);
> > > > >    }
> > > > > -- 
> > > > > 2.25.1

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

  reply	other threads:[~2021-04-12  9:43 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08  8:26 [RFC PATCH] vdpa: mandate 1.0 device Jason Wang
2021-04-08  8:26 ` Jason Wang
2021-04-08 15:59 ` Michael S. Tsirkin
2021-04-08 15:59   ` Michael S. Tsirkin
2021-04-09  4:47   ` Jason Wang
2021-04-09  4:47     ` Jason Wang
2021-04-09 16:04     ` Michael S. Tsirkin
2021-04-09 16:04       ` Michael S. Tsirkin
2021-04-12  6:35       ` Jason Wang
2021-04-12  6:35         ` Jason Wang
2021-04-12  9:09         ` Michael S. Tsirkin [this message]
2021-04-12  9:09           ` Michael S. Tsirkin
2021-04-12  9:23           ` Jason Wang
2021-04-12  9:23             ` Jason Wang
2021-04-21  7:41             ` Jason Wang
2021-04-21  7:41               ` Jason Wang
2021-04-21  8:03               ` Michael S. Tsirkin
2021-04-21  8:03                 ` Michael S. Tsirkin
2021-04-21  8:17                 ` Jason Wang
2021-04-21  8:17                   ` Jason Wang
2021-05-11  8:43                   ` Jason Wang
2021-05-11  8:43                     ` Jason Wang
2021-05-12  7:53                     ` Michael S. Tsirkin
2021-05-12  7:53                       ` Michael S. Tsirkin
2021-05-12  9:24                       ` Jason Wang
2021-05-12  9:24                         ` Jason Wang
2021-06-02 10:30                         ` Eli Cohen
2021-06-03  7:14                           ` Jason Wang
2021-06-03  7:14                             ` Jason Wang

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=20210412050730-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=elic@nvidia.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=parav@nvidia.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.