Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1127567ybb; Sat, 28 Mar 2020 19:30:16 -0700 (PDT) X-Google-Smtp-Source: ADFU+vspTMFFCAnUwYve/tZwhsC5SP/6zOaAB0QiK/9Quzz7d1+LspxV22MjR1UqtY3HE+/PEOMo X-Received: by 2002:a05:6830:104c:: with SMTP id b12mr4144225otp.121.1585449016230; Sat, 28 Mar 2020 19:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585449016; cv=none; d=google.com; s=arc-20160816; b=dOlF/dTS4IQftrBGnmSL4s+zcXP/oM/bwjDFk8mrzsrDB+MKnRCEnqHXth6QAHt03O c6/IrcKeMDhMMsKX02ShjfyagRcdS7jO9c1mV4ojTrzlJKCbD0yW3FkMjDzt1iekIilt Y6kxmYvA1YUBrgqwyWzhiB3S8y+0ybGbZ2pdgapZQuj1GVwtvGaW4ja0Jjs7DfK2QnXy Rf3KYO+X+EczkmMEdtgOG4xzUKC8DmWz39zWoP93Tdep2YymoORN80lvXyktUC6nYep3 eITrWEu0t5qCsTH+8K0ih35EkiD0xuwFpc1LiZ+ri7G1OKcQ28JBJPRO/F1pzGrOr5JN PHWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=r1ETK3fIkrhaAIbZSkvVHt9qme5eegETmZuHABrJros=; b=AhnBkQiL/ikvD4kmTSWtXRC5qm1+7JAe25JXIvMpnNUHzHYRXPDJSSPjgPEyLIEcqr ycY7QZpYZ9jzP0I5djxqH5HjQ2I5eQsKbygHtcooxu24kQbPvyOJyRY+cbDqvNRzSqqr FoeURodn02Gmyaq8o3+1Lom7lP+Mc1bk7qt48KUbLbNbVz895NRvGDlRaS/I/hxTzxNc ypzE4AT4sIedM64Bc12DaXXxVnCGiwaTcrIB7FuA9Ur6VZEnStreXShvk6pfNV+SWTqV M4WqzkS3ARdU2S9fE3MgNP7ZJqUDzthvS+P3cxQ8ONzaLiWnXVHI0rF1TVfWiIIy8ZDb xFxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@d-silva.org header.s=201810a header.b=ZprMO5g5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w9si4974787oti.216.2020.03.28.19.30.04; Sat, 28 Mar 2020 19:30:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@d-silva.org header.s=201810a header.b=ZprMO5g5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727307AbgC2C2B (ORCPT + 99 others); Sat, 28 Mar 2020 22:28:01 -0400 Received: from ushosting.nmnhosting.com ([66.55.73.32]:35428 "EHLO ushosting.nmnhosting.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727191AbgC2C2A (ORCPT ); Sat, 28 Mar 2020 22:28:00 -0400 Received: from mail2.nmnhosting.com (unknown [202.169.106.97]) by ushosting.nmnhosting.com (Postfix) with ESMTPS id 9F2462DC6831; Fri, 27 Mar 2020 18:12:21 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=d-silva.org; s=201810a; t=1585293142; bh=HPdDJ0enxYWuoioAjwzepK5FMG95uTKM1kU7cOk1haY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZprMO5g5LCg0oRdH2K3uXz8l4c6L9W1d9Mxd3y9LbAARGZu9kt6uIz9A3MEUOedWV g7DqMLDrr2m/TH6d6yrJtFgEOg9BlrSv1R2NLozkVnU6OkgsrVmJx9BBn8aI/Sn62O w/5CiI+YX0ODTMBr8YVhJA07fuOcUVGHda3b5a9mGukeXcANsMAjZc4Gg4MUBM/PoJ Jnr9+eXE1sX7vtXdpSE1woIPFaLHakSy5NHhRbC+k3KhNv5RH6TZ6A/u+iDAiiRCE5 N06lRZtlEVFMlb5wR4Jid5B9ENUsU6ZZPEVYF/txRgiW4MKAS+CcjtkONcUOSmYaD9 ppYmaM2ef6S8tshDUjxJypHcy1+sz3bZZrRF+2nIuWjpwN2hZGDxRVKHsZfKZhVqQF sblZp70rrN6e/kpXRz/acmkv2yO8Fa77dlC3P84DeB/nV2oDsJDuyI07z13vZ/Bmuj o26AIi8KDpxo1HfGM10O/KoPFg3TtC7iqbL2WVTgVmat/MkiiY9qOLW8neZfNnPbUY Yfawn1JU84te5v7VgBv+fKxvfyGbsXV1RLhC09q4r5qhGolccVrWWCbRAXVplfwLiE ko6h2lMIzDuDXQc0NNcn6PH9aJ9muG0dIOvlWkH8pN4W1vzD3LNkEswpP0E7Hqf3M9 jksprRXa8oR2y8sUhkAlZwgY= Received: from localhost.lan ([10.0.1.179]) by mail2.nmnhosting.com (8.15.2/8.15.2) with ESMTP id 02R7C4Ab045934; Fri, 27 Mar 2020 18:12:14 +1100 (AEDT) (envelope-from alastair@d-silva.org) From: "Alastair D'Silva" To: alastair@d-silva.org Cc: "Aneesh Kumar K . V" , "Oliver O'Halloran" , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Frederic Barrat , Andrew Donnellan , Arnd Bergmann , Greg Kroah-Hartman , Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , Andrew Morton , Mauro Carvalho Chehab , "David S. Miller" , Rob Herring , Anton Blanchard , Krzysztof Kozlowski , Mahesh Salgaonkar , Madhavan Srinivasan , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Anju T Sudhakar , Hari Bathini , Thomas Gleixner , Greg Kurz , Nicholas Piggin , Masahiro Yamada , Alexey Kardashevskiy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-nvdimm@lists.01.org, linux-mm@kvack.org Subject: [PATCH v4 02/25] mm/memory_hotplug: Allow check_hotplug_memory_addressable to be called from drivers Date: Fri, 27 Mar 2020 18:11:39 +1100 Message-Id: <20200327071202.2159885-3-alastair@d-silva.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200327071202.2159885-1-alastair@d-silva.org> References: <20200327071202.2159885-1-alastair@d-silva.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mail2.nmnhosting.com [10.0.1.20]); Fri, 27 Mar 2020 18:12:14 +1100 (AEDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When setting up OpenCAPI connected persistent memory, the range check may not be performed until quite late (or perhaps not at all, if the user does not establish a DAX device). This patch makes the range check callable so we can perform the check while probing the OpenCAPI Persistent Memory device. Signed-off-by: Alastair D'Silva Reviewed-by: Andrew Donnellan --- include/linux/memory_hotplug.h | 5 +++++ mm/memory_hotplug.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index f4d59155f3d4..9a19ae0d7e31 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -337,6 +337,11 @@ static inline void __remove_memory(int nid, u64 start, u64 size) {} extern void set_zone_contiguous(struct zone *zone); extern void clear_zone_contiguous(struct zone *zone); +#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE +int check_hotplug_memory_addressable(unsigned long pfn, + unsigned long nr_pages); +#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ + extern void __ref free_area_init_core_hotplug(int nid); extern int __add_memory(int nid, u64 start, u64 size); extern int add_memory(int nid, u64 start, u64 size); diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 0a54ffac8c68..14945f033594 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -276,8 +276,8 @@ static int check_pfn_span(unsigned long pfn, unsigned long nr_pages, return 0; } -static int check_hotplug_memory_addressable(unsigned long pfn, - unsigned long nr_pages) +int check_hotplug_memory_addressable(unsigned long pfn, + unsigned long nr_pages) { const u64 max_addr = PFN_PHYS(pfn + nr_pages) - 1; -- 2.24.1