From patchwork Thu Sep 13 02:22:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10598651 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 B6B0C15A7 for ; Thu, 13 Sep 2018 02:33:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A73942992E for ; Thu, 13 Sep 2018 02:33:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B5A629BB3; Thu, 13 Sep 2018 02:33:57 +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 3931D2992E for ; Thu, 13 Sep 2018 02:33:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 24CA18E0004; Wed, 12 Sep 2018 22:33:56 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1FDA38E0001; Wed, 12 Sep 2018 22:33:56 -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 115C28E0004; Wed, 12 Sep 2018 22:33:56 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by kanga.kvack.org (Postfix) with ESMTP id C50B18E0001 for ; Wed, 12 Sep 2018 22:33:55 -0400 (EDT) Received: by mail-pf1-f197.google.com with SMTP id x19-v6so2049478pfh.15 for ; Wed, 12 Sep 2018 19:33:55 -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=KOLPlgeGu5a++gbV/luqI4Dh4pWL/XbVTQA3AJakNjQ=; b=cXrFX+sS6eugrmZ50PNkKnbiDUUUTBe3V/yOd4O/oFHNJDE5Lj803nDr4mPa8OzUlF OV+kRKXBqjYPR0WuwdrjpYktzb0gNgvwn6HrI8QjyhvaDK9QPCAvVHDkTVnKL6MTfdAE z8J+V83axrE6ClNC91VKCGdGkUig/JgddeK/SpvDIwvMkWz9DVEtT34ZWCTHMO2V/0ca BVIzsVaKMfg3yfD3M1paDTe9n/zLllDvekSzd7vZDmb8spWcCpeNLBOmdIhqzE5wtsN8 jfMfObZVK3jZt4HxQKSQZGlhk0ozi3f4OvFF8tZ9sidHN9Z9USCHCQzrEzfvvdDGjVdi 6geg== 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: APzg51B5lCKTjMAUzaxT1b3fBDVg3CABDj6GPuGNA/3ZYaoLIabakBxk +/nBJYlPBYCxmwmPFscoN29PsKFrvWx8IwWSYbbiO6rl0GiHdRmktJoZHuWpXATWt0o083hN5Da E/GJeFcbaymcmBPhe4t1DU5cCOXk4nzrzjsHsvtJTxXSaOuUVGvRVsNDGAREbXvoJ4A== X-Received: by 2002:a17:902:7d83:: with SMTP id a3-v6mr5064816plm.0.1536806035502; Wed, 12 Sep 2018 19:33:55 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbSnRDQS4vJesQiEyYhpL0nGFp2xzdYS/BowQs1I9EY9zX6j1L6xKlwFQeyL1UyYROqRzMn X-Received: by 2002:a17:902:7d83:: with SMTP id a3-v6mr5064783plm.0.1536806034707; Wed, 12 Sep 2018 19:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536806034; cv=none; d=google.com; s=arc-20160816; b=IoBLtdcWORq7Flp/S0KeCa2oFA4CIaLmX/k9hQS/8oaDpX7byJNUZFNYzjHlSYx0xT TSJ7g0MHEJnwqlRzaQ/Oz/fkRGmDTCDBXcUe+ZY3JqGQftTFQzaoJaA3roo29n1oqwqq YqsTl9gGeGMkOJNBcROtCydwY388FpNwkUph3pQW51KLtjPOQZHHLtNNavpcRRLb4s04 PuSEMfMk6LYdwEJv4Y+gQ5R41rcN3LzvJMgQ4brIzQ5A+JJgTVUA+VGFCadQlehxOOo2 1GRNEpuboyx2dkfG7Pfb4WPlqy8meYdIBdIctHdwWLKLuPjOC+r5t/mLWldRqczD0PDG dLGg== 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=KOLPlgeGu5a++gbV/luqI4Dh4pWL/XbVTQA3AJakNjQ=; b=rJmurMmcKGcXkD2M48EPEccz+vEdGnyH1g+jTvCBMHm+OgpVRkdH7lV9VVoURt69V+ TTdtMnktjG8InwiJR5l1CmQVh94gHj3gx/dG/bzC8wkImw8uTt+fqQjdphlEDNzUnTe+ ZrTjKM2yWXBLSA9JRREPo47rRdjjeAGeeeV4QXOHtbv6+8tvonZ4fOkmiI++ijgWC9VY HTLpzIbrDhYQ4Ek9W3V60FAgQLLxciEK6Eru3SZFibaJYcyStq1LtdwlSJBbypVQe6oV 4+KqM7gn/oD4WZ9xCFxYPu1VtV65BulIQJtF2qo2zCkAUD8+f6fOmhMnAvjQbhCfZ9jW p0EQ== 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 p84-v6si2912481pfj.101.2018.09.12.19.33.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 19:33:54 -0700 (PDT) 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; 12 Sep 2018 19:33:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,367,1531810800"; d="scan'208";a="70448393" 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; 12 Sep 2018 19:33:53 -0700 Subject: [PATCH v5 2/7] mm, devm_memremap_pages: Kill mapping "System RAM" support From: Dan Williams To: akpm@linux-foundation.org Cc: Christoph Hellwig , =?utf-8?b?SsOpcsO0bWU=?= Glisse , Logan Gunthorpe , alexander.h.duyck@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Wed, 12 Sep 2018 19:22:11 -0700 Message-ID: <153680533172.453305.5701902165148172434.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 Given the fact that devm_memremap_pages() requires a percpu_ref that is torn down by devm_memremap_pages_release() the current support for mapping RAM is broken. Support for remapping "System RAM" has been broken since the beginning and there is no existing user of this this code path, so just kill the support and make it an explicit error. This cleanup also simplifies a follow-on patch to fix the error path when setting a devm release action for devm_memremap_pages_release() fails. Cc: Christoph Hellwig Cc: "Jérôme Glisse" Cc: Logan Gunthorpe Signed-off-by: Dan Williams Reviewed-by: Logan Gunthorpe Signed-off-by: Christoph Hellwig Reviewed-by: Jérôme Glisse --- kernel/memremap.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/kernel/memremap.c b/kernel/memremap.c index f95c7833db6d..92e838127767 100644 --- a/kernel/memremap.c +++ b/kernel/memremap.c @@ -202,15 +202,12 @@ void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap) is_ram = region_intersects(align_start, align_size, IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE); - if (is_ram == REGION_MIXED) { - WARN_ONCE(1, "%s attempted on mixed region %pr\n", - __func__, res); + if (is_ram != REGION_DISJOINT) { + WARN_ONCE(1, "%s attempted on %s region %pr\n", __func__, + is_ram == REGION_MIXED ? "mixed" : "ram", res); return ERR_PTR(-ENXIO); } - if (is_ram == REGION_INTERSECTS) - return __va(res->start); - if (!pgmap->ref) return ERR_PTR(-EINVAL);