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]
Date:   Tue, 20 Jul 2021 14:12:49 +0100
From:   Stefan Hajnoczi <stefanha@...hat.com>
To:     Xianting Tian <xianting.tian@...ux.alibaba.com>
Cc:     sgarzare@...hat.com, davem@...emloft.net, kuba@...nel.org,
        jasowang@...hat.com, kvm@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] vsock/virtio: set vsock frontend ready in
 virtio_vsock_probe()

On Tue, Jul 20, 2021 at 07:05:39PM +0800, Xianting Tian wrote:
> 
> 在 2021/7/20 下午6:23, Stefan Hajnoczi 写道:
> > On Tue, Jul 20, 2021 at 03:13:37PM +0800, Xianting Tian wrote:
> > > Add the missed virtio_device_ready() to set vsock frontend ready.
> > > 
> > > Signed-off-by: Xianting Tian<xianting.tian@...ux.alibaba.com>
> > > ---
> > >   net/vmw_vsock/virtio_transport.c | 2 ++
> > >   1 file changed, 2 insertions(+)
> > Please include a changelog when you send v2, v3, etc patches.
> OK, thanks.
> > > diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c
> > > index e0c2c992a..dc834b8fd 100644
> > > --- a/net/vmw_vsock/virtio_transport.c
> > > +++ b/net/vmw_vsock/virtio_transport.c
> > > @@ -639,6 +639,8 @@ static int virtio_vsock_probe(struct virtio_device *vdev)
> > >   	mutex_unlock(&the_virtio_vsock_mutex);
> > > +	virtio_device_ready(vdev);
> > Why is this patch necessary?
> 
> Sorry, I didn't notice the check in virtio_dev_probe(),
> 
> As Jason comment,  I alsoe think we need to be consistent: switch to use
> virtio_device_ready() for all the drivers. What's opinion about this?

According to the documentation the virtio_device_read() API is optional:

  /**
   * virtio_device_ready - enable vq use in probe function
   * @vdev: the device
   *
   * Driver must call this to use vqs in the probe function.
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   *
   * Note: vqs are enabled automatically after probe returns.
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   */

Many drivers do not use vqs during the ->probe() function. They don't
need to call virtio_device_ready(). That's why the virtio_vsock driver
doesn't call it.

But if a ->probe() function needs to send virtqueue buffers, e.g. to
query the device or activate some device feature, then the driver will
need to call it explicitly.

The documentation is clear and this design is less error-prone than
relying on all drivers to call it manually. I suggest leaving things
unchanged.

Stefan

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ