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 1A634C11F66 for ; Tue, 29 Jun 2021 04:03:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F309261D4B for ; Tue, 29 Jun 2021 04:03:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229562AbhF2EGP (ORCPT ); Tue, 29 Jun 2021 00:06:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60681 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbhF2EGK (ORCPT ); Tue, 29 Jun 2021 00:06:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624939423; 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=v+g48Xk6aSFcuGIkt+/DaIL+8u6+RW2FB0ohInQkXMo=; b=N/kWuJ9pALnFjAebPxvDYNPT7Ryq6QldUcVo8UT++4pGcHq/bJSclHk33zqT2frczX3F8O tPhA558HdqfArUd1FmH3dqD9lCOSsqNot0fkCVvP29F777cxrCI9xciC18X7VOuR1Y+gsv kVw61734oKEJt+cv8QxmeTyO5PhHlLc= Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-590-SVfNKJxYNYC9cx0jjAY09A-1; Tue, 29 Jun 2021 00:03:39 -0400 X-MC-Unique: SVfNKJxYNYC9cx0jjAY09A-1 Received: by mail-pl1-f197.google.com with SMTP id l10-20020a17090270cab029011dbfb3981aso6672515plt.22 for ; Mon, 28 Jun 2021 21:03:39 -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=v+g48Xk6aSFcuGIkt+/DaIL+8u6+RW2FB0ohInQkXMo=; b=HWs8ZO15zvBVxqCgzsjl4G5o4YC7V6aqSKq5irrP0A/MLDbdCWkX482fFGBgUYiQy3 joazyzcqEuCorIQAIywLREZYNi819/nbXl6daOiLrZq91USIlu8gqCAS7AZfsfbL0GqO RCEfsd6LDRBVbXPmeVNL+1T36BnrzB9u9kc5EhSat2CB73VQrIi2oq3imAR3EEPwnnrk DuzVuXUhQT2GUK10yD5csoCoLA8qepf1f9LfU8aQXhyRrAEwhnZGzD9LcjhB69FAPakE wMd5lAxpvb384rnGGD2Pn1nedVOe1Sf/XbbJmhRqoQRFQQVfMA16seL5ZsGLXIfRAM5n OJZQ== X-Gm-Message-State: AOAM532St1NXAoZehTGnWKdW0GqDOferqZJqXuKrFXH2YJERRyd2AIL6 IiPc9K10zVkULMufZ8WqCSraQ5PJaZj6DPDIe7Df9PD8C3UUj2IYVeS3F1+qVxktAFfnBMsnteM UfwhEZk/hc7DMOhYKV8L6h4rC2Q== X-Received: by 2002:a17:90a:3d47:: with SMTP id o7mr41873351pjf.68.1624939418457; Mon, 28 Jun 2021 21:03:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKtTxOUZyWPHTglSm78/VChBvM+Z/ZClGizEzsTPbjS/HVYSHDloQPPNl7gVZByIo2yALsfw== X-Received: by 2002:a17:90a:3d47:: with SMTP id o7mr41873326pjf.68.1624939418245; Mon, 28 Jun 2021 21:03:38 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id e2sm16252405pgh.5.2021.06.28.21.03.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Jun 2021 21:03:37 -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> <0aeb7cb7-58e5-1a95-d830-68edd7e8ec2e@redhat.com> <48cab125-093b-2299-ff9c-3de8c7c5ed3d@redhat.com> From: Jason Wang Message-ID: Date: Tue, 29 Jun 2021 12:03:25 +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-fsdevel@vger.kernel.org 在 2021/6/29 上午11:56, Yongji Xie 写道: > On Tue, Jun 29, 2021 at 11:29 AM Jason Wang wrote: >> >> 在 2021/6/29 上午10:26, Yongji Xie 写道: >>> On Mon, Jun 28, 2021 at 12:40 PM Jason Wang wrote: >>>> 在 2021/6/25 下午12:19, Yongji Xie 写道: >>>>>> 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. >>>>> >>>> Just notice this part in virtio_finalize_features(): >>>> >>>> virtio_add_status(dev, VIRTIO_CONFIG_S_FEATURES_OK); >>>> status = 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(). It should work. Thanks > > Thanks, > Yongji >