Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1192935ybl; Fri, 16 Aug 2019 10:23:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqykYTt9wBvbWY3wO73D+rc9lxzH9zI7s09TKoFtfmROqVfktyMZ7NEPj3mIHi2RJPhY+zcO X-Received: by 2002:a17:90a:fe01:: with SMTP id ck1mr8233423pjb.89.1565976234848; Fri, 16 Aug 2019 10:23:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565976234; cv=none; d=google.com; s=arc-20160816; b=bPV0NPhsUHnJVWiPsGv+nkzAuywv7XLcWkH4QQLvFxHUu5tE6LYmRfMZeEz4Chm0vT 2rcBZV1Npa0cyzIGXgOZLd+j6Rmoqsvby+1wu78Dpzha6vk19ewPKeHFcAqEo+kqGZio GXRpjh0IFAWtpQ1IfEb4RkPrLlaJFfdrJ/WshOrvPAkls22qF19KjPufLk0QO85SccjQ 8gH3d1HZXnTRxJYoESnf5goPp84hsoACkR9n9vYkV1GBBi1oLkdXrRGaN1j2uUu73b/j NhdSFZ71UfrS37qXZPsgvJuTnksI+X62XJqotYbI5P1BB7gJ/EUQptFypaF8O69Z6hvC b2+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=zMvxega2p/6F2S/eoDzz+sN4i7bM8B+uz60Grtez1JE=; b=cBGXzg+MTEb6UnMg/qnk+jDVwsSPEcBm4Udn5D/04Z3jHS2DdaaJvvZZAP/tewCDXp nsvnkCQraxEAh1h1ET+oFtxRmK+ETNbWaBKBqWYwP8hgYU4q5DzEsjSqNNQPVmUwtMJ6 yqYKBhnzithWJg8HR1sgYzpYNc3dVSPcZoeWgUCB/RELeabSO1UOVeBXDvxezalrAvKV V59xXtKPStTTtSK22o0bLyUDrElOJBz0w4KUQ5VpM7qAfSTRRI2JUhBvVNnq79v0akvG cAAqUQg4sdY0UMvzgolo08+ZYYgdponYjkOMHjhipgxHuFmgX1AnRd6geVdne+Z5RYkD te1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=QCN9eZvx; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j187si4117914pge.591.2019.08.16.10.23.39; Fri, 16 Aug 2019 10:23:54 -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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=QCN9eZvx; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727497AbfHPRVy (ORCPT + 99 others); Fri, 16 Aug 2019 13:21:54 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:37163 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726469AbfHPRVy (ORCPT ); Fri, 16 Aug 2019 13:21:54 -0400 Received: by mail-ot1-f68.google.com with SMTP id f17so10313407otq.4 for ; Fri, 16 Aug 2019 10:21:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zMvxega2p/6F2S/eoDzz+sN4i7bM8B+uz60Grtez1JE=; b=QCN9eZvxzAPGmUPLnJH/woDtKhvSbyWNPI2WVuuw78XLs8YTeApowbbTpG4QmVhRT8 KiEz3hmHc4YlVhpGKa4TQ2iVsusMkMmynlM+BCY4q+fdKS3rJPykSdyfO9A3QGOq+bCv Ep1qhKfWcW3SsmTBurcp0FktyN0IH0JZXWMk3EtkNfv4UCl45hWL/qKUAJyVWq8HCPc+ 04MySaN5P2L8D4z2nil2AJHtxzcCAXe9+Ae3Qzl3Th1EMpkCiYr6W6vATmErlpeFN+X6 UckZrP9+cKrZkBK1Mne3Ywq2nD/UZNxrcPAq4iFlzuaxVK76A2sJ0kE48E61MlCk6O69 /0RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zMvxega2p/6F2S/eoDzz+sN4i7bM8B+uz60Grtez1JE=; b=aU6lQApeZuGMeIHgQKuqY8L1wyAxW55QlT5Jsv9/tiyaj+p6UIRqtJO+k0xxGkzKZ/ 5H+V5fza6igmzOB4tyVmUFT83EKYMID+ZC/jp0pQiFvu66zEgbF94bHG5nl4KXsYa5w0 SwElBopV6ryu+5YU2tACxwXXsBLltLm63kY8fOVmx7Se/OZ9CcpD89l+t9YJ2T/pB5Fk o0ZWlX4Xn0N2R+KQUnQqUHHEkFXnZKjizBr1nZsXx+xrf8PCWQmV6UeQbkB/FLVIS/3o 1UxVXCehg/LVg+OUdBlCFHbJhvKCvxvxTfhBzezVekTv7x9i/8ci2XA0gB53mcrl8eP3 r6sA== X-Gm-Message-State: APjAAAXrcfGCXKYh6PG3T0fPJC4kOu84hORwEscWAqpdx1cMseU5WGiK 5sn/swo6T4xvWZcoV3jzw9vmAIL4b+TX8F4/XijFwg== X-Received: by 2002:a9d:6b96:: with SMTP id b22mr8643397otq.363.1565976113121; Fri, 16 Aug 2019 10:21:53 -0700 (PDT) MIME-Version: 1.0 References: <20190815180325.GA4920@redhat.com> <20190815194339.GC9253@redhat.com> <20190815203306.GB25517@redhat.com> <20190815204128.GI22970@mellanox.com> <20190816004053.GB9929@mellanox.com> <20190816122414.GC5412@mellanox.com> In-Reply-To: <20190816122414.GC5412@mellanox.com> From: Dan Williams Date: Fri, 16 Aug 2019 10:21:41 -0700 Message-ID: Subject: Re: [PATCH 04/15] mm: remove the pgmap field from struct hmm_vma_walk To: Jason Gunthorpe 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" Content-Type: text/plain; charset="UTF-8" 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 5:24 AM Jason Gunthorpe wrote: > > On Thu, Aug 15, 2019 at 08:54:46PM -0700, Dan Williams wrote: > > > > However, this means we cannot do any processing of ZONE_DEVICE pages > > > outside the driver lock, so eg, doing any DMA map that might rely on > > > MEMORY_DEVICE_PCI_P2PDMA has to be done in the driver lock, which is > > > a bit unfortunate. > > > > Wouldn't P2PDMA use page pins? Not needing to hold a lock over > > ZONE_DEVICE page operations was one of the motivations for plumbing > > get_dev_pagemap() with a percpu-ref. > > hmm_range_fault() doesn't use page pins at all, so if a ZONE_DEVICE > page comes out of it then it needs to use another locking pattern. > > If I follow it all right: > > 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.