From patchwork Tue Nov 20 23:12:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10691415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC62D13AD for ; Tue, 20 Nov 2018 23:25:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D62742AC4E for ; Tue, 20 Nov 2018 23:25:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA3252AC59; Tue, 20 Nov 2018 23:25:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D0792AC4E for ; Tue, 20 Nov 2018 23:25:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2E9316B2287; Tue, 20 Nov 2018 18:25:19 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 297FA6B2288; Tue, 20 Nov 2018 18:25:19 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 163D76B2289; Tue, 20 Nov 2018 18:25:19 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by kanga.kvack.org (Postfix) with ESMTP id BB94C6B2287 for ; Tue, 20 Nov 2018 18:25:18 -0500 (EST) Received: by mail-pl1-f199.google.com with SMTP id x7so4144607pll.23 for ; Tue, 20 Nov 2018 15:25:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:from :to:cc:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=gnKYmwNm2XUzRN8qcIcQDC4WfcA9BI5n4qyATCfWOBw=; b=l7og+73MtkcxgyZH/7RI86FYvF+I1wbiIJA5tmfxp5hCw3kBQJl5yMgCDpULjKgWqH Gc5LiQOTK0xnOhqynb8lkh0puASNsvaWIp9jVbqrOjtAcIdws0BOmp0cV96U8okecSGK +oZkF81ZrTVRFETY2f+k3cSLCdtvLEYxkpZ1CIuUkiKXAq4gwQKjc6LR/KxipLIvEqu3 j0vVG2SveeAk7dDpL6eEAthbmeMO6moP+DPYfdt1q3iSoZhhS/FYY0GBzXsKc9zgdVjI RD3X/DDH/1+JmcwAypF9fiQo5q5V58aRgplkhC0nB6LFTofUhPMs21PIvalzcdz/jgAz Ynmg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: AA+aEWYDOjDJWO56RY1vadLYWoLjpi7CaubtPjDhgNm3p0xUhnX8oCKo wjJ4Q9PEklfJ8zLBvpumzSNQoohANMaGd0Vc2Ig4D6ShCYqvhZJpw8EDmWjPB2AUxKMOev7jfkT Sa2eNByItsHa83JzZQU0LPfyUGwxrlcT+4lojytlkxGPYzVizqNv00ga8UlqvS1B5EA== X-Received: by 2002:a63:9b11:: with SMTP id r17mr3786883pgd.416.1542756318398; Tue, 20 Nov 2018 15:25:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/VC8TqfgnNzx37jWi+xLIQLua7jFTOAalY88bZaxpRrOwm9bfTcIAyTZANdOkRwxW/7Ohj0 X-Received: by 2002:a63:9b11:: with SMTP id r17mr3786825pgd.416.1542756317359; Tue, 20 Nov 2018 15:25:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542756317; cv=none; d=google.com; s=arc-20160816; b=n0SfN8ONhuKN6XTgsUCnFsowttquB1c0+Ug1ib2nbUYP6Q8rhEsR+hvXDvH0ydbH3P DlHLwwGmOFysBfU12HieqTlDFu9HArLyPM/uwSxPyoGLE18IbIDE3lXBx6rPFlPmObfb T8TxzK5pP2L6zAMZiQ/qeFtePBX9xzMh7j/3jXMpAfqelVVvEruaNp0VAjh7uuxq3biE QIjPJIYKW/qaQmiuHZUmM76I3cPNF7UJrg8enDJeBZ0Ez3jkt7Dd2yD1xHCUQP1cIeTV 9/cGTttGNoob1G2GLKX8q4eUgKTunouraOQezhjfXzmI8x7Jjj7PT++w2TMcs90fjHnU aeMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:message-id:date :cc:to:from:subject; bh=gnKYmwNm2XUzRN8qcIcQDC4WfcA9BI5n4qyATCfWOBw=; b=CqEzrfEHW90+kUKD8oRqbcHHwONpXZ0bBXi3L9/tbO7TO0ZefI43B83aoIsbcwnxGl Epn8cHinoENrgvC/t1pNQxajMIJsGEutDyjnt3UsGBcN2hl9TAyr/wvftSZqRveXdJvF c1sYztZU/c00G6Vtjj/xLIk5XBcBJ/G5YFB9JN+xJKP3G7M1xIxL2pvWNBkydm56N63y sxcrwHPC/5Ij0YZoiVEdSd7n0NUb+NlypaHePERWvgi+xrjZDTJJ0FI/Hrw7RoE0F9/0 RMJWSW4G0Qs5Q3e165pubfcSo0Djxy9TGzDl3DrvOM7mJ5O0Clgsvq8G53BwozB0dhsy ytlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga14.intel.com (mga14.intel.com. [192.55.52.115]) by mx.google.com with ESMTPS id bi6si28276432plb.279.2018.11.20.15.25.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Nov 2018 15:25:17 -0800 (PST) Received-SPF: pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.115 as permitted sender) client-ip=192.55.52.115; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Nov 2018 15:25:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,258,1539673200"; d="scan'208";a="87991552" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by fmsmga008.fm.intel.com with ESMTP; 20 Nov 2018 15:25:16 -0800 Subject: [PATCH v8 0/7] mm: Merge hmm into devm_memremap_pages, mark GPL-only From: Dan Williams To: akpm@linux-foundation.org Cc: stable@vger.kernel.org, Balbir Singh , Logan Gunthorpe , Christoph Hellwig , =?utf-8?b?SsOpcsO0bWU=?= Glisse , Michal Hocko , =?utf-8?b?SsOpcsO0bWU=?= Glisse , torvalds@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Date: Tue, 20 Nov 2018 15:12:49 -0800 Message-ID: <154275556908.76910.8966087090637564219.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-2-gc94f MIME-Version: 1.0 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: X-Virus-Scanned: ClamAV using ClamSMTP Changes since v7 [1]: * Rebase on next-20181119 [1]: https://lkml.org/lkml/2018/10/12/878 --- At Maintainer Summit, Greg brought up a topic I proposed around EXPORT_SYMBOL_GPL usage. The motivation was considerations for when EXPORT_SYMBOL_GPL is warranted and the criteria for taking the exceptional step of reclassifying an existing export. Specifically, I wanted to make the case that although the line is fuzzy and hard to specify in abstract terms, it is nonetheless clear that devm_memremap_pages() and HMM (Heterogeneous Memory Management) have crossed it. The devm_memremap_pages() facility should have been EXPORT_SYMBOL_GPL from the beginning, and HMM as a derivative of that functionality should have naturally picked up that designation as well. Contrary to typical rules, the HMM infrastructure was merged upstream with zero in-tree consumers. There was a promise at the time that those users would be merged "soon", but it has been over a year with no drivers arriving. While the Nouveau driver is about to belatedly make good on that promise it is clear that HMM was targeted first and foremost at an out-of-tree consumer. HMM is derived from devm_memremap_pages(), a facility Christoph and I spearheaded to support persistent memory. It combines a device lifetime model with a dynamically created 'struct page' / memmap array for any physical address range. It enables coordination and control of the many code paths in the kernel built to interact with memory via 'struct page' objects. With HMM the integration goes even deeper by allowing device drivers to hook and manipulate page fault and page free events. One interpretation of when EXPORT_SYMBOL is suitable is when it is exporting stable and generic leaf functionality. The devm_memremap_pages() facility continues to see expanding use cases, peer-to-peer DMA being the most recent, with no clear end date when it will stop attracting reworks and semantic changes. It is not suitable to export devm_memremap_pages() as a stable 3rd party driver API due to the fact that it is still changing and manipulates core behavior. Moreover, it is not in the best interest of the long term development of the core memory management subsystem to permit any external driver to effectively define its own system-wide memory management policies with no encouragement to engage with upstream. I am also concerned that HMM was designed in a way to minimize further engagement with the core-MM. That, with these hooks in place, device-drivers are free to implement their own policies without much consideration for whether and how the core-MM could grow to meet that need. Going forward not only should HMM be EXPORT_SYMBOL_GPL, but the core-MM should be allowed the opportunity and stimulus to change and address these new use cases as first class functionality. There is some more detailed justification in the individual changelogs. The 0day infrastructure has reported build success on 102 configs and this survives the libnvdimm unit test suite. Setting aside the controversial aspect, the diffstat is compelling at: 7 files changed, 126 insertions(+), 323 deletions(-) --- Dan Williams (7): mm, devm_memremap_pages: Mark devm_memremap_pages() EXPORT_SYMBOL_GPL mm, devm_memremap_pages: Kill mapping "System RAM" support mm, devm_memremap_pages: Fix shutdown handling mm, devm_memremap_pages: Add MEMORY_DEVICE_PRIVATE support mm, hmm: Use devm semantics for hmm_devmem_{add,remove} mm, hmm: Replace hmm_devmem_pages_create() with devm_memremap_pages() mm, hmm: Mark hmm_devmem_{add,add_resource} EXPORT_SYMBOL_GPL drivers/dax/pmem.c | 14 -- drivers/nvdimm/pmem.c | 13 +- include/linux/hmm.h | 4 include/linux/memremap.h | 2 kernel/memremap.c | 94 +++++++---- mm/hmm.c | 305 +++++-------------------------------- tools/testing/nvdimm/test/iomap.c | 17 ++ 7 files changed, 126 insertions(+), 323 deletions(-)