From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEC39C2BA19 for ; Thu, 23 Apr 2020 06:10:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 745DD214AF for ; Thu, 23 Apr 2020 06:10:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 745DD214AF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0E5AC8E0006; Thu, 23 Apr 2020 02:10:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 096E68E0003; Thu, 23 Apr 2020 02:10:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EEE768E0006; Thu, 23 Apr 2020 02:10:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0230.hostedemail.com [216.40.44.230]) by kanga.kvack.org (Postfix) with ESMTP id D3E408E0003 for ; Thu, 23 Apr 2020 02:10:27 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 85B32180AD830 for ; Thu, 23 Apr 2020 06:10:27 +0000 (UTC) X-FDA: 76738095294.21.baby66_210b0815bfc18 X-HE-Tag: baby66_210b0815bfc18 X-Filterd-Recvd-Size: 3212 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Thu, 23 Apr 2020 06:10:26 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id B47E6227A81; Thu, 23 Apr 2020 08:10:23 +0200 (CEST) Date: Thu, 23 Apr 2020 08:10:23 +0200 From: Christoph Hellwig To: Jason Gunthorpe Cc: Christoph Hellwig , linux-mm@kvack.org, Ralph Campbell , Alex Deucher , amd-gfx@lists.freedesktop.org, Ben Skeggs , Christian =?iso-8859-1?Q?K=F6nig?= , "David (ChunMing) Zhou" , dri-devel@lists.freedesktop.org, "Kuehling, Felix" , intel-gfx@lists.freedesktop.org, =?iso-8859-1?B?Suly9G1l?= Glisse , John Hubbard , linux-kernel@vger.kernel.org, Niranjana Vishwanathapura , nouveau@lists.freedesktop.org Subject: Re: [PATCH hmm 5/5] mm/hmm: remove the customizable pfn format from hmm_range_fault Message-ID: <20200423061023.GA9856@lst.de> References: <0-v1-4eb72686de3c+5062-hmm_no_flags_jgg@mellanox.com> <5-v1-4eb72686de3c+5062-hmm_no_flags_jgg@mellanox.com> <20200422060329.GD22366@lst.de> <20200422123911.GV26002@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200422123911.GV26002@ziepe.ca> User-Agent: Mutt/1.5.17 (2007-11-01) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Apr 22, 2020 at 09:39:11AM -0300, Jason Gunthorpe wrote: > > Nice callchain from hell.. Unfortunately such "code listings" tend to > > get out of date very quickly, so I'm not sure it is worth keeping in > > the code. What would be really worthile is consolidating the two > > different sets of defines (NVIF_VMM_PFNMAP_V0_ vs NVKM_VMM_PFN_) > > to make the code a little easier to follow. > > I was mainly concerned that this function is using hmm properly, > becuase it sure looks like it is just forming the CPU physical address > into a HW specific data. But it turns out it is just an internal data > for some other code and the dma_map is impossibly far away > > It took forever to find, I figured I'd leave a hint for the next poor > soul that has to look at this.. > > Also, I think it shows there is no 'performance' argument here, if > this path needs more performance the above should be cleaned > before we abuse hmm_range_fault. > > Put it in the commit message instead? Yes, the graph itself sounds reasonable for the commit log as a point of time information. > > > npages = (range->end - range->start) >> PAGE_SHIFT; > > > for (i = 0; i < npages; ++i) { > > > struct page *page; > > > > > > + if (!(range->hmm_pfns[i] & HMM_PFN_VALID)) { > > > + ioctl_addr[i] = 0; > > > continue; > > > + } > > > > Can't we rely on the caller pre-zeroing the array? > > This ends up as args.phys in nouveau_svm_fault - I didn't see a > zeroing? > > I think it makes sense that this routine fully sets the output array > and does not assume pre-initialize Ok.