From patchwork Tue Sep 25 06:15:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10613421 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 0746916B1 for ; Tue, 25 Sep 2018 06:26:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE8402985A for ; Tue, 25 Sep 2018 06:26:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E05B329868; Tue, 25 Sep 2018 06:26:52 +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 C45D82985A for ; Tue, 25 Sep 2018 06:26:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A858A8E0060; Tue, 25 Sep 2018 02:26:49 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A34DE8E0041; Tue, 25 Sep 2018 02:26:49 -0400 (EDT) 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 923C98E0060; Tue, 25 Sep 2018 02:26:49 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id 531EC8E0041 for ; Tue, 25 Sep 2018 02:26:49 -0400 (EDT) Received: by mail-pf1-f199.google.com with SMTP id p8-v6so2974380pfn.23 for ; Mon, 24 Sep 2018 23:26:49 -0700 (PDT) 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:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=hzEkEsZf6Xlz0+pmaecWLIXAqfAQ3kSgkq1h7aEiPog=; b=RJj9hNjQBWfTLOetYBiUo/rFAKvVQ7sTIYQUPiHLpnG1GBTXZan4I4IZuVXVpYASsa +pHF1s20KEHrtpUqqyChyN6t1E639hrlV+xrMBmkc8MwmV0/JOHWefiM63nJ2klZyup/ HnVUSiI1NLXvAwdfpNO9532c4LtnLkgsh+eCWNM8BgjBFayjS/W1jPbVNL6ZieSQ+Qc9 3kF/yahHc10VJXkINuzFs8i7+ktgm2Qixz5TZAE6rtQe7wWQDXVSh3QjvIa9JxQgmBnr pSO/5w3zZiTRj9cdEv1OybXdStz/Pt6L0cS1LiHjgI8LsKO4/hT0aP+4DUFRWz+vsqDL tFag== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.31 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: ABuFfojsAR1h3kDbY07euSEi8Y+49f0RoW2+PsJliTNQCiKxD7iJ6Fck LhsHKS1RW3uFE7djNLCoiW2JiTeWHtTrtT9leDAGXhzq0BkK+bTsPoEnnBNT/CakF737ypcpJo3 Y29RvRRLembWLaWHUl8VQY8CJXmpw7GpFLjer+2Eluq09TVjWQ5DXQuLenx1tKDEXcQ== X-Received: by 2002:a17:902:47c2:: with SMTP id d2-v6mr2004347plh.317.1537856808999; Mon, 24 Sep 2018 23:26:48 -0700 (PDT) X-Google-Smtp-Source: ACcGV62E72G3V25/S1Zr40XqDyn5rXrjIWGqiDp+zHAU2tlq5k5A0B0K9tcC/LltJlWa9T38Npgk X-Received: by 2002:a17:902:47c2:: with SMTP id d2-v6mr2004291plh.317.1537856808046; Mon, 24 Sep 2018 23:26:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537856808; cv=none; d=google.com; s=arc-20160816; b=W8I6Xm3WpslEfiIEsCqMYVyAyMbNK48LqVhmGnmeAUk+mnDNHoEwbvwSmpm4L68KVu 0vZHQv4Yt8NOrLK2mUrUSsDukyfLTju2LTW9hUH118yFiNpqX9UMy3A51hmvpg1QBzM4 uIubb2LawJxSbf3KDJcNUkaDQrd1RNjS2vwHJtxMN9BVf7TqDTecV/Xd07BAc+YoNndc JfHFGhh34MG80j0kSBOD4reiOhtu620SfbYE+0mNnZTPT2048VMGDgtmhxiikc9aLqHD VA6eQ1so2q/14YCfCJrcs5BXBS8fXAZ3l6jdzgP6WSVmcAhRiZXWCdh1x2gxuRqSY9dQ c62g== 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:references :in-reply-to:message-id:date:cc:to:from:subject; bh=hzEkEsZf6Xlz0+pmaecWLIXAqfAQ3kSgkq1h7aEiPog=; b=rj0Qm3K9e16ZuE4am74SA9VfXpYCI9qLHqzY/4zPVZx4S0IkslSzV4i4SPcLuQMnZ5 TjyXkyCzhNMzfj7xG7qxgJynBQEIFU1IXLdnh09h/qwpLcKzp87uWXUKm+zFXqxPevvP 55k1bRolZTiIg+pm6KDlw63NlU074iPcaBK/76lGV0wYLTcUHELCoDkavN8mOqkstmrI Pqex/6XjqYspCkTvW0UnJYUPFF79BBoqQVWf4LTcwLKAm/4MUutZ8aL1qyZ52h/zgbIz Jv6VJiE5Ijk+sUvsKkrRJdjfkqwBaKTcXrVXbbx4oLIiRN02DRCHfWluEn7I2W3DzuBW /PWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.31 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga06.intel.com (mga06.intel.com. [134.134.136.31]) by mx.google.com with ESMTPS id k24-v6si1567936pgj.28.2018.09.24.23.26.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Sep 2018 23:26:48 -0700 (PDT) Received-SPF: pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.31 as permitted sender) client-ip=134.134.136.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.31 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 orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Sep 2018 23:26:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,301,1534834800"; d="scan'208";a="75685191" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga007.jf.intel.com with ESMTP; 24 Sep 2018 23:26:47 -0700 Subject: [PATCH v6 1/7] mm, devm_memremap_pages: Mark devm_memremap_pages() EXPORT_SYMBOL_GPL From: Dan Williams To: akpm@linux-foundation.org Cc: Michal Hocko , =?utf-8?b?SsOpcsO0bWU=?= Glisse , Christoph Hellwig , alexander.h.duyck@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Mon, 24 Sep 2018 23:15:00 -0700 Message-ID: <153785610001.283091.17732419819752424489.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <153785609460.283091.17422092801700439095.stgit@dwillia2-desk3.amr.corp.intel.com> References: <153785609460.283091.17422092801700439095.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 devm_memremap_pages() is a facility that can create struct page entries for any arbitrary range and give drivers the ability to subvert core aspects of page management. Specifically the facility is tightly integrated with the kernel's memory hotplug functionality. It injects an altmap argument deep into the architecture specific vmemmap implementation to allow allocating from specific reserved pages, and it has Linux specific assumptions about page structure reference counting relative to get_user_pages() and get_user_pages_fast(). It was an oversight and a mistake that this was not marked EXPORT_SYMBOL_GPL from the outset. Again, devm_memremap_pagex() exposes and relies upon core kernel internal assumptions and will continue to evolve along with 'struct page', memory hotplug, and support for new memory types / topologies. Only an in-kernel GPL-only driver is expected to keep up with this ongoing evolution. This interface, and functionality derived from this interface, is not suitable for kernel-external drivers. Cc: Michal Hocko Cc: "Jérôme Glisse" Reviewed-by: Christoph Hellwig Signed-off-by: Dan Williams --- kernel/memremap.c | 2 +- tools/testing/nvdimm/test/iomap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/memremap.c b/kernel/memremap.c index 5b8600d39931..f95c7833db6d 100644 --- a/kernel/memremap.c +++ b/kernel/memremap.c @@ -283,7 +283,7 @@ void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap) pgmap_radix_release(res, pgoff); return ERR_PTR(error); } -EXPORT_SYMBOL(devm_memremap_pages); +EXPORT_SYMBOL_GPL(devm_memremap_pages); unsigned long vmem_altmap_offset(struct vmem_altmap *altmap) { diff --git a/tools/testing/nvdimm/test/iomap.c b/tools/testing/nvdimm/test/iomap.c index ff9d3a5825e1..ed18a0cbc0c8 100644 --- a/tools/testing/nvdimm/test/iomap.c +++ b/tools/testing/nvdimm/test/iomap.c @@ -113,7 +113,7 @@ void *__wrap_devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap) return nfit_res->buf + offset - nfit_res->res.start; return devm_memremap_pages(dev, pgmap); } -EXPORT_SYMBOL(__wrap_devm_memremap_pages); +EXPORT_SYMBOL_GPL(__wrap_devm_memremap_pages); pfn_t __wrap_phys_to_pfn_t(phys_addr_t addr, unsigned long flags) {