Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp97826ybl; Thu, 15 Aug 2019 13:24:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1+nNOAx4wd1AjUaLkLVsZFwDAxPn97X2lujBpueugUqvQipyGBrO5VGgOHgc8Ceysv1Z6 X-Received: by 2002:a63:e10:: with SMTP id d16mr4893152pgl.444.1565900693283; Thu, 15 Aug 2019 13:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565900693; cv=none; d=google.com; s=arc-20160816; b=IsN9r8RYOQeW83z/vn1pgtwi05tNRAr+YjjUUgvWQ76qJGg0QS/hG/C71BeOwSTGm+ CJ/axd8/WxnEiRWucDgNHjypZJvH2n/hlPbpE9g53ZyuaiCWIoeGK/1qacIty8OnRo+Z DDNpzTHZW+j+QbwOwQw6uaQrNuBKp4j0ydIubRu3k20/7IQaYRUyjgqExuK3uRDHbnbZ K9rfthdck1J2iwq2bZCb6gEhQ3HF3t8qrplREs4hAlueka5maesmrL9/eM+IUb7aEu2r mcPtrN2e9P7+/bi7EKorGi2w+4yNJeNaiC2/jpOelAzSlYMtIltC7h62SE/YHpe0eP56 lkkA== 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; bh=hEpjV4EJ5KByjjO9tPYJB/Ni9KNAuLc5/jSAkRMqBmo=; b=QB+jfbviWmmCOR4y8NB6waP6gHRut2VF65dM3/04P1syM8EY9FtWJb9fNtB8b/ulDs 1eHgUzoG4o3UIvIkMn4MS4bY9xP6gz1UDPj875sJ9YtvOLCrhypUUNDbT+OZN2sM5jjx uUwFO5a+DWD3PLUGf158A/azIah7gCxBL89VsPkI8xWvavhF/J/AvYGA3vYLbJXRIDTG xczdQBYbJvIJvLY8bZdDKVcwT1vLhUBx3Zy4DtGaPsY6S7fQzDfn9iyWBmuircRbqirv ia6W/ZHuaNrLkWo11Q1x7doYzfdrDpGhwDuKWDq+M1Rh0MrQhqS9TciC9es2k1nQZXkS qQYQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si1575867pjp.32.2019.08.15.13.24.37; Thu, 15 Aug 2019 13:24:53 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733106AbfHOTnp (ORCPT + 99 others); Thu, 15 Aug 2019 15:43:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45166 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730788AbfHOTno (ORCPT ); Thu, 15 Aug 2019 15:43:44 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3690B300C72E; Thu, 15 Aug 2019 19:43:44 +0000 (UTC) Received: from redhat.com (unknown [10.20.6.178]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6F4BA177C5; Thu, 15 Aug 2019 19:43:41 +0000 (UTC) Date: Thu, 15 Aug 2019 15:43:39 -0400 From: Jerome Glisse To: Dan Williams Cc: Jason Gunthorpe , Christoph Hellwig , 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 04/15] mm: remove the pgmap field from struct hmm_vma_walk Message-ID: <20190815194339.GC9253@redhat.com> References: <20190806160554.14046-5-hch@lst.de> <20190807174548.GJ1571@mellanox.com> <20190808065933.GA29382@lst.de> <20190814073854.GA27249@lst.de> <20190814132746.GE13756@mellanox.com> <20190815180325.GA4920@redhat.com> 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.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 15 Aug 2019 19:43:44 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 15, 2019 at 12:36:58PM -0700, Dan Williams wrote: > On Thu, Aug 15, 2019 at 11:07 AM Jerome Glisse wrote: > > > > On Wed, Aug 14, 2019 at 07:48:28AM -0700, Dan Williams wrote: > > > On Wed, Aug 14, 2019 at 6:28 AM Jason Gunthorpe wrote: > > > > > > > > On Wed, Aug 14, 2019 at 09:38:54AM +0200, Christoph Hellwig wrote: > > > > > On Tue, Aug 13, 2019 at 06:36:33PM -0700, Dan Williams wrote: > > > > > > Section alignment constraints somewhat save us here. The only example > > > > > > I can think of a PMD not containing a uniform pgmap association for > > > > > > each pte is the case when the pgmap overlaps normal dram, i.e. shares > > > > > > the same 'struct memory_section' for a given span. Otherwise, distinct > > > > > > pgmaps arrange to manage their own exclusive sections (and now > > > > > > subsections as of v5.3). Otherwise the implementation could not > > > > > > guarantee different mapping lifetimes. > > > > > > > > > > > > That said, this seems to want a better mechanism to determine "pfn is > > > > > > ZONE_DEVICE". > > > > > > > > > > So I guess this patch is fine for now, and once you provide a better > > > > > mechanism we can switch over to it? > > > > > > > > What about the version I sent to just get rid of all the strange > > > > put_dev_pagemaps while scanning? Odds are good we will work with only > > > > a single pagemap, so it makes some sense to cache it once we find it? > > > > > > Yes, if the scan is over a single pmd then caching it makes sense. > > > > Quite frankly an easier an better solution is to remove the pagemap > > lookup as HMM user abide by mmu notifier it means we will not make > > use or dereference the struct page so that we are safe from any > > racing hotunplug of dax memory (as long as device driver using hmm > > do not have a bug). > > Yes, as long as the driver remove is synchronized against HMM > operations via another mechanism then there is no need to take pagemap > references. Can you briefly describe what that other mechanism is? So if you hotunplug some dax memory i assume that this can only happens once all the pages are unmapped (as it must have the zero refcount, well 1 because of the bias) and any unmap will trigger a mmu notifier callback. User of hmm mirror abiding by the API will never make use of information they get through the fault or snapshot function until checking for racing notifier under lock. Cheers, J?r?me