kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Xianting Tian <xianting.tian@linux.alibaba.com>
Cc: sgarzare@redhat.com, davem@davemloft.net, kuba@kernel.org,
	jasowang@redhat.com, kvm@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] vsock/virtio: set vsock frontend ready in virtio_vsock_probe()
Date: Tue, 20 Jul 2021 14:12:49 +0100	[thread overview]
Message-ID: <YPbL0QIgbAh/PBuC@stefanha-x1.localdomain> (raw)
In-Reply-To: <b48bd02d-9514-ec0c-3779-fd5ddc5c2d3d@linux.alibaba.com>

[-- Attachment #1: Type: text/plain, Size: 2099 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2021-07-20 13:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20  7:13 [PATCH v2] vsock/virtio: set vsock frontend ready in virtio_vsock_probe() Xianting Tian
2021-07-20  7:54 ` Jason Wang
2021-07-20  8:36   ` Xianting Tian
2021-07-20 10:23 ` Stefan Hajnoczi
2021-07-20 10:56   ` Xianting Tian
2021-07-20 11:05   ` Xianting Tian
2021-07-20 13:12     ` Stefan Hajnoczi [this message]
2021-07-21  1:30       ` Xianting Tian

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=YPbL0QIgbAh/PBuC@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=davem@davemloft.net \
    --cc=jasowang@redhat.com \
    --cc=kuba@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sgarzare@redhat.com \
    --cc=xianting.tian@linux.alibaba.com \
    /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).