Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6892119ybi; Wed, 31 Jul 2019 23:51:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqz56MSKmixUh8Kk/b2UBBmnxi4RT9csiOujoKtwwyEugl89OJC4UzeFbv8ES4V4feYEdV15 X-Received: by 2002:a63:188:: with SMTP id 130mr115917236pgb.231.1564642298827; Wed, 31 Jul 2019 23:51:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564642298; cv=none; d=google.com; s=arc-20160816; b=UYee5RwmK+agmRxOB2olUXGD9MPUr7erPll8xmHfF0lHyhKJkL2k8mTuYRGZLnAD8k Ba7ISupxds87NiwT0e6sENZgyRLsxtxdkkM5kjFumtXz3wKAxFDv10b8vsNf04QhTTHv 2rF0GqELuzuWSrTnW0Mu6pOK9f4DrfeLKY5sfA+nRutXrBAVveVg/51jIMXVmg4fnE2q lU00U18qNVl/VFyu74SimUhfwIUGkzGQ0y8rJwfhZlS2zzHcrayrFn3VHFMwRR1RDn6u ltAINXUWGb5kWp5hnNP08562swu7n//bN5IYXby3V/1CyOhH19Dbu4yc6Bk+F+EVnYs0 IUYg== 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=8ZweC44Y9oqtOXhFfCaZq4sKhgjTa0P0VPbujWn/PKU=; b=qqz1sUP5wVljKhdIxl1m79Ob4aDsSHPCBc9TVDcUB8xJLjXpbvTiiMAGsGPDMyoWyr WVJybAIQTVteqzHl4gujdNh8YkpSElDjVO6l8VsrVtqLgFfmTrEsO/mktjUNnUDQxGkp swro0yFKR9fk1mOPEhqrNvtwN66YA21XKH9uDC6sTeJPfKYfVdE4AI65MFQabJTY0aur z1LIptENniSyXk77BovvRn+WwsE+mxKtufKvkYUfZXbXWqjepUCr7wgmR7wEQNtDriSE 5a9WxsYfJ8jt6AwXFqL9uHH9IHxRgL6jDVNUCUkPjHX6UvdDXzOxEslm6UZ1lO6OnYbH X/+w== 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 73si39908550pgg.72.2019.07.31.23.51.23; Wed, 31 Jul 2019 23:51:38 -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; 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 S1730596AbfHAGtS (ORCPT + 99 others); Thu, 1 Aug 2019 02:49:18 -0400 Received: from verein.lst.de ([213.95.11.211]:40711 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730296AbfHAGtS (ORCPT ); Thu, 1 Aug 2019 02:49:18 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id A602568B05; Thu, 1 Aug 2019 08:49:14 +0200 (CEST) Date: Thu, 1 Aug 2019 08:49:14 +0200 From: Christoph Hellwig To: Jason Gunthorpe Cc: Christoph Hellwig , =?iso-8859-1?B?Suly9G1l?= Glisse , Ben Skeggs , Felix Kuehling , Ralph Campbell , "linux-mm@kvack.org" , "nouveau@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "amd-gfx@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 07/13] mm: remove the page_shift member from struct hmm_range Message-ID: <20190801064914.GA15404@lst.de> References: <20190730055203.28467-1-hch@lst.de> <20190730055203.28467-8-hch@lst.de> <20190730125512.GF24038@mellanox.com> <20190730131430.GC4566@lst.de> <20190730175011.GL24038@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190730175011.GL24038@mellanox.com> 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, Jul 30, 2019 at 05:50:16PM +0000, Jason Gunthorpe wrote: > The way ODP seems to work is once in hugetlb mode the dma addresses > must give huge pages or the page fault will be failed. I think that is > a terrible design, but this is how the driver is .. > > So, from this HMM perspective if the caller asked for huge pages then > the results have to be all huge pages or a hard failure. Which isn't how the page_shift member works at moment. It still allows non-hugetlb mappings even with the member. > It is not negotiated as an optimization like you are thinking. > > [note, I haven't yet checked carefully how this works in ODP, every > time I look at parts of it the thing seems crazy] This seems pretty crazy. Especially as hugetlb use in applications seems to fade in favour of THP, for which this ODP scheme does not seem to work at all. > > The best API for mlx4 would of course be to pass a biovec-style > > variable length structure that hmm_fault could fill out, but that would > > be a major restructure. > > It would work, but the driver has to expand that into a page list > right awayhow. > > We can't even dma map the biovec with today's dma API as it needs the > ability to remap on a page granularity. We can do dma_map_page loops over each biovec entry pretty trivially, and that won't be any worse than the current loop over each page in the hmm dma helpers. Once I get around the work to have a better API for iommu mappings for bio_vecs we could coalesce it similar to how we do it with scatterlist (but without all the mess of a new structure). That work is going to take a little longer through, as it needs the amd and intell iommu drivers to be convered to dma-iommu which isn't making progress as far as I hoped. Let me know if you want to keep this code for now despite the issues, or if we'd rather reimplement it once you've made sense of the ODP code.