Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5209787imu; Tue, 29 Jan 2019 14:59:53 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Tq5eNrMT03Hs+Wc0M0wdTKAB+3Siv7yFUmW2Jr+7bqWN6sxFejf10DS90jrk66lqXgChu X-Received: by 2002:a65:65c9:: with SMTP id y9mr25941628pgv.438.1548802793391; Tue, 29 Jan 2019 14:59:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548802793; cv=none; d=google.com; s=arc-20160816; b=L6rb0Eb3nJ8CTaBdlpQqDit7nrzZ4tECWpjwNau0F/nrSnJJT3R37pHkKgFW/a5QNO o74wiA+0HvXGDOa5gmLjVF2KOHTs2P01VT8AI4mU10vY3bO8kdTENLqEncFIBwAcblTX V/RK+cw1M9f+wiKCciZcx8BcF9ecSlGsTmN5UUiOs3C005FV/raGaaH6u4lXKyMj3Adl gc0rsOY7YaIbRhmyI8vwyG+xB6iWl3MxFLbWHOzZ/XmqF5K9il4uQP/Me/HGhXCgG60w 6FphCCoDf0lkZ9bqrUGpKGyfBHbJWS6LePWOVW1HtLb2J7F7bc4RZtMoKQBXygtscDph BYwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to; bh=/HjFY2seYMPvQ4M3/yxiG+mYfSQ9XoLqMI3FGZ7LxXU=; b=Njeg7fsRQMDyk5thothecr220En6pD50OU3OnQJ/U/aCb6flIdHQJo93gyETwfFb4v yM88viJoP7kzR0SC0ljUMKCBFR6SLO8dW+TmDgNnqp3pjQbfTKNjAY4V+WllNEsQ6URA NWtWUgTLxvbai2s+sN2RJU0yOGaz57BhF0IeEV8BDa71z3O+dcse9kYFK5kI9OyLSn/q b9fadVnuS1W0KDnJWu/X54gQatFxZrNbV05eTDhAvuQNZyBhT5DHiTybhwLqV9H+q+l/ eS1J5zzuMQ2UgwfSggs7fVc9gi1fdP2foqKCNwIy7ZjGDBAIJigDGFmbKU7Avcvxogss bagA== ARC-Authentication-Results: i=1; mx.google.com; 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 a124si15444065pfb.263.2019.01.29.14.59.37; Tue, 29 Jan 2019 14:59:53 -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; 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 S1728372AbfA2W7A (ORCPT + 99 others); Tue, 29 Jan 2019 17:59:00 -0500 Received: from ale.deltatee.com ([207.54.116.67]:32828 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726846AbfA2W7A (ORCPT ); Tue, 29 Jan 2019 17:59:00 -0500 Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.89) (envelope-from ) id 1gocL9-0008ND-Kp; Tue, 29 Jan 2019 15:58:48 -0700 To: Jerome Glisse Cc: Jason Gunthorpe , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Greg Kroah-Hartman , "Rafael J . Wysocki" , Bjorn Helgaas , Christian Koenig , Felix Kuehling , "linux-pci@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Joerg Roedel , "iommu@lists.linux-foundation.org" References: <20190129174728.6430-1-jglisse@redhat.com> <20190129174728.6430-4-jglisse@redhat.com> <20190129191120.GE3176@redhat.com> <20190129193250.GK10108@mellanox.com> <99c228c6-ef96-7594-cb43-78931966c75d@deltatee.com> <20190129205749.GN3176@redhat.com> <2b704e96-9c7c-3024-b87f-364b9ba22208@deltatee.com> <20190129215028.GQ3176@redhat.com> From: Logan Gunthorpe Message-ID: Date: Tue, 29 Jan 2019 15:58:45 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190129215028.GQ3176@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-CA Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: iommu@lists.linux-foundation.org, jroedel@suse.de, robin.murphy@arm.com, m.szyprowski@samsung.com, hch@lst.de, dri-devel@lists.freedesktop.org, linux-pci@vger.kernel.org, Felix.Kuehling@amd.com, christian.koenig@amd.com, bhelgaas@google.com, rafael@kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, jgg@mellanox.com, jglisse@redhat.com X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE autolearn=ham autolearn_force=no version=3.4.2 Subject: Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-01-29 2:50 p.m., Jerome Glisse wrote: > No this is the non HMM case i am talking about here. Fully ignore HMM > in this frame. A GPU driver that do not support or use HMM in anyway > has all the properties and requirement i do list above. So all the points > i was making are without HMM in the picture whatsoever. I should have > posted this a separate patches to avoid this confusion. > > Regarding your HMM question. You can not map HMM pages, all code path > that would try that would trigger a migration back to regular memory > and will use the regular memory for CPU access. > I thought this was the whole point of HMM... And eventually it would support being able to map the pages through the BAR in cooperation with the driver. If not, what's that whole layer for? Why not just have HMM handle this situation? And what struct pages are actually going to be backing these VMAs if it's not using HMM? > Again HMM has nothing to do here, ignore HMM it does not play any role > and it is not involve in anyway here. GPU want to control what object > they allow other device to access and object they do not allow. GPU driver > _constantly_ invalidate the CPU page table and in fact the CPU page table > do not have any valid pte for a vma that is an mmap of GPU device file > for most of the vma lifetime. Changing that would highly disrupt and > break GPU drivers. They need to control that, they need to control what > to do if another device tries to peer map some of their memory. Hence > why they need to implement the callback and decide on wether or not they > allow the peer mapping or use device memory for it (they can decide to > fallback to main memory). But mapping is an operation of the memory/struct pages behind the VMA; not of the VMA itself and I think that's evident by the code in that the only way the VMA layer is involved is the fact that you're abusing vm_ops by adding new ops there and calling it by other layers. Logan