Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp530890imu; Wed, 16 Jan 2019 03:18:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN6r8na9GzOJrVvNziXNQU1kZXjOT3CNjB06Mrnbp+CLPrtkzVUmVUwEVAJkVofbt2DAB5DM X-Received: by 2002:a17:902:1e9:: with SMTP id b96mr9373939plb.150.1547637494638; Wed, 16 Jan 2019 03:18:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547637494; cv=none; d=google.com; s=arc-20160816; b=IV0esTGSyd9x8cAfmr+hRWncPwnzZWrqMBylE99yZ47KHcdumKFu3zw0UXkfwdqv1N mK4J6W+42eqRfMKllm8lfycfmPdxtC+5QQNBSZ3m4YWqINWohODvbFeoeOu2wKuG0IY/ KndiGRfBWDf5kQoav2tfvKhOWXY0AUKaql6VlwKzqqjgxPdfKz9L4fN8/gCEP91ke2+U u6vfxSlPrnGp18Vq/pQNtRySfKU6toFmxeOE698Ply5q1XpoZknXhlbM3p9QhtNTi3ja yd/l+MVsOMrjbo7ol/o4kiHsU1ymWqDcah2yob72NxxO3hwNFg2KzkPfHwEv0jn/2QbG gnow== 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; bh=xNmqPZP2vAdwVvUSMLrjLQl6FJN3+Lgqv1pxK33XZ4g=; b=b9K9xsh4RPwt/db8CvzyQPBUbYhwlQrf08y13JFpaFSPPFxlXnofytSSQXqjRHOepX scDWGsBkYjhsI9Do0QbxgNnCJYxVDA5kggFNHqo7BlpjqswFYe2ZT1GtuMcyCDEUcv5q QZdjKPJNHSdBs8PGgIt+8KjkxirsB0iXfutTV9DMUVXRyqxG1Sjr1rOAD6j8ZcTSNLCN v7vsUTUs2ZdcGV57yT8iVEcnVSpa/aK4rCojZW/04fLME2vTkaTngSkuvffH9lENDATU ZJC8KteKXyDTmqCm9j2MWkpymzlon6V1e7u5V0cl0zA/kksQ0HVf1sy/vsX46i2vZuDb +wwA== 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 y8si6006713pfn.26.2019.01.16.03.17.58; Wed, 16 Jan 2019 03:18:14 -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 S2390078AbfAOU6E (ORCPT + 99 others); Tue, 15 Jan 2019 15:58:04 -0500 Received: from verein.lst.de ([213.95.11.211]:55467 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730050AbfAOU6E (ORCPT ); Tue, 15 Jan 2019 15:58:04 -0500 Received: by newverein.lst.de (Postfix, from userid 2407) id A098467358; Tue, 15 Jan 2019 21:58:01 +0100 (CET) Date: Tue, 15 Jan 2019 21:58:01 +0100 From: "hch@lst.de" To: "Koenig, Christian" Cc: "hch@lst.de" , Thomas Hellstrom , "linux-kernel@vger.kernel.org" , "yong.zhi@intel.com" , "daniel.vetter@ffwll.ch" , "linux-rdma@vger.kernel.org" , "linux-media@vger.kernel.org" , "bingbu.cao@intel.com" , "jian.xu.zheng@intel.com" , "tian.shu.qiu@intel.com" , "shiraz.saleem@intel.com" , "sakari.ailus@linux.intel.com" , "dri-devel@lists.freedesktop.org" , "jgg@ziepe.ca" Subject: Re: [PATCH] lib/scatterlist: Provide a DMA page iterator Message-ID: <20190115205801.GA15432@lst.de> References: <20190104223531.GA1705@ziepe.ca> <20190110234218.GM6890@ziepe.ca> <20190114094856.GB29604@lst.de> <1fb20ab4b171b281e9994b6c55734c120958530b.camel@vmware.com> <2b440a3b-ed2f-8fd6-a21e-97ca0b2f5db9@gmail.com> <20190115152029.GB2325@lst.de> <41d0616e95fb48942404fb54d82249f5700affb1.camel@vmware.com> <20190115183133.GA12350@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 15, 2019 at 07:13:11PM +0000, Koenig, Christian wrote: > Thomas is correct that the interface you propose here doesn't work at > all for GPUs. > > The kernel driver is not informed of flush/sync, but rather just setups > coherent mappings between system memory and devices. > > In other words you have an array of struct pages and need to map that to > a specific device and so create dma_addresses for the mappings. If you want a coherent mapping you need to use dma_alloc_coherent and dma_mmap_coherent and you are done, that is not the problem. That actually is one of the vmgfx modes, so I don't understand what problem we are trying to solve if you don't actually want a non-coherent mapping. Although last time I had that discussion with Daniel Vetter I was under the impressions that GPUs really wanted non-coherent mappings. But if you want a coherent mapping you can't go to a struct page, because on many systems you can't just map arbitrary memory as uncachable. It might either come from very special limited pools, or might need other magic applied to it so that it is not visible in the normal direct mapping, or at least not access through it.