Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1198061ybl; Fri, 16 Aug 2019 10:29:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyEtomd7cICgJqvpUl4U20EDF/cTCqTXtRsLaqM/M9iJtt2zNsyKIPLnlLDD3ufvcQsRj18 X-Received: by 2002:a63:2b84:: with SMTP id r126mr8993984pgr.308.1565976582132; Fri, 16 Aug 2019 10:29:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565976582; cv=none; d=google.com; s=arc-20160816; b=iVogFOg9pym6uQmJbi0Qt7wXTeucB07e/Pk/BZOfalBZXfTX0vBfdyif0jY8pI6o7f wofryzzlPeG2em86kQEbp17C4vqpAbRBGA5Zo9v9EgNvyi1K2mjdm3gqCplSzZF75/wl sgIbFsZswwsnFS3VrETGzh5ME9eEwxRSdm9te3AAg1HfcykNcOUteAkVXCfHFCxpaEAf q+6lsIgYMAeCULUKU9nLrytS5V1BAKKxazngZNppwRaeO4T4feCW+jUCbaHdDg2TzGLf F2d+vTOcaE6RkbrCgzKCFDN7IiI+m+42j+pGqqFVjAJpC18EtgpU0gAgTjOLfrn8E8zb mMPw== 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:dkim-signature; bh=F45QDEu01tuosMxeBXshNdQV0qdzUW+A54VgIcKeIPQ=; b=upXSy+WbxtQtcK7LMosRDvpEJJ3QzsmVQuTuVG6xyq6PDFBYrfR6xDTWn7OtCSaMAs bqOYuCfCJldn+rx1ssHkWQefLy//4PNpt7LAhpIY0oASG1fAl3x1WMXQV/QreJP9+sNe HR+wITf/8mwz0UMIpic9FzR7pjMZ+PBoO4sq1JuaqxGMkzcQrFFLgwBIpYopllElG/Y5 zlA9fPbJzEQZIF6+2MV2SA9RaJrfEynggSGFWzSApk+47211g22Efwg0nXKfHNTL6AWt SF4on0SMXAlwvv8MWdeOj40U8/IhGBvCkynKpiqDtcfFNlILlYADrJ4uNU9fyMGyb+EJ ecYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b="Ixj/SoRJ"; 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 t4si4500922plb.366.2019.08.16.10.29.26; Fri, 16 Aug 2019 10:29:42 -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=pass header.i=@ziepe.ca header.s=google header.b="Ixj/SoRJ"; 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 S1727471AbfHPR2s (ORCPT + 99 others); Fri, 16 Aug 2019 13:28:48 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:34589 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727067AbfHPR2s (ORCPT ); Fri, 16 Aug 2019 13:28:48 -0400 Received: by mail-qk1-f196.google.com with SMTP id m10so5404847qkk.1 for ; Fri, 16 Aug 2019 10:28:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=F45QDEu01tuosMxeBXshNdQV0qdzUW+A54VgIcKeIPQ=; b=Ixj/SoRJ+JjSkgtbnuAlNvEeswSUCwNKuaFLHbk074FCSMAJ0pzN8tT5ReRltjL3Gf RXaC7Ipl87f6oMqTWoY3dK/rv/Ebn3jzmPoC+B9dSW991uhIw2U1xamLQQ3fvpz00edL a1Qocl++KZdMEzFneehLs3O2p4g22HJREvBTuudS9ss8+VoG+YpK0ZFVhPwXCQgOxb6j l6IQtFd6edwrjdoeNrOu2K5jjVrdqOXCbrbFGIwZVckM7s7BYM9XDbDzPSyLrnPtV7PI DEyvAFgALyQTa6Ip+Z3b1PmCilg+vCouLsoy7GiMDwRlevDCUcK2g+VvO1oDcMgFgFEI aK0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=F45QDEu01tuosMxeBXshNdQV0qdzUW+A54VgIcKeIPQ=; b=HGNgvfh8sgmljeMNaQQivhG8gGxsAj45N4PTmLagN5GQd6bq+w0+A1ny+ApJSVRCaY dwGN/6GVjfXX44N68Tp4EE1ewD+wVlhxi0XwW2UOpOYs6vk4st3GWDlNGVmNo1PfPMqB 1qwUJTamz1duedQ0KFWlls9Xd2rmUs0yfgE1Ur8bWoIZYYbSh+9h7385p9O5r4B/+m5O 4EvyHk1wfwj0sdtvLJJGAK8iuyM68YT/Pl+iXQqnmpMuUk6Dcg2zvRz3z9+oexbWJzTS 2XYNl5HeFVOZJQaAr0t7CvF14vVkVqjs1FtCIRZ0uRj6syTT6gIz8/9N/JrD4iBsBjrT S/Qg== X-Gm-Message-State: APjAAAWqA/pkGhDNyvHNjAhO8F2rdnc58cgeHaoSIoWM3SkejH8HOKVi +U75NtpE4DtF1LCOZz6RbHkkHA== X-Received: by 2002:a05:620a:143b:: with SMTP id k27mr9740698qkj.426.1565976527486; Fri, 16 Aug 2019 10:28:47 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-55-100.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.55.100]) by smtp.gmail.com with ESMTPSA id t26sm3867534qtc.95.2019.08.16.10.28.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Aug 2019 10:28:47 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hyg1u-0000vn-Jo; Fri, 16 Aug 2019 14:28:46 -0300 Date: Fri, 16 Aug 2019 14:28:46 -0300 From: Jason Gunthorpe To: Dan Williams Cc: Jerome Glisse , 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: <20190816172846.GJ5398@ziepe.ca> References: <20190815194339.GC9253@redhat.com> <20190815203306.GB25517@redhat.com> <20190815204128.GI22970@mellanox.com> <20190816004053.GB9929@mellanox.com> <20190816122414.GC5412@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 16, 2019 at 10:21:41AM -0700, Dan Williams wrote: > > We can do a get_dev_pagemap inside the page_walk and touch the pgmap, > > or we can do the 'device mutex && retry' pattern and touch the pgmap > > in the driver, under that lock. > > > > However in all cases the current get_dev_pagemap()'s in the page walk > > are not necessary, and we can delete them. > > Yes, as long as 'struct page' instances resulting from that lookup are > not passed outside of that lock. Indeed. Also, I was reflecting over lunch that the hmm_range_fault should only return DEVICE_PRIVATE pages for the caller's device (see other thread with HCH), and in this case, the caller should also be responsible to ensure that the driver is not calling hmm_range_fault at the same time it is deleting it's own DEVICE_PRIVATE mapping - ie by fencing its page fault handler. This does not apply to PCI_P2PDMA, but, lets see how that looks when we get there. So the whole thing seems pretty safe. Jason