From patchwork Thu Sep 13 02:22:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10598649 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 9B2F615E2 for ; Thu, 13 Sep 2018 02:33:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A3EC2992E for ; Thu, 13 Sep 2018 02:33:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E5A329BB3; Thu, 13 Sep 2018 02:33: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 10AF22992E for ; Thu, 13 Sep 2018 02:33:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E82238E0003; Wed, 12 Sep 2018 22:33:50 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E320B8E0001; Wed, 12 Sep 2018 22:33:50 -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 D48BF8E0003; Wed, 12 Sep 2018 22:33:50 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by kanga.kvack.org (Postfix) with ESMTP id 9534E8E0001 for ; Wed, 12 Sep 2018 22:33:50 -0400 (EDT) Received: by mail-pg1-f199.google.com with SMTP id r130-v6so1817582pgr.13 for ; Wed, 12 Sep 2018 19:33:50 -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=rIPE4RnuP/kYES3vOwi6r5TNvRJWZXK6aqhNeMFAG74=; b=VwPOBrrLk/uyPQ/OX01j76g8rzK8f7OnStdsQ3Yq+CaqBJ+L2JCEH4yJDYZcR5SeKd yWmjXvZmtgfISDM67toL68VhbKmqmmPDC+ZY5r3s5jxTquZqatOYeTmqW7KA2GGPifB3 cpejpdrQ6uHS7+I/tSmau+0P7lPL+y6umggiCVEwnJC4cTQ3ccFkn6zFp7mNEBbWyZtC d1K3OqgfTQX4nrxQEDtQIoSsr+hlAD/Mt15680+bBpBJl14el3lEphQDGo0v2ttI4dca gBSuZaFbAewVSHdMK/EKnpEG+oMZY0TbwWXCvnDZxKVRmM75kVSwdju+tOH8j8Z5h9a7 H25w== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.136 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: APzg51BKmM6gl/mQYl3dV2cVi7ZsEeGuXIPa7EdNM8PJyIGx8fBXqmel l5VQsOsTTlWIkI3XW7Wk7c2RtOkyBMh5OfczbTS9xgAbgZBMuQhGTVWceQ3ohZyvvhZGZDkATvJ OQ7KoS9QBUG1KdvxqL+iSTgJFOVy/j6otUuF75VRcRFSnJHROZHR7f1oxwJ9W5tgBhQ== X-Received: by 2002:a63:6485:: with SMTP id y127-v6mr4916759pgb.393.1536806030275; Wed, 12 Sep 2018 19:33:50 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYWDsXgasVvCY+Ot848boHTiTYHyr+i/YLzR/9UL5HPTGj9wm6JMvRNbqllm6oFn6x6CYyy X-Received: by 2002:a63:6485:: with SMTP id y127-v6mr4916728pgb.393.1536806029371; Wed, 12 Sep 2018 19:33:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536806029; cv=none; d=google.com; s=arc-20160816; b=wvoazsdCgcnzXMcgpgcak6gntje8ZZYSC99nYPUAFXqGWgcqEHeSR3yeck9B1PB/AG VAcloKV9MGODrJHWLHLR+9SzRbJIdTBfHX5EilLI9c4GLvF6rc47CLYuhbXhhrtnJOOK 1zUrusRyXTAzRZt7vU2ftr4+J8zk1g5aGqfiQ3IeMCP271fA8QYnSTpxu+YdXXGm7EqQ 0nQbhZEd8114kqaWAxvPekpivitJvm0SWEVbev8UCf3grgZSiJb/NJQKxm115XoqJoMH 4rynQ9vH/VEk3UjWk4/TSZUb5TR3wo6k1tGOez3Kgqn7cQF0n2RVQMVL9VXp9eLEfRRA JHmQ== 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=rIPE4RnuP/kYES3vOwi6r5TNvRJWZXK6aqhNeMFAG74=; b=z/JRe4T8WR6yx5EE0hoW9kSOPzVnEtTLKwrX4xLzTaBENHGaGPFJYgZJ6JviWclOdz QaevOAvFSr2bYFgAcZlX1XL0ZVX45Uq5b5ncido1EyU1adoQ1+XWiZrStgJ3px/bhHQb 0Q4o9eFvHSD1/TLbbhpBgweNYjLGzTrLKHT8tQy2btcZUkSVAW8xrpvhEiERakm8gJZ1 KXYOuUfurRjdaX9PcyvQy4vIWplfbuwnx4uuuj+8sAydZmzzXEKGpxrLwchfsKw3awuE FRgY2lISlwemmvm1uKc9hchCEJ2OpFeaAiDbQHTrShXoID2+Gri7Wex09zPvOIohUBTt mQAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.136 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga12.intel.com (mga12.intel.com. [192.55.52.136]) by mx.google.com with ESMTPS id i5-v6si2696010pgk.200.2018.09.12.19.33.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 19:33:49 -0700 (PDT) Received-SPF: pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.136 as permitted sender) client-ip=192.55.52.136; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.136 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 fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Sep 2018 19:33:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,367,1531810800"; d="scan'208";a="69588622" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by fmsmga007.fm.intel.com with ESMTP; 12 Sep 2018 19:33:47 -0700 Subject: [PATCH v5 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: Wed, 12 Sep 2018 19:22:06 -0700 Message-ID: <153680532635.453305.11297363695024516117.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <153680531988.453305.8080706591516037706.stgit@dwillia2-desk3.amr.corp.intel.com> References: <153680531988.453305.8080706591516037706.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 Reviewed-by: Logan Gunthorpe --- kernel/memremap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) {