Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp552751ybe; Fri, 6 Sep 2019 03:44:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxyxizmowx/iXTnGzj5AA0y/e20UJkyZg6pEHKw7cN1wz83u1J5TsgZNKEqNFb35oyFj+a X-Received: by 2002:a62:780c:: with SMTP id t12mr9466840pfc.211.1567766666312; Fri, 06 Sep 2019 03:44:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567766666; cv=none; d=google.com; s=arc-20160816; b=AZimubrrbgKmMwP8YYr74j17mix7fAqK4TXxiCfSOT3ZLGA84mIatS/j0+mHno3xr1 51HokSTwzIWQVQLJBL1asyk6wURCXMe/L+v0hf5pWOV+5qiFvOFUcSI/WTBvxkcA4EKw LFimKzXT6n2xN5lQuLpokGakEEJTuxZbTl78A80zO7wuD6fC4YMbgOFmG+v12jv/0Gvb TyfEvHW814dl701/EhTNWOE6vjDAcOvQevvqZyaUXPaP5+MltAelmZ8HliMU4/cqASfs UOzEJRNifFp1ID6T/GukzCEtwseO2nU7vKzOt2L9YkITRfyXdpb3DJUG6TA5s59hAOdc aWew== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=NZb9OMfbhfEBf9CQkdhgvBZ3CNpG50UBGVbYSMEPXRk=; b=rVB7PPLDpfcdMXufwgJpHlNM2xMKF0lGDuLUXP+oSRjuXl8d0ZfvqwJHYF/dRcfs90 P18lXKE/LGytlVc+WovfYXAXPpqoQDFj5B7uRf1ibxckpJWLCH6UgGkEYgfjcaVenYn8 hbWqxH8Nq5MJaJHbG7UBIRAKuurn9Vb0ZZEU+9a7jp0+KSDoyub/zi1fRhQQXc8MoTrL B+lgFZO0YL0eD4grd3m4yiytuzD1Gyd2iE2PrlCrKgrU9974OKDEALpzu9xi5zpIGTfR oOSg+kSYfXkXDEgjJamgaH5CFJutLNOdYxhX191Ouar50qXL5cLSTFOSeEJLBbqbsrWH UH3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="nQlJ/BiQ"; 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 b1si4057902pgd.263.2019.09.06.03.44.11; Fri, 06 Sep 2019 03:44:26 -0700 (PDT) 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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="nQlJ/BiQ"; 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 S2392408AbfIFGcE (ORCPT + 99 others); Fri, 6 Sep 2019 02:32:04 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:58540 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388744AbfIFGcE (ORCPT ); Fri, 6 Sep 2019 02:32:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=NZb9OMfbhfEBf9CQkdhgvBZ3CNpG50UBGVbYSMEPXRk=; b=nQlJ/BiQGAgDtLtP4cuBwA6Q6F OzgJOnZNJdgSVF7a9WbJ3xEHL8XwVOXqyJWKHWDUU+DeQGvrrgEqNRTJjnPTymABWQlkV01eN8SPp O/tE7BrzLhpsyRfMV7/QgCJeIe+jlhg8nd/iIJM10Mcs68RnHim+H2nHR/xS1VTTPhhHnT+RWNMhk 9SBAzMKPJYYo9nwvGXDaj27RLe5VopaHUolqA/5VhiigzDqgPuktzcZ7scLrWWICZYDa9A6IlNZm+ sNb68z3ID596XCQBv9nbgGDygfVPj4fKgyDhYBLmkWDNh1jdh9ZYZ1ZIQfxiXMeFMZLrizk96LgiH DlIjZxIQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1i67mt-0008Fn-GB; Fri, 06 Sep 2019 06:32:03 +0000 Date: Thu, 5 Sep 2019 23:32:03 -0700 From: Christoph Hellwig To: Thomas =?iso-8859-1?Q?Hellstr=F6m_=28VMware=29?= Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, "pv-drivers@vmware.com" , Thomas Hellstrom , Dave Hansen , Christian =?iso-8859-1?Q?K=F6nig?= Subject: Re: dma_mmap_fault discussion Message-ID: <20190906063203.GA25415@infradead.org> References: <20190905103541.4161-1-thomas_os@shipmail.org> <20190905103541.4161-2-thomas_os@shipmail.org> <608bbec6-448e-f9d5-b29a-1984225eb078@intel.com> <20190905152438.GA18286@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 05, 2019 at 07:05:43PM +0200, Thomas Hellstr?m (VMware) wrote: > I took a quick look at the interfaces and have two questions: > > 1) dma_mmap_prepare(), would it be possible to drop the references to the > actual coherent region? The thing is that TTM doesn't know at mmap time what > memory will be backing the region. It can be VRAM, coherent memory or system I guess we can shift the argument checking into the fault handler. > 2) @cpu_addr and @dma_addr are the values pointing at the beginning of an > allocated chunk, right? Yes. > The reason I'm asking is that TTM's coherent memory > pool is sub-allocating from larger chunks into smaller PAGE_SIZE chunks, > which means that a TTM buffer object may be randomly split across larger > chunks, which means we have to store these values for each PAGE_SiZE chunk. For implementations that remap non-contigous regions using vmap we need the start cpu address passed, as that is used to find the vm_struct structure for it. That being said I don't see a problem with you keeping track of the original start and offset into in your suballocation helpers.