From patchwork Wed Jul 11 05:14:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10518765 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 B0ECB6032C for ; Wed, 11 Jul 2018 05:24:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1C4128DAA for ; Wed, 11 Jul 2018 05:24:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9668828DC9; Wed, 11 Jul 2018 05:24:49 +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 792E628DAA for ; Wed, 11 Jul 2018 05:24:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 711A06B0007; Wed, 11 Jul 2018 01:24:47 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6C0B46B0008; Wed, 11 Jul 2018 01:24:47 -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 5D8DF6B000A; Wed, 11 Jul 2018 01:24:47 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f72.google.com (mail-pl0-f72.google.com [209.85.160.72]) by kanga.kvack.org (Postfix) with ESMTP id 1C5B36B0007 for ; Wed, 11 Jul 2018 01:24:47 -0400 (EDT) Received: by mail-pl0-f72.google.com with SMTP id cf17-v6so6609238plb.2 for ; Tue, 10 Jul 2018 22:24:47 -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=g5p8y4yzMP8MCq/eqH5mJYX2zDDK1Tva2PPuPxAxl3Y=; b=ahOA9VhLTn87EijDKlXBmBxWRjBJMgoQ4C1Iwd0a6IbPujdDJrj9TKJQ51AzLxtPZx 5KnDiK1KG7PCrpRvlbU2iPdL4xfeN9waGlh2omHuqCaKD1kNNLndzwKoQPnDVSFZscdW cf4WowvTC/WFmSwZP7d2RcE8CHn59fcfACF8K8QYcZFnvAXB2aQ0jZSxyda1WcZOS79Y ptezV1KcS5+87rKQxri1eoJQtOl7XR+muw6oXKFWvEtsTPr8zdnNMb4CDkzt/IqmB7MY PCRGY6b+94lryr+XrcXGoavt0+LkVtRkQ/k4cIU23bz+rbnw4ro/kZnrZ14+o3ESlzx/ ZNgg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.24 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: APt69E0Py9pZ8MqkRxhpZYK+UAPls/WK00K+PMa43cul1fF9+oj0R4p+ liB2iKBIZMd+m+bvDXqHI2ZZX/kOb7eU+ASIeCvoEZ7Q8SrW4t068Fxs3PdHx/gAyrY0vlCRzpa QcwwHxfkMFRUnbM/gVvCzBs6xyk0oguYwMpuJGt9R9zMWj48ETA/saAHUZWWypxzsuw== X-Received: by 2002:a62:c0c4:: with SMTP id g65-v6mr28345143pfk.72.1531286686818; Tue, 10 Jul 2018 22:24:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfjzssRddye1ODuBm6S+nAX/+MaMSqkR1IxKyDo7uC1ntoLLBrZuk0R8i4ODwdVaTvD3SG2 X-Received: by 2002:a62:c0c4:: with SMTP id g65-v6mr28345110pfk.72.1531286686008; Tue, 10 Jul 2018 22:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531286685; cv=none; d=google.com; s=arc-20160816; b=gO+48BfIO25LeujbxWeTRfziUHvY7hwdqaz4HiM5dMzVkJ3jUaHdLsXUzmBx4I+ufo nNUsR2KoerNretUN7ZK7CUawiVsS9kK9/HROw81+8ZODFXDIDbRTXufEpSrN4VVXhAKG jgvfEVZrGdeFJY/TYiHWdMa1h4RqkiEC2NgkfL87wmT3dLt+fYZOduxFfXFU872tCAK1 YN8fKEFWH7uFkNEGI4Jh1a21rgI0XMux+ujJd5YxINnmOsrPhPBGwmgmhX9zevc6L4wB 1jeAe+n8bKLMIgT1mjH5aRefddgdgLkbv8jql3Qv0vZA5hJ8vlGwO6/tNAb0MPu8XaT8 pLHA== 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=g5p8y4yzMP8MCq/eqH5mJYX2zDDK1Tva2PPuPxAxl3Y=; b=JzQMdLm8kTMiu8V1e+Guf6CHcsA1C1EpCFbxFml5xDJyRQugy10/91TWGvaBnOa8QH xEVCh/iPd7uB7hBHa5Cpaluc162sNIy3CtERDjrSxJhDQ+/uvx8emc17BCYR/qIK/b1K J7osc/g2l7DaUgx2ES/ycteU6OKG80i8CQEEcS/qPCFbT8JxFXrorNu1FUfttYAmfRE0 AEzgKcIAALCZ9rZiM4V/v74ydNHctxAB0wJZy9wGd77LceuRHo0OVe0kUvv8s9AcWHro gpS5pL2XZOhhehyCBwxzalJidS1x/kcXfZuKFQfNxPs8c2G1uN5O1Ubvp+S85cQHgz9S CCZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.24 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga09.intel.com (mga09.intel.com. [134.134.136.24]) by mx.google.com with ESMTPS id k14-v6si19678868pfd.23.2018.07.10.22.24.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Jul 2018 22:24:45 -0700 (PDT) Received-SPF: pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.24 as permitted sender) client-ip=134.134.136.24; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.24 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 orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jul 2018 22:24:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,337,1526367600"; d="scan'208";a="239420344" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga005.jf.intel.com with ESMTP; 10 Jul 2018 22:24:45 -0700 Subject: [PATCH v4 2/8] 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, 10 Jul 2018 22:14:48 -0700 Message-ID: <153128608797.2928.10387598365462349830.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <153128607743.2928.4465435789810433432.stgit@dwillia2-desk3.amr.corp.intel.com> References: <153128607743.2928.4465435789810433432.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 --- kernel/memremap.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/kernel/memremap.c b/kernel/memremap.c index 4478e4688bb7..2d2c901cbe23 100644 --- a/kernel/memremap.c +++ b/kernel/memremap.c @@ -183,15 +183,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);