From b9cbbef7b34dbe5faf450ba9341161b29001fdbc Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 20 Sep 2021 15:07:28 +0200 Subject: [PATCH] 4.19-stable patches added patches: mm-memory_hotplug-use-unsigned-long-for-pfn-in-zone_for_pfn_range.patch --- ...d-long-for-pfn-in-zone_for_pfn_range.patch | 125 ++++++++++++++++++ queue-4.19/series | 1 + 2 files changed, 126 insertions(+) create mode 100644 queue-4.19/mm-memory_hotplug-use-unsigned-long-for-pfn-in-zone_for_pfn_range.patch diff --git a/queue-4.19/mm-memory_hotplug-use-unsigned-long-for-pfn-in-zone_for_pfn_range.patch b/queue-4.19/mm-memory_hotplug-use-unsigned-long-for-pfn-in-zone_for_pfn_range.patch new file mode 100644 index 00000000000..83572b8334c --- /dev/null +++ b/queue-4.19/mm-memory_hotplug-use-unsigned-long-for-pfn-in-zone_for_pfn_range.patch @@ -0,0 +1,125 @@ +From 7cf209ba8a86410939a24cb1aeb279479a7e0ca6 Mon Sep 17 00:00:00 2001 +From: David Hildenbrand +Date: Tue, 7 Sep 2021 19:54:59 -0700 +Subject: mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range() + +From: David Hildenbrand + +commit 7cf209ba8a86410939a24cb1aeb279479a7e0ca6 upstream. + +Patch series "mm/memory_hotplug: preparatory patches for new online policy and memory" + +These are all cleanups and one fix previously sent as part of [1]: +[PATCH v1 00/12] mm/memory_hotplug: "auto-movable" online policy and memory +groups. + +These patches make sense even without the other series, therefore I pulled +them out to make the other series easier to digest. + +[1] https://lkml.kernel.org/r/20210607195430.48228-1-david@redhat.com + +This patch (of 4): + +Checkpatch complained on a follow-up patch that we are using "unsigned" +here, which defaults to "unsigned int" and checkpatch is correct. + +As we will search for a fitting zone using the wrong pfn, we might end +up onlining memory to one of the special kernel zones, such as ZONE_DMA, +which can end badly as the onlined memory does not satisfy properties of +these zones. + +Use "unsigned long" instead, just as we do in other places when handling +PFNs. This can bite us once we have physical addresses in the range of +multiple TB. + +Link: https://lkml.kernel.org/r/20210712124052.26491-2-david@redhat.com +Fixes: e5e689302633 ("mm, memory_hotplug: display allowed zones in the preferred ordering") +Signed-off-by: David Hildenbrand +Reviewed-by: Pankaj Gupta +Reviewed-by: Muchun Song +Reviewed-by: Oscar Salvador +Cc: David Hildenbrand +Cc: Vitaly Kuznetsov +Cc: "Michael S. Tsirkin" +Cc: Jason Wang +Cc: Pankaj Gupta +Cc: Wei Yang +Cc: Michal Hocko +Cc: Dan Williams +Cc: Anshuman Khandual +Cc: Dave Hansen +Cc: Vlastimil Babka +Cc: Mike Rapoport +Cc: "Rafael J. Wysocki" +Cc: Len Brown +Cc: Pavel Tatashin +Cc: Heiko Carstens +Cc: Michael Ellerman +Cc: Catalin Marinas +Cc: virtualization@lists.linux-foundation.org +Cc: Andy Lutomirski +Cc: "Aneesh Kumar K.V" +Cc: Anton Blanchard +Cc: Ard Biesheuvel +Cc: Baoquan He +Cc: Benjamin Herrenschmidt +Cc: Borislav Petkov +Cc: Christian Borntraeger +Cc: Christophe Leroy +Cc: Dave Jiang +Cc: "H. Peter Anvin" +Cc: Ingo Molnar +Cc: Jia He +Cc: Joe Perches +Cc: Kefeng Wang +Cc: Laurent Dufour +Cc: Michel Lespinasse +Cc: Nathan Lynch +Cc: Nicholas Piggin +Cc: Paul Mackerras +Cc: Peter Zijlstra +Cc: Pierre Morel +Cc: "Rafael J. Wysocki" +Cc: Rich Felker +Cc: Scott Cheloha +Cc: Sergei Trofimovich +Cc: Thiago Jung Bauermann +Cc: Thomas Gleixner +Cc: Vasily Gorbik +Cc: Vishal Verma +Cc: Will Deacon +Cc: Yoshinori Sato +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: David Hildenbrand +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/memory_hotplug.h | 4 ++-- + mm/memory_hotplug.c | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +--- a/include/linux/memory_hotplug.h ++++ b/include/linux/memory_hotplug.h +@@ -344,6 +344,6 @@ extern struct page *sparse_decode_mem_ma + unsigned long pnum); + extern bool allow_online_pfn_range(int nid, unsigned long pfn, unsigned long nr_pages, + int online_type); +-extern struct zone *zone_for_pfn_range(int online_type, int nid, unsigned start_pfn, +- unsigned long nr_pages); ++extern struct zone *zone_for_pfn_range(int online_type, int nid, ++ unsigned long start_pfn, unsigned long nr_pages); + #endif /* __LINUX_MEMORY_HOTPLUG_H */ +--- a/mm/memory_hotplug.c ++++ b/mm/memory_hotplug.c +@@ -783,8 +783,8 @@ static inline struct zone *default_zone_ + return movable_node_enabled ? movable_zone : kernel_zone; + } + +-struct zone * zone_for_pfn_range(int online_type, int nid, unsigned start_pfn, +- unsigned long nr_pages) ++struct zone *zone_for_pfn_range(int online_type, int nid, ++ unsigned long start_pfn, unsigned long nr_pages) + { + if (online_type == MMOP_ONLINE_KERNEL) + return default_kernel_zone_for_pfn(nid, start_pfn, nr_pages); diff --git a/queue-4.19/series b/queue-4.19/series index b4ad1c516c6..fff0f211b68 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -270,3 +270,4 @@ tcp-fix-tp-undo_retrans-accounting-in-tcp_sacktag_one.patch qed-handle-management-fw-error.patch ibmvnic-check-failover_pending-in-login-response.patch net-hns3-pad-the-short-tunnel-frame-before-sending-to-hardware.patch +mm-memory_hotplug-use-unsigned-long-for-pfn-in-zone_for_pfn_range.patch -- 2.47.2