Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4063829pxv; Mon, 28 Jun 2021 21:04:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMRdfc/6z8/MZ8UYsrsDxdxSz3OSI5w0P9lK0r1MM0ABK7iJFKa28a6P2zegAM/Q89Q6RD X-Received: by 2002:a5d:9f4b:: with SMTP id u11mr2188986iot.144.1624939474937; Mon, 28 Jun 2021 21:04:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624939474; cv=none; d=google.com; s=arc-20160816; b=dbUQ5v6FvgspKVOwlcwkv4sV9gq6ac2ojNihRUNEvKB8ID5exztbu1S7vweJLWgRZ+ d9e1Pt/7FFoVbGk7KqtcrgGZe7yT58ZVNCiQu2Ux3DCFfEQ2AQHnhv7U1SYWkXS+Lf0h va/da61n3ZLaQuhszLAlwQHBVkNI6TuqGALh3sQdNT7JOvEwOPmMNeBRlrigKmw8CXo6 MRHhS9oAvZTR8zAQsUZyGVR6/go3Rz/NjcIJkYuAUZ57axiEWsEypR6FBMXn/P0FR3b9 eJD8GtRSmlFdfkB5BzjKc/XitUGe6PHkvL7fWUcKTsYmAyne3jVuK4ODMj8U1nt40iQ1 nPrw== 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=v+g48Xk6aSFcuGIkt+/DaIL+8u6+RW2FB0ohInQkXMo=; b=DQ+X6kr2JsV1qG4k2IwHyNXJrh9SPGEc0I/MZgjFlXBkd5V2pGOqWoMtPBdKkTOJT3 BVNTlawB1MR+5H84jGlYrDrNmfH6p67orv5bxs4SHNnrcMXFy0tjbUiny1fqKSGPBxbJ KFBXopq9lywKxL/6b51WUZO8ZMldPBHrTHUY9iTMwSdhFs2NKei7tLrKsvkyidj2qFul IVLBhaFzSJ2ZAsYZvV7AvPLe9e+9PyuXrluvBBCWUAyU/GT57jWs3e6KlRCZzZFAqfS5 K6YysSo9euRqULvQG3M+VFSbI6+xEjw43Na80XW5tROiq8GTgz/oiKavPuDr8lKBKQx5 iHBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HakUBONh; 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 p31si21824621jac.95.2021.06.28.21.04.21; Mon, 28 Jun 2021 21:04:34 -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=HakUBONh; 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 S229792AbhF2EGK (ORCPT + 99 others); Tue, 29 Jun 2021 00:06:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54061 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbhF2EGI (ORCPT ); Tue, 29 Jun 2021 00:06:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624939421; 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=HakUBONhNHm6IC+59YeTj095UOc7S7n+V53lzuwQVxEN7MVQlnuV/bHUT3a53z4oa65k2n rZkY6Kaeb5ucQGLq7xELr0ZDB6TVeGGhCoMW/RyA7NCuPvO2KRz57FR+785SyVT1+7JZ9a SaC4Hpvv3e9IaiTLkGVXuQPJ07UjWnk= Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-439-ceBFVnv3PN2aST1kp-Iv9g-1; Tue, 29 Jun 2021 00:03:39 -0400 X-MC-Unique: ceBFVnv3PN2aST1kp-Iv9g-1 Received: by mail-pl1-f198.google.com with SMTP id g16-20020a1709028690b029011e9e164a59so6682799plo.23 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=sKIJh5TkoAKaRPAnuaCnLqlfGeTneLe0VBmOKN1lD5h7DHGOIF+1kA7bqFp+7fZ8Ov dlmO0iawCZR6r3MLm7SOpEv18n8wAkiuP5VK2mqstAOc3gctuvCkggxAW8HtrRYJbkh7 Zqtv1hvqyXb1UyZPnkZaMH0W0FI6dQxkmyg+lnR1YLlWDEPARc/4T4Vbkq/uefZaQyED wyUkmHWU/KmDCvqToliawTveThg75YH5pRhNbRYZSUgwfST2LG8txwIA5deA9VOFeysA UFj1hBNa1TdvhTzDXyPethIYj/23HWW8mh1ImyVtKY99jbEsZ9531m85r7ghyNyCdyXb wxoQ== X-Gm-Message-State: AOAM532nhe9WydTk0cfojk8j34Iuygi9+Knfzd2wy7InJI6J01wJp9fH Fa6mfWH3iDbnm6z/lIYsn+Iaa+7TLtTO9rUrpRBbANz92AqNgFfvl156oNvWA7y+U43S/OrCBI5 Y8X+y7Df9ecZO8EvEOzLPuvzCVwzvwsAoLT5tvcSTcKJm1vzkbMQYCWST4rJbCqAbj/QPq+j8h4 ru X-Received: by 2002:a17:90a:3d47:: with SMTP id o7mr41873375pjf.68.1624939418540; Mon, 28 Jun 2021 21:03:38 -0700 (PDT) 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-kernel@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 >