From patchwork Wed May 23 05:10:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10420157 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2E8E360545 for ; Wed, 23 May 2018 05:20:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E57E28E95 for ; Wed, 23 May 2018 05:20:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12D8C2909F; Wed, 23 May 2018 05:20:29 +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 4B81C2909E for ; Wed, 23 May 2018 05:20:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4259E6B0006; Wed, 23 May 2018 01:20:27 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3D4E56B0007; Wed, 23 May 2018 01:20:27 -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 2ECC36B0008; Wed, 23 May 2018 01:20:27 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f200.google.com (mail-pf0-f200.google.com [209.85.192.200]) by kanga.kvack.org (Postfix) with ESMTP id E1A006B0006 for ; Wed, 23 May 2018 01:20:26 -0400 (EDT) Received: by mail-pf0-f200.google.com with SMTP id j14-v6so12423535pfn.11 for ; Tue, 22 May 2018 22:20:26 -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=2lAhZhicvHl794titopfuecnNg0g6ht+WiaIorPoyNc=; b=VwR8JEzdqo/tazaz0klI9580zPSBq5WbtGEx4M6uLEvZGM1Qe4wZnFhY3r8cfCqR0I aW8Y6rCIkBu/92QWnMXa34uNcZ6Sr2lQjfgHMYg2IAbUgahCV6jQLFSUxlrra7NDlzpo cublQ/QWmxrWb6LAka4Slga+lYJYBNQdlXfgvX81XtMqqLw3w1x62c5mvmgD6KC5i5sK 0TmEZVK016ah8v/uAY4mJ4uDkEIm6IPApaIN/FogfpG+DbMO2RV78FTVNNaNLuSGJOXg 7co7OIiCeI+Ob8K9/np/EjbtDjyDiW/rbPrWl7nVhgTkjVa5qkasDps9Om+Vx8jk3ZRX knRQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.88 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: ALKqPwcECdpVu4K4Kb7elJvpWhJfV/DSHLJ2rrKZvZutj3Na/GmYiCsD Cw2oKXqwsYkr+rdCHEhQfP/pw+umSZ7vQ0WxNtfqtLhM0jmghyPX+Q1IXBRcT6aZRhJ3wx8d3Vd of/4MCujmyr/WCuEPtsZbXQHz5tLuAPkvybA6WUK/4EUrgBEjzL1tsh/ZBsWeA2vIVQ== X-Received: by 2002:a17:902:a410:: with SMTP id p16-v6mr1436372plq.228.1527052826635; Tue, 22 May 2018 22:20:26 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqz9NwwL8vVQ2w6ZXxOapt/2WroMgVW5n3W2+9dYg+CUsxaojdiI26NJuHHASS9zw8Ov4xI X-Received: by 2002:a17:902:a410:: with SMTP id p16-v6mr1436339plq.228.1527052826023; Tue, 22 May 2018 22:20:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527052826; cv=none; d=google.com; s=arc-20160816; b=VEC1B6xUPBhQ3DcMR+r6qF5VR3arOUf1bIdaceY4tVfvF9qyzmiYZavSzrZWoP3y+8 zGTF6o0g4dAp4VAueQZjU0WlvHhRelodP6FTbRdDmSnVDl6eFEFGrcj5t2CAzhQqnvOA ut37htBkr/y4ECmimFso4aYhamKTd5LJLgAiRMf0rZ7sdduNNLIUioA17er8gnx1gvKs l54MqcmcRv+I3c2jC23p7/EcNCRyd40NRW3N81RI1RetFfuMVi8ImAOSnM6bcTxmgq55 9g5kRNCaFfNTm1kS08kYEKXG/QL5a8nexW3Q6tlVnfx3g6mE7nGJeXGxFII2MMa+1H/I Z53g== 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 :arc-authentication-results; bh=2lAhZhicvHl794titopfuecnNg0g6ht+WiaIorPoyNc=; b=x2bjzJWQMONgMjDNqwm4MVcmHcIcVfyKD/Zk0pT/Ox12fCJyOJuDONPXulFVobVYvH aA1gTbETaa+VuLxnyfXFID/E1uP4FjaHsjEFJKl4h0ubhZ4E0DwszuVZTGf6pM0jWuEH oEkA8cTp0f4CAyqLnJiNpgXX1Jdk0cQBmolPC5MYCUmDqG5CxrrqJp+IclftNnCfcAZa pLXsTf49hDwK15vxK5mLziqqk4AK8hZnjxUciLv7OAajUcF9ydjaqOBJsw8FVPvJ8Alm Xq5/VXSRm2Z6dJaMsSAIVyB5Kq6KD3ethFKWfMMvXwEKUXTFdNP1lVHcDBaGQjy3w3fK x36w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga01.intel.com (mga01.intel.com. [192.55.52.88]) by mx.google.com with ESMTPS id j10-v6si17917471plg.396.2018.05.22.22.20.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 22:20:25 -0700 (PDT) Received-SPF: pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.88 as permitted sender) client-ip=192.55.52.88; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.88 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 fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 May 2018 22:20:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,431,1520924400"; d="scan'208";a="230872848" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by fmsmga005.fm.intel.com with ESMTP; 22 May 2018 22:20:25 -0700 Subject: [PATCH v2 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 , linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Tue, 22 May 2018 22:10:28 -0700 Message-ID: <152705222840.21414.15768182848742318988.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <152705221686.21414.771870778478134768.stgit@dwillia2-desk3.amr.corp.intel.com> References: <152705221686.21414.771870778478134768.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. This has been broken since forever and there is no use case to map RAM in this way, so just kill the support and make it an explicit error. Cc: Christoph Hellwig Cc: "Jérôme Glisse" Cc: Logan Gunthorpe Signed-off-by: Dan Williams --- kernel/memremap.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/kernel/memremap.c b/kernel/memremap.c index c614645227a7..dd11607671eb 100644 --- a/kernel/memremap.c +++ b/kernel/memremap.c @@ -355,15 +355,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);