Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp757172pxv; Thu, 24 Jun 2021 20:11:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNUeTl9hEQLohBJyrIhstzXVkYWElVB5J5FOm0uIb2A9XU8gRPc3vJd93rYeKRv2nJiJ1J X-Received: by 2002:a92:1e08:: with SMTP id e8mr6097050ile.10.1624590691401; Thu, 24 Jun 2021 20:11:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624590691; cv=none; d=google.com; s=arc-20160816; b=QjmNbuR8qNyLE61PuhD6MpwbpygzoemVIM2yBpGJwA9uaPfh8ThA9CN2IUzZZuwfQH X3uga36jer7PF1pPQqpQ+W6GTn7eWlxCD9KodPbBk1MBIqujQPTJDV45+uIVoAiqUfe4 8KyBxdHGF3XboMtoh5bGYxFOnZSTNV77s60CgYtSGRR7vaptiE0c29G++uWys30/cFC6 4YQABSz1A3rnhwvcMCCrrPvf5vr7oF3ysmyONYSYW4wzGNQMr7YPjT2qEfsQCcg0hVpb 86wu6okXvp1tgp1EItu3vxXh+6BcS0HvMsNn2VriAir2mGfG8EKNp/aWoICec7zBfJtr b18A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=x2g9lBasApYrM4QFsD5hgHZyz+dwqoNSSbWrkfNZV2I=; b=PjQxNaVEV793Zhx1pL43fBQdu6RCtosCCc81Lun8XOiR3KDUXY8NLZaoZyglKKUJfB FvtpSaFFnPllJIlRFHWl52XK7fGxWicDy7UymAsGs4mqhgM5an/T/nj78fuYHIe92Wmq HuQoifuhuttSj6X2rYUVNsNCD6gW2ldjsdjRVmgK+akxMeFnSyruf8FnVlQOFBw6YjvD F/5ohVRQ89AzlhPWBPSjSvEzVw7Cfh7mrOGmt3OosUAMBrvd1J8/Bco1pzKxNzOwTobM B2dsJ+fUKYcrFm+7UntIVOOzVzNSzeUap3p75poBpUTFeRQjAFTadGUASLSfwLTZe6iS BWsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=T6N0mwGo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j20si2749571jak.8.2021.06.24.20.11.20; Thu, 24 Jun 2021 20:11:31 -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=@redhat.com header.s=mimecast20190719 header.b=T6N0mwGo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233027AbhFYDL1 (ORCPT + 99 others); Thu, 24 Jun 2021 23:11:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:56757 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233086AbhFYDLY (ORCPT ); Thu, 24 Jun 2021 23:11:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624590544; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x2g9lBasApYrM4QFsD5hgHZyz+dwqoNSSbWrkfNZV2I=; b=T6N0mwGoButy10GAz6VAREaDqLgSnMS8/WRzbOHKWk53UAg5xA+8sxo6HxfHc6PO1P9gTI gaUlXOwVPE02TBSVgaKuW4qMfUFpwtqms4QzbuyVKTHFnQR7XQ/m6W/cBIl5FkJ41R99Df kdQ/kAnyqXRKDRSHk7IDdS81zVbODRg= Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-474-1sTHtkmONU6luBGwr-d9bg-1; Thu, 24 Jun 2021 23:09:01 -0400 X-MC-Unique: 1sTHtkmONU6luBGwr-d9bg-1 Received: by mail-pf1-f200.google.com with SMTP id k12-20020aa788cc0000b0290306b50a28ecso4858437pff.10 for ; Thu, 24 Jun 2021 20:08:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=x2g9lBasApYrM4QFsD5hgHZyz+dwqoNSSbWrkfNZV2I=; b=Ql39PMTfoENGEaDTDVV29zmMVQdwTATvueqa4Rp6q/NP5e1gKtiZakqXNyhSQCix25 xh3hXZo6G260VYnmCcgnKLV1IEOKz65S8hU/rwjtvFjGYpEVx1W2+K+eE1V/zCZKOedl sXF0HlcVDwjehvYr0kZ7ICrRHQtKRZAjLYqP1YDQRc0ID+loj75od1drA1G4MJpGAsrd D4jrGdjPMk27NIfyVc/0HdZNBcvlNN6/VpZaERPy/xjMhEkefY/Xdh69rpwklmCtHban 2HiZapNQmM26Hzz0Txtq04U/BI6ljwkwRnJnrNIArQ3vwn4n1Hlg4ATa7DtwGbYNZQWy 8Sfw== X-Gm-Message-State: AOAM531V1rl6KHLdOm3yXufTCyd5drOZRcWbX1NpbW8vn91YORzGxyj6 NVGixIhYRrmX7fV6WHJFG4ttJEqV3cgJMpi6aYpviIinBcvHh22JdoD0vFlnY8DsX143ZBGn1pf PKFr5TFvWuzP8Lb8FBPgI/DeK5bjPeRuh3bfcPcfoLWoEULTwsjMzw/BO5ldaHAr6aO0cMtKef0 S6 X-Received: by 2002:a17:90a:d302:: with SMTP id p2mr597055pju.186.1624590535545; Thu, 24 Jun 2021 20:08:55 -0700 (PDT) X-Received: by 2002:a17:90a:d302:: with SMTP id p2mr597003pju.186.1624590535223; Thu, 24 Jun 2021 20:08:55 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id z9sm4301129pfc.101.2021.06.24.20.08.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 20:08:54 -0700 (PDT) Subject: Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace To: Yongji Xie 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 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> From: Jason Wang Message-ID: Date: Fri, 25 Jun 2021 11:08:42 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2021/6/24 下午5:16, Yongji Xie 写道: > On Thu, Jun 24, 2021 at 4:14 PM Jason Wang wrote: >> >> 在 2021/6/24 下午12:46, Yongji Xie 写道: >>>> 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 = vdev->config; >> >> vdev->features_valid = 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? > Do we really need a > duplicated one here? 1) this is the timeout at the vDPA layer instead of the VDUSE layer. 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. > 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. Thanks > > Thanks, > Yongji >