Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp796263pxv; Thu, 24 Jun 2021 21:21:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzu0aWfJt8QBLSDTSS+ZJzctlZbYY//vCCOx6M0Wa0GPN3aa1++qChFBa02E1BgtH32BGs2 X-Received: by 2002:a05:6638:3896:: with SMTP id b22mr7745157jav.37.1624594917149; Thu, 24 Jun 2021 21:21:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624594917; cv=none; d=google.com; s=arc-20160816; b=ZZ44rK5hOJWvGYibaI4lbtd8dp0KKwsmuXVvUuURJV85B84py1mVVy6Z97HehR73M9 6Kj3DvZVeVSCJIr5L4l96KNmpbTWbuakRv6VbJtDFwoNqFFbufJSMJPtQMbfEE/S8eaE gHn1oeErZk7GZp2QC0Oog8v/gPoOSe/0Ya3VJ0xbLKv4IYhhkh0r89TWVug9AF8XUaeT XJP2i35gzliVYZ2+Wh6uxWX9mG9cV7xSxOa4byqZur8BN2VlEwduRb3ugVNu62VVikS8 MrcnPIb7ZIxLW/yukrhoekaAX6gS82CjdAYN7bjMDizwrPduUmDkaS7vehEFprg2G83m AEPg== 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=q34vFqngnB3t5A6Nz3+eYIAGYGv8OAQnO0GJ9ith6+k=; b=e4SkxxfV7BDGaAThH4aYWl+SHHQKSz+9svKEZNmNKC6jSJRKywX1iQdyFQzX7hTbex K/5Y42ETNIoyf7ZZT/9ogAe0QAuiBK0m+H14MCqTzMrV4p+K5sHri4qPKV60GjE9ALH2 2juAVtzOWISmPoDq/wPR9ezztSHoYfexp5w2utLMCLoYq8eCsK+Q4a2Ts+BEWQJ9zKaW er8gMJfoKcLnm/fPuQ+6j/3nAlEYsOGUi+mRl2hvp+Jcu0K1Zwb+ZCPYAhDuwcN0+hk/ XraJzRI0kGLDxTPdtmMCLBw142R9EYIMsgaj+cvwDUjoyRvJjErXrFOiPNCOSxuJT9WO 6ZLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=YyvepM16; 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 b3si4570812ion.58.2021.06.24.21.21.45; Thu, 24 Jun 2021 21:21:57 -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=YyvepM16; 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 S230320AbhFYEVw (ORCPT + 99 others); Fri, 25 Jun 2021 00:21:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230359AbhFYEVs (ORCPT ); Fri, 25 Jun 2021 00:21:48 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F306C061760 for ; Thu, 24 Jun 2021 21:19:27 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id yy20so5231385ejb.6 for ; Thu, 24 Jun 2021 21:19:27 -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=q34vFqngnB3t5A6Nz3+eYIAGYGv8OAQnO0GJ9ith6+k=; b=YyvepM16teRAmW69CrgpPvH41Kv8BofJj0cnZwPg1pUt8Kynigzda5WiVGgo+EUKSl MmN7Bs8/AinjxpLcVb8drAzPGwoEC/8SqEctQaOrgknExBKqugTu3nDd7XqY74F2MnUL +aOfvmk2a2zM5gOZvVHKyqfJUj9GoDM5evNKgotF30eKzWH9zKild6AjUCaJxDdxo3/0 JIVSRc7orj7IUOn29Px1/HUAF2D7/UPboHOswMrNZPwXJ0Ib9KZYxz+XAxuLo/GeSNS5 6Ws2t1iATvhbQUuJEkMXTiXk+zAp+ud2KhPhyz3bAmKGDboR4fY7Tvr/053rCSMrbt+9 gKOg== 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=q34vFqngnB3t5A6Nz3+eYIAGYGv8OAQnO0GJ9ith6+k=; b=pWiHwKPPQXoF6I8FhgueF7jaNmQpYAIBNW4yhLTssmDEo5f64rzTsrHN9p2VGyrkHW OlJW7hPJaWAywlxPhDf1bLVJsTn5+v4gfKWlO1Rpusl6xuK6j/GE2HwvNF66PaPWTYUa 6f7HVsxQWWT4dq/vFzRr6wHVqmL79MIph+kBXAKEBKLtA0XMuMSyPidojfGqOzqAMYM5 8h17wFs4W/8m7hgRRnDWp3OJyADxnwuXEfOJRaA8VGuhP+YfhZ6yR3Yuwvomg5ft++r+ OSJ2qnboK7yx0QooO0bg71i4gc82YZ5qHF7jUThIjRtu5hzI8QPNMsZakz9EETtRliwg xx1w== X-Gm-Message-State: AOAM531qYSCa15GyZRKiiuqDOwnMMYLTBgCpw78TCq47d2IWSDY/j1nu TZ9BEgqK/TtytW9Bjfwq/cs7B9SCefCXnA0PTFUI X-Received: by 2002:a17:906:7142:: with SMTP id z2mr8520729ejj.427.1624594765939; Thu, 24 Jun 2021 21:19:25 -0700 (PDT) MIME-Version: 1.0 References: <20210615141331.407-1-xieyongji@bytedance.com> <20210615141331.407-10-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: Fri, 25 Jun 2021 12:19:15 +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 Fri, Jun 25, 2021 at 11:09 AM Jason Wang wrote: > > > =E5=9C=A8 2021/6/24 =E4=B8=8B=E5=8D=885:16, Yongji Xie =E5=86=99=E9=81=93= : > > On Thu, Jun 24, 2021 at 4:14 PM Jason Wang wrote: > >> > >> =E5=9C=A8 2021/6/24 =E4=B8=8B=E5=8D=8812:46, Yongji Xie =E5=86=99=E9= =81=93: > >>>> So we need to deal with both FEATURES_OK and reset, but probably not > >>>> DRIVER_OK. > >>>> > >>> OK, I see. Thanks for the explanation. One more question is how about > >>> clearing the corresponding status bit in get_status() rather than > >>> making set_status() fail. Since the spec recommends this way for > >>> validation which is done in virtio_dev_remove() and > >>> virtio_finalize_features(). > >>> > >>> Thanks, > >>> Yongji > >>> > >> I think you can. Or it would be even better that we just don't set the > >> bit during set_status(). > >> > > Yes, that's what I mean. > > > >> I just realize that in vdpa_reset() we had: > >> > >> static inline void vdpa_reset(struct vdpa_device *vdev) > >> { > >> const struct vdpa_config_ops *ops =3D vdev->config; > >> > >> vdev->features_valid =3D false; > >> ops->set_status(vdev, 0); > >> } > >> > >> We probably need to add the synchronization here. E.g re-read with a > >> timeout. > >> > > Looks like the timeout is already in set_status(). > > > Do you mean the VDUSE's implementation? > Yes. > > > Do we really need a > > duplicated one here? > > > 1) this is the timeout at the vDPA layer instead of the VDUSE layer. OK, I get it. > 2) it really depends on what's the meaning of the timeout for set_status > of VDUSE. > > Do we want: > > 2a) for set_status(): relay the message to userspace and wait for the > userspace to quiescence the datapath > > or > > 2b) for set_status(): simply relay the message to userspace, reply is 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. > > And how to handle failure? Adding a return value > > to virtio_config_ops->reset() and passing the error to the upper > > layer? > > > Something like this. > OK. Thanks, Yongji