Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3151371ybt; Mon, 22 Jun 2020 16:41:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQNiIdODXK2Aaf756gThTx0AGTplmdupqZNO9auobnnoAARWMPMhwwsha/YKFGE9Ahklko X-Received: by 2002:a17:906:32d4:: with SMTP id k20mr17045913ejk.364.1592869284339; Mon, 22 Jun 2020 16:41:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592869284; cv=none; d=google.com; s=arc-20160816; b=YkJgP1z6X27wGeD3ZSWxN8DN1KJ2v3SfZ0xh2XfhkKsD+EKhEEw/HPTeywLBQNQRTF xkZEJ3Vn8s0ochPwfJQFzKV3A56fcZJBJbOUQRDWG8gfSFaAlFNiwvBrEUmVzFaRouaw 9cxmdCSQxzxaP8UNblfNC63sRSpuCqVlhcBssTCzPxqV2HqWavnulHBJ+w6c80OyKuex UNkJ+Kt0k2/JfHx8kDHj5YAetkXJ5eCt7+DwugBbzEbOW+DA72ixR04R/q3IGh7lxV02 MWbNCL0fV2RNPAKlP/ldYrxs9SVqxD0MUb657EVqz47PCAJ9cxiqAtn99wF+ufYpInNH Szxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=+OkYuEGtBWmCdamoI5RkV/30Ug8LA8Bd48QQ050WpCg=; b=GXT9mPio6YPVWSNJU4BITB6TVNvLzBzFVtOdKVN3N4PWt4aRzkYvYX7ZCvnc1/H7J8 wdhgmOTmryRNHKASUxpKJRfDS4FIlON3y94fqYlToK+nCMwRKSu65sMXFCxyAGOk19N1 m35RE//PsNqdAKd0Nm1eFQkGiP2lwbcx93EVGP2K35WziPcLEsmQ+yYa5iVckF8X+XgS oHcFtYuhsivvzFk3y0XC5LTwpnGolAkYLGCtYrclT8K55Rquh6c0V+4WFgvjc1WJsmUg y0jR9bjTFQeAjjhozCpJUtNqMBghlUhLIGSHeRoQacQYQRYNDzkNx16MqPmnJuWxbJCb empA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=Z0yrcSnq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m3si146443edv.382.2020.06.22.16.41.01; Mon, 22 Jun 2020 16:41:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=Z0yrcSnq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731285AbgFVX0w (ORCPT + 99 others); Mon, 22 Jun 2020 19:26:52 -0400 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:16982 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727061AbgFVX0v (ORCPT ); Mon, 22 Jun 2020 19:26:51 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 22 Jun 2020 16:26:06 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 22 Jun 2020 16:26:51 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 22 Jun 2020 16:26:51 -0700 Received: from rcampbell-dev.nvidia.com (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 22 Jun 2020 23:26:41 +0000 Subject: Re: [PATCH 09/16] mm/hmm: add output flag for compound page mapping To: Jason Gunthorpe CC: , , , , , Jerome Glisse , "John Hubbard" , Christoph Hellwig , Ben Skeggs , Andrew Morton , Shuah Khan References: <20200619215649.32297-1-rcampbell@nvidia.com> <20200619215649.32297-10-rcampbell@nvidia.com> <20200622172520.GB2874652@mellanox.com> <15ba19a9-5f71-546b-bdea-31e65fc39693@nvidia.com> <20200622231835.GD2874652@mellanox.com> X-Nvconfidentiality: public From: Ralph Campbell Message-ID: Date: Mon, 22 Jun 2020 16:26:41 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20200622231835.GD2874652@mellanox.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1592868366; bh=+OkYuEGtBWmCdamoI5RkV/30Ug8LA8Bd48QQ050WpCg=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=Z0yrcSnqqy39UtthHbXgST4onrT+geCMj9CZGPtxxEjYRjvnZ/kvuaig9BtbS5ewN 4PIcptsE5rT/Cya1Dawz6nY7KqIoA4ZCnrFgV8aylqKRcIyulrCQdQucOix/auD69Y o+5+eqPgRY6cWpvS5AVPdQy8HhlNirNtE6d1O6Ay43A0Ufmn/YhE81mHzy6s8SVxj6 l2dqTvOK7OV8EoRMMdgr944mPz2zbtHk7IGwF+944sFLpQW5BPEzArNOBM6eKvlkia GV7w1FT1kKnHhScFUsDCR2TRDrVQdKPPziglWU4Q7P8t1qWhtZohHk+jb9zgeiNkMI oeV7F+nI1CdpQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/22/20 4:18 PM, Jason Gunthorpe wrote: > On Mon, Jun 22, 2020 at 11:10:05AM -0700, Ralph Campbell wrote: >> >> On 6/22/20 10:25 AM, Jason Gunthorpe wrote: >>> On Fri, Jun 19, 2020 at 02:56:42PM -0700, Ralph Campbell wrote: >>>> hmm_range_fault() returns an array of page frame numbers and flags for >>>> how the pages are mapped in the requested process' page tables. The PFN >>>> can be used to get the struct page with hmm_pfn_to_page() and the page size >>>> order can be determined with compound_order(page) but if the page is larger >>>> than order 0 (PAGE_SIZE), there is no indication that the page is mapped >>>> using a larger page size. To be fully general, hmm_range_fault() would need >>>> to return the mapping size to handle cases like a 1GB compound page being >>>> mapped with 2MB PMD entries. However, the most common case is the mapping >>>> size is the same as the underlying compound page size. >>>> Add a new output flag to indicate this so that callers know it is safe to >>>> use a large device page table mapping if one is available. >>> >>> But what size should the caller use? >>> >>> You already explained that the caller cannot use compound_ordet() to >>> get the size, so what should it be? >>> >>> Probably this needs to be two flags, PUD and PMD, and the caller should >>> use the PUD and PMD sizes to figure out how big it is? >>> >>> Jason >>> >> >> I guess I didn't explain it as clearly as I thought. :-) >> >> The page size *can* be determined with compound_order(page) but without the >> flag, the caller doesn't know how much of that page is being mapped by the >> CPU. The flag says the CPU is mapping the whole compound page (based on compound_order) >> and that the caller can use device mappings up to the size of compound_order(page). > > No, I got it, I just don't like the assumption that just because a PMD > or PUD points to a page that the only possible value for > compound_page() is PMD or PUD respectively. Partial mapping should be > possible in both cases, if not today, then maybe down the road with > some of the large page work that has been floating about > > It seems much safer to just directly encode the PUD/PMD size in the > flags > > Jason That is fine with me. I'll make that change for v2. I was just trying to minimize the number of flags being added.