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=-7.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 B9581C49EA7 for ; Fri, 25 Jun 2021 03:09:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 941F5613FF for ; Fri, 25 Jun 2021 03:09:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233089AbhFYDLY (ORCPT ); Thu, 24 Jun 2021 23:11:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29129 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232996AbhFYDLX (ORCPT ); Thu, 24 Jun 2021 23:11:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624590542; 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=iaT02gjDN2MRRtiVAwie2VFaySSMUfhFl+tBDA+4/FUu5gNq8qg0+YApq9MZrzh/jeEPOO 5CqTeoMzah7s9OU3gZDHbfY1Ci22uVNAl/rV2Ohi8OsEQHwZPy6JkcgkE7alZH7JMKdsCP VxkAw9vR+uCUstkc2VWs/iEvFWl/xuY= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-484-odZK7JHQPEiE-rD7hboAVw-1; Thu, 24 Jun 2021 23:09:00 -0400 X-MC-Unique: odZK7JHQPEiE-rD7hboAVw-1 Received: by mail-pj1-f69.google.com with SMTP id bx13-20020a17090af48db029016fb6fa83beso7271649pjb.3 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=Un86b23NwlzscI5/rS9lJA2ZMPeuCQpABl2NiUisdO28mItYGQOPJzDTPMps3A/iM1 5iaJLcOzGtIE1pMHQMP8c7jiO0EaBSRojO9kHyNef7nQBQG7yksucXNnZC6m9FUgjEnc rfEbAvXEmZG1S0cyCs6/bx/GGTs8ubHHYDVB7OnFAoi6OhCDhxOYUQ/e7ueJQFV+5l1z 1jm4YqOoOoJmPnF2G/JRFbqVTZdandhZqJovBlv+9SCbuly4VslfWaWLhjs/4siIDZyb Lum8GGwuFEAOVfH4kHxBKclf2PzkRDSC1RJCSVo0yN5QjjSmz+WCX8ZQIug0m1LkIygq fYCA== X-Gm-Message-State: AOAM532/Z3Hm1amTfrvisADCwgtipKJfZu0sgi+T3ZNrhyW5kX0XrGqy vLkY7Jz00nMiiykX7wyLAUYr2vr+CfGTVnyFzun1Tiy0kHKeBoJtlnrgkJHnPmBGm72AE8+LZX1 q8VJgXKgTa0xh5ArJ X-Received: by 2002:a17:90a:d302:: with SMTP id p2mr597026pju.186.1624590535428; Thu, 24 Jun 2021 20:08:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSt2a7irPTEnHB75wt/k1DcVWt+k1ibjJ9B3uVz8Ybl5wVpiHcOLL8vV4fUc+onvCWC2yUZA== 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: netdev@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 >