Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3236613imu; Sat, 24 Nov 2018 00:46:39 -0800 (PST) X-Google-Smtp-Source: AFSGD/UQsRVs5ZNVwN5hNOSjUEpgMxfrkgbOEse10Ld/mdIjn87DCE8c+6gIY8Cf1rMYLgRookHm X-Received: by 2002:a17:902:7791:: with SMTP id o17mr18914902pll.60.1543049199803; Sat, 24 Nov 2018 00:46:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543049199; cv=none; d=google.com; s=arc-20160816; b=pBh6nUQiNyud2vpAsHkjUlnn7L/PuZHbg/eNti3XvUNLUCiiq/jZ6PacFxgEjnvuil IBcrnmw+ismpsxQ1GLlI/dy0fuSOpnV2IwHdN6rtUSLP999gHViBm7R7TW44Td6ZsLaF JyrffOEZFsAxgu/sjDseyvNMUI3z83iXvTGDGigKdlO6rGrzw1VIW0kDJQyAk/2aNqd2 5faAEQ98JETWhrK8hE3/Fd7l+P0ZX7WgOZGfKve0gqZJccow6wiziuS02o+UeWqJcXAq 9vPu4NDk+39hBfv6eAHW5geVuW86dFD23SjcyDJz9uoJkG+U+StApUy2jkX48SqdqwOH 7k2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=mLGXK/dNfwHeDavvB2GkmSK7lW9Am0Mpj9z7LI5hfcs=; b=VrvZ0CRL33tyaF+g5zJBC+99KONhgZClPuPdT5yUYpEhqw5bN+jXQZ04fzoWjmz4/7 INDtGNw3U9lCpQzCdwjlc3XD+GVMCrQcbyd8pNyopNK1ZGsit7tQpdHhuE0Pv7MczZ8R RP+860yezsqJHAHEABC7uNnW3Z3bBdN7hYjIr22HytfQFjngfwbUxif70qBAUhbR8rCP 7YYNyy7mZfmTYrP3H9oK2hTjVzSG7jrJHbibwexb2CfNnwVj+EBlXe9y5lyA7UyzyKlP UoopjnPFIm6OlfLHcwzGg9ptMyAE644mtCZGvLpdBt8QBLrTjrgpONoJEd4sVxQr49hc 6kCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=PhfuvGeD; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1si22739504pgq.553.2018.11.24.00.46.25; Sat, 24 Nov 2018 00:46:39 -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=@ziepe.ca header.s=google header.b=PhfuvGeD; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2441115AbeKXEu0 (ORCPT + 99 others); Fri, 23 Nov 2018 23:50:26 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:46669 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2395334AbeKXEu0 (ORCPT ); Fri, 23 Nov 2018 23:50:26 -0500 Received: by mail-pf1-f195.google.com with SMTP id c73so3638077pfe.13 for ; Fri, 23 Nov 2018 10:05:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mLGXK/dNfwHeDavvB2GkmSK7lW9Am0Mpj9z7LI5hfcs=; b=PhfuvGeD4ynaoG65V78SUvVrPLZBjzuP75HjRch8zj7cXNnxHZSQ3Q0Mg8njg+h3Hm ANzyvIKOosxGcus8upBqCnQANEpJO44u78ywb2CcF3MaBndvbuAgzrqkm5K/5HSbmKZw mPzdNV33jPtRHYuhFLREfiqOBKXqmkG9nRG8pIQWaNNEQPZCt2pfK4FwtNphZbamdc3F jZisWY9WzProZQ8CA0c1hPdJ61Ww6i8TlCl3nJsqoL/JE7XvHJk8gbX/05lJsJKPBmuy azfpCRBHkRSJRi6KzMeMrZ7D/Rrje7aPACpBBLkvZHiDeQyGQE99fQ7ixEs83wNrb1Ib bTGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mLGXK/dNfwHeDavvB2GkmSK7lW9Am0Mpj9z7LI5hfcs=; b=f82sVHjiIX90qYu7+XBaMwqMI5B2ktSPIOkZsxviiJVZEhLLS6KZDwuDm0ZhzIkuyv 1rqeODnqcTHXTevL2w6LeKMBdp3D6DC+nzaXhWzSBBP0d8kw0VoQdvhJWaBLQaJ7ZnpG Lun71gHFIk6rU+5y/046GheL0iAXTBMneNQC2d2e7m91OwN4ktcrEasRhy7FzxYJEc5T TiQCtAc8oLAkjb+P0ks8i/TzL88pdSLnqwjpbCcJQWz4RxXHtpf6OGtx6Be4YBPdOa/q xVIw7tG+NQza3HCHKCHMj4rjRWxAYEGcwJlcxsIq6JOuZghHYbcvWPzWc0nJ8QVS6gir x+OQ== X-Gm-Message-State: AGRZ1gK4G9bGW/MKKVbEtJhopYpNj3qL5Jf3MacZsTQ31oqLheEL33X3 foy/xdZAsaMFTjYGBeUFBkPmQw== X-Received: by 2002:a62:434d:: with SMTP id q74-v6mr17128683pfa.242.1542996307316; Fri, 23 Nov 2018 10:05:07 -0800 (PST) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id k15sm8514470pfb.147.2018.11.23.10.05.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 23 Nov 2018 10:05:06 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1gQFpA-0001tq-VG; Fri, 23 Nov 2018 11:05:04 -0700 Date: Fri, 23 Nov 2018 11:05:04 -0700 From: Jason Gunthorpe To: Kenneth Lee Cc: Leon Romanovsky , Kenneth Lee , Tim Sell , linux-doc@vger.kernel.org, Alexander Shishkin , Zaibo Xu , zhangfei.gao@foxmail.com, linuxarm@huawei.com, haojian.zhuang@linaro.org, Christoph Lameter , Hao Fang , Gavin Schenk , RDMA mailing list , Zhou Wang , Doug Ledford , Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , David Kershner , Johan Hovold , Cyrille Pitchen , Sagar Dharia , Jens Axboe , guodong.xu@linaro.org, linux-netdev , Randy Dunlap , linux-kernel@vger.kernel.org, Vinod Koul , linux-crypto@vger.kernel.org, Philippe Ombredanne , Sanyog Kale , "David S. Miller" , linux-accelerators@lists.ozlabs.org Subject: Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce Message-ID: <20181123180504.GA3395@ziepe.ca> References: <20181114160017.GI3759@mtr-leonro.mtl.com> <20181115085109.GD157308@Turing-Arch-b> <20181115145455.GN3759@mtr-leonro.mtl.com> <20181119091405.GE157308@Turing-Arch-b> <20181119184954.GB4890@ziepe.ca> <20181120030702.GH157308@Turing-Arch-b> <20181120032939.GR4890@ziepe.ca> <20181121060805.GJ157308@Turing-Arch-b> <20181122025840.GB19938@ziepe.ca> <20181123080242.GK157308@Turing-Arch-b> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181123080242.GK157308@Turing-Arch-b> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 23, 2018 at 04:02:42PM +0800, Kenneth Lee wrote: > It is already part of Jean's patchset. And that's why I built my solution on > VFIO in the first place. But I think the concept of SVA and PASID is not > compatible with the original VFIO concept space. You would not share your whole > address space to a device at all in a virtual machine manager, > wouldn't you? Why not? That seems to fit VFIO's space just fine to me.. You might need a new upcall to create a full MM registration, but that doesn't seem unsuited. Part of the point here is you should try to make sensible revisions to existing subsystems before just inventing a new thing... VFIO is deeply connected to the IOMMU, so enabling more general IOMMU based approache seems perfectly fine to me.. > > Once the VFIO driver knows about this as a generic capability then the > > device it exposes to userspace would use CPU addresses instead of DMA > > addresses. > > > > The question is if your driver needs much more than the device > > agnostic generic services VFIO provides. > > > > I'm not sure what you have in mind with resource management.. It is > > hard to revoke resources from userspace, unless you are doing > > kernel syscalls, but then why do all this? > > Say, I have 1024 queues in my accelerator. I can get one by opening the device > and attach it with the fd. If the process exit by any means, the queue can be > returned with the release of the fd. But if it is mdev, it will still be there > and some one should tell the allocator it is available again. This is not easy > to design in user space. ?? why wouldn't the mdev track the queues assigned using the existing open/close/ioctl callbacks? That is basic flow I would expect: open(/dev/vfio) ioctl(unity map entire process MM to mdev with IOMMU) // Create a HQ queue and link the PASID in the HW to this HW queue struct hw queue[..]; ioctl(create HW queue) // Get BAR doorbell memory for the queue bar = mmap() // Submit work to the queue using CPU addresses queue[0] = ... writel(bar [..], &queue); // Queue, SVA, etc is cleaned up when the VFIO closes close() Presumably the kernel has to handle the PASID and related for security reasons, so they shouldn't go to userspace? If there is something missing in vfio to do this is it looks pretty small to me.. Jason