Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3470858pxv; Sun, 4 Jul 2021 20:37:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQEuM8ggCAQd8eyr6x0Fa61fwXEc//FlEp7/VQbequKkrKjJxkqdaPuyJ9s2S1hHvcsB5M X-Received: by 2002:a05:6638:1316:: with SMTP id r22mr10653078jad.89.1625456269264; Sun, 04 Jul 2021 20:37:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625456269; cv=none; d=google.com; s=arc-20160816; b=QfJ/7Ax2vFM/d0cWOdHADLeELIpgscDqdyi0ovlBQoaXbvOt6GW5jx3S7iV68qZBtY 7gkM/3b64jIL0XRhaxvyXdPs4bgSefZGNfKiqvr9LJyVaq1fvYawjYwMLFi0N/9f4waj Db31bUoxSItpAmE8O5RZUMPq6tK5ws+DrTz4G2HZZ1U2vmx+vpsesRpePRPAPwLjRKuC 2s9GMveFlhw0MrOUK76iMwe7LhnafKu/C1lgpUoF8XXN/OajXsB+PILwz4THzHNmlbAw +enfxq7alPkxJ00QZAQHtrUEJZhyL1SgYKf8NbNi+GhTY11OVoy0hNgC6S36DXLRqSDx PUfw== 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=PNRaRFhxCfnbw9LvPZ80acVFOHmYfRIDpgg4dy1jTTw=; b=YvwZB79c1cZh+MLQQiU+K3Yg3UWyiH5yksgxXRvfGUXRvLV0HO0vogsqN0e8BNR9h1 su3H4s4Yfo9D3cnQ3pN1K+LG4jd/k2uk0ZB7Sj7zXRAzbSIcGBjshPxyOiBnPT6ymqfl 2FnzFPHtAZbTqwB+2EUUGb9E7+YVYip9oxxpmTkH5aHygfLeuKjOpXTHw7ZncRFwa9wK Sr4MRo7PKm/J+Yb73XC3dkauF8+Nbi4UaZ6HgfUlpp78eFy6kEPikzURZ6aRG2uomE/y AmIXKycgKsmt7bnDsMyvLibOKSe5W2pXrD5H5qTSCVMANMZURuv1HnG53HjeKGlKgCJg yU1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aNN86Z9W; 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 d187si15482401iog.56.2021.07.04.20.37.37; Sun, 04 Jul 2021 20:37:49 -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=aNN86Z9W; 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 S229812AbhGEDjI (ORCPT + 99 others); Sun, 4 Jul 2021 23:39:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35821 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229728AbhGEDjG (ORCPT ); Sun, 4 Jul 2021 23:39:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625456190; 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=PNRaRFhxCfnbw9LvPZ80acVFOHmYfRIDpgg4dy1jTTw=; b=aNN86Z9WBpniD+7U7SY/V3S5RduvyFy/H0esuq2+YMvYI0WVUSpe69toHpxn9aqlaP+/qx wW4Tcw4m57vdC7OCW/1Ro/TnlcTHJtA3Zkjfy75pT0VTL5Abg4AcGzjMnkA2SEfg9tde8j TR8hAf7P1NodVXl2uaITDQ4PqU3FoDI= Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-9-zru_N9AGOTCvyYmwaxjReA-1; Sun, 04 Jul 2021 23:36:29 -0400 X-MC-Unique: zru_N9AGOTCvyYmwaxjReA-1 Received: by mail-pg1-f198.google.com with SMTP id p2-20020a63e6420000b02902271082c631so12611874pgj.5 for ; Sun, 04 Jul 2021 20:36:29 -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=PNRaRFhxCfnbw9LvPZ80acVFOHmYfRIDpgg4dy1jTTw=; b=SSoFkGF83FDJrzDjk1tO4/Q/GkJaZF8FICiKZyogxVIOl1mosZe87POj3eksSoJ+bL ShDA/ZdrepNRXHyQmhMjzR9g71xn5/akLeJPG3P9GkDoEyqBTGfKOkDi1Ncg7VSFuHpU TiPKCq3qH9iQm5yk6hWAa+i9JfbsHf52uf6zHTGTpxvwAjJkgX2D1a/IG1L1lrrX9SLv vOFiDJrhuJVj6scEAemrMUeHnGUx0x2FFm1xVUY7OrrWxi6E3aAVD7RGgG88YmunToGU CnidLPPF9CSKjQ7SNcns4yPgW7xMYEpF4WjpAVH4e/Cu7dD4bt2rfb806/DBRLEvaTrt aKwA== X-Gm-Message-State: AOAM530EWuSdfLI5Bq9tCIXRis6ikFOySpd6eaw401Yix+Rm2IVClnY1 BE4CeSAQCd/YWE9BhUpNk+WwiK76kqpdMPwMkNAbr2QaX7s1I+pzWz7fWnRm5+LxqCBsSp6b2Rk pz+qSBglwaKKGnOqG1B7gQy/RUJdyjJzno/Ka+84T4OFby7u4moHLZdZljTBTC1UCQDLk39XP+w 1w X-Received: by 2002:a62:b502:0:b029:2ec:a539:e29b with SMTP id y2-20020a62b5020000b02902eca539e29bmr12907052pfe.37.1625456187966; Sun, 04 Jul 2021 20:36:27 -0700 (PDT) X-Received: by 2002:a62:b502:0:b029:2ec:a539:e29b with SMTP id y2-20020a62b5020000b02902eca539e29bmr12907014pfe.37.1625456187646; Sun, 04 Jul 2021 20:36:27 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id u13sm10509834pfi.54.2021.07.04.20.36.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Jul 2021 20:36:27 -0700 (PDT) Subject: Re: [PATCH v8 10/10] Documentation: Add documentation for VDUSE To: Yongji Xie , Stefan Hajnoczi Cc: "Michael S. Tsirkin" , 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-11-xieyongji@bytedance.com> From: Jason Wang Message-ID: <8320d26d-6637-85c6-8773-49553dfa502d@redhat.com> Date: Mon, 5 Jul 2021 11:36:15 +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/7/4 下午5:49, Yongji Xie 写道: >>> OK, I get you now. Since the VIRTIO specification says "Device >>> configuration space is generally used for rarely-changing or >>> initialization-time parameters". I assume the VDUSE_DEV_SET_CONFIG >>> ioctl should not be called frequently. >> The spec uses MUST and other terms to define the precise requirements. >> Here the language (especially the word "generally") is weaker and means >> there may be exceptions. >> >> Another type of access that doesn't work with the VDUSE_DEV_SET_CONFIG >> approach is reads that have side-effects. For example, imagine a field >> containing an error code if the device encounters a problem unrelated to >> a specific virtqueue request. Reading from this field resets the error >> code to 0, saving the driver an extra configuration space write access >> and possibly race conditions. It isn't possible to implement those >> semantics suing VDUSE_DEV_SET_CONFIG. It's another corner case, but it >> makes me think that the interface does not allow full VIRTIO semantics. Note that though you're correct, my understanding is that config space is not suitable for this kind of error propagating. And it would be very hard to implement such kind of semantic in some transports.  Virtqueue should be much better. As Yong Ji quoted, the config space is used for "rarely-changing or intialization-time parameters". > Agreed. I will use VDUSE_DEV_GET_CONFIG in the next version. And to > handle the message failure, I'm going to add a return value to > virtio_config_ops.get() and virtio_cread_* API so that the error can > be propagated to the virtio device driver. Then the virtio-blk device > driver can be modified to handle that. > > Jason and Stefan, what do you think of this way? I'd like to stick to the current assumption thich get_config won't fail. That is to say, 1) maintain a config in the kernel, make sure the config space read can always succeed 2) introduce an ioctl for the vduse usersapce to update the config space. 3) we can synchronize with the vduse userspace during set_config Does this work? Thanks >