Re: [virtio-dev] [PATCH v3 1/7] Vhost-vsock device: Fixed endiannes issue.

From
Greg Kurz <>
Date
2016-03-14T17:53:46+00:00
ID
Thread
Re: [virtio-dev] [PATCH v3 1/7] Vhost-vsock device: Fixed endiannes issue.
On Mon, 14 Mar 2016 11:18:25 +0100
Cornelia Huck <> wrote:

> On Fri, 11 Mar 2016 16:45:48 +0100
> Claudio Imbrenda <> wrote:
> 
> > From: Claudio Imbrenda <>
> > 
> > Added missing endianness initializations in the vhost-vsock device.
> > 
> > Signed-off-by: Claudio Imbrenda <>
> > ---
> >  drivers/vhost/vsock.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
> > index 2c5963c..9378f23 100644
> > --- a/drivers/vhost/vsock.c
> > +++ b/drivers/vhost/vsock.c
> > @@ -481,6 +481,8 @@ static int vhost_vsock_set_features(struct vhost_vsock *vsock, u64 features)
> >  		vq = &vsock->vqs[i];
> >  		mutex_lock(&vq->mutex);
> >  		vq->acked_features = features;
> > +		vq->is_le = virtio_legacy_is_little_endian();
> > +		vhost_init_is_le(vq);  
> 
> Hm... I'm not 100% sure that ->set_features() is the right place to
> init this.
> 

It is probably not the right place since the final value for vq->is_le depends
on both negociated features (for virtio 1) and userspace asking for cross-endian
support (VHOST_SET_VRING_ENDIAN ioctl).

> One thing I'm a bit puzzled about (I have not given vsock more than a
> cursory glance, though) is why vsock does not seem to make use of
> vq->private_data (and consequently, why we don't setup endianness when
> something attaches there). I may be missing some very basics about
> vsock, though :)
> 

Yeah... unlike other vhost devices, vsock does not call vhost_init_used()...

> >  		mutex_unlock(&vq->mutex);
> >  	}
> >  	mutex_unlock(&vsock->dev.mutex);  
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> For additional commands, e-mail: 
>