Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4508324ybl; Tue, 21 Jan 2020 22:38:49 -0800 (PST) X-Google-Smtp-Source: APXvYqz9lHy/oQFGcd+sXabrtNxp1cp4Rr5NirDENLR4JYvSj9Id1T+4UFwVNZuFHGeQCGKeXiCK X-Received: by 2002:a54:4896:: with SMTP id r22mr5870512oic.30.1579675129813; Tue, 21 Jan 2020 22:38:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579675129; cv=none; d=google.com; s=arc-20160816; b=nK/SifEChWsp8Hp3k5UBbH+OrT7KuKzUv0BkWw/n4Uwoc7OCeLNAjEHvC88E1UYSKa I7m9FvhJ0kp37rL09CZITT3JMVYq0IL0n/j1y9wfV4Kw39PyhoL1VX8DgodxlTUXw9bH nQbRfCqfQx7RPhSwmVZnCQJVQ4IQlXdLwXVbmdMxpPv++PleaVnbjs2Vk46oeXnLtZ64 NAFYZnM32ByTXlIYQiSx1yPZ0VfAcPsp25X/5qCRGTMcVO6XS1/ED0IUlBFZgXkD+GL+ RT6rAdcjsJf8oqeDmxHZVICiGg3qgc/hbEWGCC0k8NJ9Yqus8HyVaXjDiTCIGciur+Z8 uALQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=1AgtjhKHd4/5av8ia9uDpc8Nq+RQASbmRf/YcZZFxw0=; b=ogO7Kr7E1svF6YDFGkelzJQKdLCUObCU3yakMo5eOGC8naaBLuZUNmFNTZ/dgxrLRQ 8abeutzsC5pRCgveIQrA8vWqdMQZBW742LvetZ2BSgkiZ7klcmdUhAbMRxDLNToiBXS2 zeExpfZHDygtiBixfNdbgnRWZ5BonDcBzWXk4pAo0Yx+vngfprO0OA8pbt2Lz6ZDHhZ7 +PqqS6p7wD17OPmfdyChi3doqyOcrF6wOoESseiCVVR/kX2m8g2C9npnO8E5C7tlvBT4 hcsCDCZH+ZYljL7dHzK/NeJ4AU/o1gR80lCxnL5qjhBkE697P0MqHf67E+u1kHrI89hB zrPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QYJXMx2Y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id q72si21791040oic.18.2020.01.21.22.38.38; Tue, 21 Jan 2020 22:38:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QYJXMx2Y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1725883AbgAVGgf (ORCPT + 99 others); Wed, 22 Jan 2020 01:36:35 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:21967 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725805AbgAVGgf (ORCPT ); Wed, 22 Jan 2020 01:36:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579674994; 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=1AgtjhKHd4/5av8ia9uDpc8Nq+RQASbmRf/YcZZFxw0=; b=QYJXMx2YSaxyYhDL6QAe2rLHrxcOmYZyfQNnz9WbczYnVWu+ZcWAIRSnHXui2pwRovAf0Y 1L1TOOLqftjlJndi+fCEuy5mVyAIYCFiEjL0LxRF4Sj+s1p0fruttDaaeb1vtWZaTxnInl gWTX51D8+/0pqIVSr27xwILKNekjckA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-429-BXbVLD1vPGycxmPEZeguXQ-1; Wed, 22 Jan 2020 01:36:33 -0500 X-MC-Unique: BXbVLD1vPGycxmPEZeguXQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 305F11005502; Wed, 22 Jan 2020 06:36:30 +0000 (UTC) Received: from [10.72.12.103] (ovpn-12-103.pek2.redhat.com [10.72.12.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0F3D60BE0; Wed, 22 Jan 2020 06:36:12 +0000 (UTC) Subject: Re: [PATCH 3/5] vDPA: introduce vDPA bus To: Shahaf Shuler , "Michael S. Tsirkin" Cc: Jason Gunthorpe , Rob Miller , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , Netdev , "Bie, Tiwei" , "maxime.coquelin@redhat.com" , "Liang, Cunming" , "Wang, Zhihong" , "Wang, Xiao W" , "haotian.wang@sifive.com" , "Zhu, Lingshan" , "eperezma@redhat.com" , "lulu@redhat.com" , Parav Pandit , "Tian, Kevin" , "stefanha@redhat.com" , "rdunlap@infradead.org" , "hch@infradead.org" , Ariel Adam , Jiri Pirko , "hanand@xilinx.com" , "mhabets@solarflare.com" References: <20200116124231.20253-4-jasowang@redhat.com> <20200117070324-mutt-send-email-mst@kernel.org> <239b042c-2d9e-0eec-a1ef-b03b7e2c5419@redhat.com> <20200120174933.GB3891@mellanox.com> <2a324cec-2863-58f4-c58a-2414ee32c930@redhat.com> <20200121004047-mutt-send-email-mst@kernel.org> <20200121031506-mutt-send-email-mst@kernel.org> <028ed448-a948-79d9-f224-c325029b17ab@redhat.com> From: Jason Wang Message-ID: Date: Wed, 22 Jan 2020 14:36:10 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/1/21 =E4=B8=8B=E5=8D=887:09, Shahaf Shuler wrote: > Tuesday, January 21, 2020 10:35 AM, Jason Wang: >> Subject: Re: [PATCH 3/5] vDPA: introduce vDPA bus >> >> >> On 2020/1/21 =E4=B8=8B=E5=8D=884:15, Michael S. Tsirkin wrote: >>> On Tue, Jan 21, 2020 at 04:00:38PM +0800, Jason Wang wrote: >>>> On 2020/1/21 =E4=B8=8B=E5=8D=881:47, Michael S. Tsirkin wrote: >>>>> On Tue, Jan 21, 2020 at 12:00:57PM +0800, Jason Wang wrote: >>>>>> On 2020/1/21 =E4=B8=8A=E5=8D=881:49, Jason Gunthorpe wrote: >>>>>>> On Mon, Jan 20, 2020 at 04:43:53PM +0800, Jason Wang wrote: >>>>>>>> This is similar to the design of platform IOMMU part of >>>>>>>> vhost-vdpa. We decide to send diffs to platform IOMMU there. If >>>>>>>> it's ok to do that in driver, we can replace set_map with increm= ental >> API like map()/unmap(). >>>>>>>> Then driver need to maintain rbtree itself. >>>>>>> I think we really need to see two modes, one where there is a >>>>>>> fixed translation without dynamic vIOMMU driven changes and one >>>>>>> that supports vIOMMU. >>>>>> I think in this case, you meant the method proposed by Shahaf that >>>>>> sends diffs of "fixed translation" to device? >>>>>> >>>>>> It would be kind of tricky to deal with the following case for exa= mple: >>>>>> >>>>>> old map [4G, 16G) new map [4G, 8G) >>>>>> >>>>>> If we do >>>>>> >>>>>> 1) flush [4G, 16G) >>>>>> 2) add [4G, 8G) >>>>>> >>>>>> There could be a window between 1) and 2). >>>>>> >>>>>> It requires the IOMMU that can do >>>>>> >>>>>> 1) remove [8G, 16G) >>>>>> 2) flush [8G, 16G) >>>>>> 3) change [4G, 8G) >>>>>> >>>>>> .... >>>>> Basically what I had in mind is something like qemu memory api >>>>> >>>>> 0. begin >>>>> 1. remove [8G, 16G) >>>>> 2. add [4G, 8G) >>>>> 3. commit >>>> This sounds more flexible e.g driver may choose to implement static >>>> mapping one through commit. But a question here, it looks to me this >>>> still requires the DMA to be synced with at least commit here. >>>> Otherwise device may get DMA fault? Or device is expected to be paus= ed >> DMA during begin? >>>> Thanks >>> For example, commit might switch one set of tables for another, >>> without need to pause DMA. >> Yes, I think that works but need confirmation from Shahaf or Jason. > From my side, as I wrote, I would like to see the suggested function p= rototype along w/ the definition of the expectation from driver upon call= ing those. > It is not 100% clear to me what should be the outcome of remove/flush/c= hange/commit Right, I can do this in next version after the discussion is converged. Thanks >