From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A91CCC636C9 for ; Tue, 20 Jul 2021 13:13:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B4E0611F2 for ; Tue, 20 Jul 2021 13:13:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238463AbhGTMcn (ORCPT ); Tue, 20 Jul 2021 08:32:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34889 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238370AbhGTMcS (ORCPT ); Tue, 20 Jul 2021 08:32:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626786774; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9nf1v6P0JlGIoFjMRuRD5r+S7g6x4hJlGGenaSoSM68=; b=T4zzYBXQtVFlKWltPSuANPjcUSbGkrWIaZ9yMXrjteIwSEF+Z5g1qDLBukataLiYL/jOzC nxOtISRWRfUbebE9jNNSyvamm/DL2UZZR1i12v+5ETTfW2BYYM6feHQjYklON/5zW10H/M 2WWlW3+6TVo8hgQqIAVhqJvi4awEe2I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-24-fR5MrqLFMlC5Xp2S6MrlEw-1; Tue, 20 Jul 2021 09:12:52 -0400 X-MC-Unique: fR5MrqLFMlC5Xp2S6MrlEw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5A6F0100C660; Tue, 20 Jul 2021 13:12:51 +0000 (UTC) Received: from localhost (ovpn-114-103.ams2.redhat.com [10.36.114.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 011C560C82; Tue, 20 Jul 2021 13:12:50 +0000 (UTC) Date: Tue, 20 Jul 2021 14:12:49 +0100 From: Stefan Hajnoczi To: Xianting Tian 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() Message-ID: References: <20210720071337.1995-1-xianting.tian@linux.alibaba.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ECpNC9XLSuXAI6rm" Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org --ECpNC9XLSuXAI6rm Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 20, 2021 at 07:05:39PM +0800, Xianting Tian wrote: >=20 > =E5=9C=A8 2021/7/20 =E4=B8=8B=E5=8D=886:23, Stefan Hajnoczi =E5=86=99=E9= =81=93: > > On Tue, Jul 20, 2021 at 03:13:37PM +0800, Xianting Tian wrote: > > > Add the missed virtio_device_ready() to set vsock frontend ready. > > >=20 > > > Signed-off-by: Xianting Tian > > > --- > > > 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_devic= e *vdev) > > > mutex_unlock(&the_virtio_vsock_mutex); > > > + virtio_device_ready(vdev); > > Why is this patch necessary? >=20 > Sorry, I didn't notice the check in virtio_dev_probe(), >=20 > As Jason comment,=C2=A0 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 --ECpNC9XLSuXAI6rm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmD2y9EACgkQnKSrs4Gr c8jrqgf/S6HrkKdnFqfK+QSbiUl+UXuX9y6rWg6umKeM+V6GAOPrPw/+WZd1dM9Q AdhHLvjaR4MNNIQj7Vm8gG7aBs4s0FO2QTH4atfH6E3bEOXBWn1sB+lduzEk87Bf 5Y/tUog1kjgiU0eTkwLAYgXs9D8dA7SkJunRPjM+prsdvYDdWo5ulpEiLsexjPSy ye84Yg5CMWDTPCmk9yvcXBxAQaHu3jaZQChJsT72GgO4s11DgjLFqgWAMc/vs6X1 bYfP0oDKHQiJ7ag81nYxdyyNcUcf2xaX1tvfg54WwdM+oMP6vk6FqFOYuksvA8PP Lj+uqiNg4gqv2n6SDm0v+mYH9g2QpA== =I41d -----END PGP SIGNATURE----- --ECpNC9XLSuXAI6rm--