Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4060539pxv; Mon, 28 Jun 2021 20:58:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyyKa+iGBwxEmw1og8gTx1E4PE8U7gQ9cDE7/l1n/7PBurAJpPa/q9e8uqXM3xz+AZ9A/j X-Received: by 2002:a17:907:7691:: with SMTP id jv17mr28103878ejc.116.1624939125896; Mon, 28 Jun 2021 20:58:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624939125; cv=none; d=google.com; s=arc-20160816; b=B6NbZstm05+83EWXaCdzyasWR6uTs97jGonoWPV3Hf2CRLO1nZafxHjAxwVBgm81VV J5PFQyk1JByubTFYhZQdbUrkHIj0NfblKi7/JpaHjhd9s49bVyawzaiqzO+8PZMOEHQ6 mTtv0keQK+A/rf9VTYEDPG0AXpeWq/W+t+Y/+6V8vqqRo9iMQ+v+7CST1sWXNhJqfSpa 0gKGEK1mrDB+1zTMsj555zKcyCr8RYN18Wug67pKq9JWoGwQC4t5C8piZZH5ZURqk8nM 7c686GEqqIMnweBZsfQjgsl+sVkfuP4wgoOhUWn0ZxHCCfMi5kU+FErC+SmJyJ8DPDVV HvdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=D86WnvUg/Gf6HvI1cRKKP6mYttXzkG9si4A9EUDsAM8=; b=Utus/+0/K3FSXylei2cgSMosG6o9MkOA0Dd0CqbNvvT1W46RX7EcMCaYwUbvK6scFy Qo6lp17uvy46MV+ES1BRbpWn9JNUlhWNOEDdrhvP6XaXa4Hw6aTniGi1krGZBRJ0LbWi 0XuqPoFJL6p91AeYuhmPfSYMWjJ44/Ovo7ifXw4x5DPDRyv91GLfbQ+xv7HEx3+wkYiq 4kSmhN6RyzSF2svoI75HBg9i0CjlxpcEvK/vK7FZMVwYfmPOD4CwgXfFxIlLw++CToJW KVpqDuATmETh86rEd3hWkSwqrCQGzAID5hfHyvKoaL9apQnK65WzIawyTktlTxK+Gmtv qVdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=ktycy0u3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p26si9341791ejx.433.2021.06.28.20.58.22; Mon, 28 Jun 2021 20:58:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=ktycy0u3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231848AbhF2D7M (ORCPT + 99 others); Mon, 28 Jun 2021 23:59:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231750AbhF2D7H (ORCPT ); Mon, 28 Jun 2021 23:59:07 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F726C061574 for ; Mon, 28 Jun 2021 20:56:39 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id c17so7911596ejk.13 for ; Mon, 28 Jun 2021 20:56:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=D86WnvUg/Gf6HvI1cRKKP6mYttXzkG9si4A9EUDsAM8=; b=ktycy0u3fd2n2LkkSyJRlmSxqWEZlI+BMvbBCygDsyL4bIVPtYgv5F3+OlCovp8IE5 YdPYVKSMPNv8K2fsE7c+BMChTcNAl5zpMojzsBvnVkL4PPrg7fnB0m/BFLGeBU0lzU1m MU7KsdUKUmnRFvYuD/eV+6Db6BPIOkjzmSt9osG/AWuczpiHFJ2Bu4tU+ciassk5Ffh/ eGTomGEeKsvnc7O2JYvkMtm4pMXolMCXY87xsSrpS765Ssqow1gwNrBX4Dxq/qiRbqeG izQopD22vjrMYv+U6MDcAo2FarGQHBrWmq+Nm6+vmwbR1xRB/et+FjzeuFqj2ugygP0H WDGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=D86WnvUg/Gf6HvI1cRKKP6mYttXzkG9si4A9EUDsAM8=; b=coq4sphUo1BcpcIIKrvIkRk6/iWUhMncIhN3H6YzkNVNkDAw37IiQ46PKh3n8Wdqbp 6XVN0t9LRh71o8FsEENm9zUFHzMLBDFrh4GANwmjAxzLjLNsfSDEzvjHwbh/3AqG8gaq cbmUbJhgvMqThUE2o8Fd6bRuLqMes79ZucynhKLQ1hZxbKD5komlVaLmFNMWfKTcLpW8 JyZsxc9nTQjEVQQDIU0Z3a004etoHO5qO/LDNrCS1e/8lNHtJf8CrrBy0UXpPRYnkxTR cm11pR98+L7qTWsm809IcSd8AqYVTZVFYTLFwjIazbEYq4KDyffcmY7Y/87KO/7t/IJI xEsA== X-Gm-Message-State: AOAM531jQyUVB9/+JeGoJKfeCah6BK6CDPKTNyFS2R/qGeclevpeCbLr ucybbI3ZRRAc3FMOyG6KRB+zhnExazX1haOGFGJY X-Received: by 2002:a17:906:7142:: with SMTP id z2mr27152930ejj.427.1624938998259; Mon, 28 Jun 2021 20:56:38 -0700 (PDT) MIME-Version: 1.0 References: <20210615141331.407-1-xieyongji@bytedance.com> <1bba439f-ffc8-c20e-e8a4-ac73e890c592@redhat.com> <0aeb7cb7-58e5-1a95-d830-68edd7e8ec2e@redhat.com> <48cab125-093b-2299-ff9c-3de8c7c5ed3d@redhat.com> In-Reply-To: From: Yongji Xie Date: Tue, 29 Jun 2021 11:56:27 +0800 Message-ID: Subject: Re: Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace To: Jason Wang Cc: "Michael S. Tsirkin" , Stefan Hajnoczi , Stefano Garzarella , Parav Pandit , Christoph Hellwig , Christian Brauner , Randy Dunlap , Matthew Wilcox , Al Viro , Jens Axboe , bcrl@kvack.org, Jonathan Corbet , =?UTF-8?Q?Mika_Penttil=C3=A4?= , Dan Carpenter , joro@8bytes.org, Greg KH , songmuchun@bytedance.com, virtualization , netdev@vger.kernel.org, kvm , linux-fsdevel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 29, 2021 at 11:29 AM Jason Wang wrote: > > > =E5=9C=A8 2021/6/29 =E4=B8=8A=E5=8D=8810:26, Yongji Xie =E5=86=99=E9=81= =93: > > On Mon, Jun 28, 2021 at 12:40 PM Jason Wang wrote= : > >> > >> =E5=9C=A8 2021/6/25 =E4=B8=8B=E5=8D=8812:19, Yongji Xie =E5=86=99=E9= =81=93: > >>>> 2b) for set_status(): simply relay the message to userspace, reply i= s no > >>>> needed. Userspace will use a command to update the status when the > >>>> datapath is stop. The the status could be fetched via get_stats(). > >>>> > >>>> 2b looks more spec complaint. > >>>> > >>> Looks good to me. And I think we can use the reply of the message to > >>> update the status instead of introducing a new command. > >>> > >> Just notice this part in virtio_finalize_features(): > >> > >> virtio_add_status(dev, VIRTIO_CONFIG_S_FEATURES_OK); > >> status =3D dev->config->get_status(dev); > >> if (!(status & VIRTIO_CONFIG_S_FEATURES_OK)) { > >> > >> So we no reply doesn't work for FEATURES_OK. > >> > >> So my understanding is: > >> > >> 1) We must not use noreply for set_status() > >> 2) We can use noreply for get_status(), but it requires a new ioctl to > >> update the status. > >> > >> So it looks to me we need synchronize for both get_status() and > >> set_status(). > >> > > We should not send messages to userspace in the FEATURES_OK case. So > > the synchronization is not necessary. > > > As discussed previously, there could be a device that mandates some > features (VIRTIO_F_RING_PACKED). So it can choose to not accept > FEATURES_OK is packed virtqueue is not negotiated. > > In this case we need to relay the message to userspace. > OK, I see. If so, I prefer to only use noreply for set_status(). We do not set the status bit if the message is failed. In this way, we don't need to change lots of virtio core codes to handle the failure of set_status()/get_status(). Thanks, Yongji