Thread (60 messages) 60 messages, 9 authors, 2020-04-03

RE: [PATCH v4 02/25] mm/memory_hotplug: Allow check_hotplug_memory_addressable to be called from drivers

From: Alastair D'Silva <hidden>
Date: 2020-04-02 04:34:01
Also in: linux-mm, lkml, nvdimm

-----Original Message-----
From: Dan Williams <redacted>
Sent: Wednesday, 1 April 2020 7:48 PM
To: Alastair D'Silva <redacted>
Cc: Aneesh Kumar K . V <redacted>; Oliver O'Halloran
[off-list ref]; Benjamin Herrenschmidt
[off-list ref]; Paul Mackerras [off-list ref]; Michael
Ellerman [off-list ref]; Frederic Barrat [off-list ref];
Andrew Donnellan [off-list ref]; Arnd Bergmann
[off-list ref]; Greg Kroah-Hartman [off-list ref];
Vishal Verma [off-list ref]; Dave Jiang
[off-list ref]; Ira Weiny [off-list ref]; Andrew Morton
[off-list ref]; Mauro Carvalho Chehab
[off-list ref]; David S. Miller [off-list ref];
Rob Herring [off-list ref]; Anton Blanchard [off-list ref];
Krzysztof Kozlowski [off-list ref]; Mahesh Salgaonkar
[off-list ref]; Madhavan Srinivasan
[off-list ref]; Cédric Le Goater [off-list ref]; Anju T
Sudhakar [off-list ref]; Hari Bathini
[off-list ref]; Thomas Gleixner [off-list ref]; Greg
Kurz [off-list ref]; Nicholas Piggin [off-list ref]; Masahiro
Yamada [off-list ref]; Alexey Kardashevskiy
[off-list ref]; Linux Kernel Mailing List [off-list ref];
linuxppc-dev [off-list ref]; linux-nvdimm <linux-
nvdimm@lists.01.org>; Linux MM [off-list ref]
Subject: Re: [PATCH v4 02/25] mm/memory_hotplug: Allow
check_hotplug_memory_addressable to be called from drivers

On Sun, Mar 29, 2020 at 10:23 PM Alastair D'Silva [off-list ref]
wrote:
quoted
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 <redacted>
Reviewed-by: Andrew Donnellan <redacted>
---
 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 */
Let's move this to include/linux/memory.h with the other
CONFIG_MEMORY_HOTPLUG_SPARSE declarations, and add a dummy
implementation for the CONFIG_MEMORY_HOTPLUG_SPARSE=n case.

Also, this patch can be squashed with the next one, no need for it to be
stand alone.
Ok
quoted
+
 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,
quoted
        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
-- 
Alastair D'Silva           mob: 0423 762 819
skype: alastair_dsilva     msn: alastair@d-silva.org
blog: http://alastair.d-silva.org    Twitter: @EvilDeece
 

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help