lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210409115343-mutt-send-email-mst@kernel.org>
Date:   Fri, 9 Apr 2021 12:04:58 -0400
From:   "Michael S. Tsirkin" <mst@...hat.com>
To:     Jason Wang <jasowang@...hat.com>
Cc:     virtualization@...ts.linux-foundation.org,
        linux-kernel@...r.kernel.org, parav@...dia.com, elic@...dia.com
Subject: Re: [RFC PATCH] vdpa: mandate 1.0 device

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@...hat.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?


> 
> > 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 ...


> 
> > 
> > 
> > 
> > 
> > 
> > > ---
> > >   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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ