The patch below does not apply to the 4.19-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to stable@vger.kernel.org.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From b4223a510e2ab1bf0f971d50af7c1431014b25ad Mon Sep 17 00:00:00 2001
From: Jia He justin.he@arm.com Date: Tue, 11 Aug 2020 18:32:20 -0700 Subject: [PATCH] mm/memory_hotplug: fix unpaired mem_hotplug_begin/done
When check_memblock_offlined_cb() returns failed rc(e.g. the memblock is online at that time), mem_hotplug_begin/done is unpaired in such case.
Therefore a warning: Call Trace: percpu_up_write+0x33/0x40 try_remove_memory+0x66/0x120 ? _cond_resched+0x19/0x30 remove_memory+0x2b/0x40 dev_dax_kmem_remove+0x36/0x72 [kmem] device_release_driver_internal+0xf0/0x1c0 device_release_driver+0x12/0x20 bus_remove_device+0xe1/0x150 device_del+0x17b/0x3e0 unregister_dev_dax+0x29/0x60 devm_action_release+0x15/0x20 release_nodes+0x19a/0x1e0 devres_release_all+0x3f/0x50 device_release_driver_internal+0x100/0x1c0 driver_detach+0x4c/0x8f bus_remove_driver+0x5c/0xd0 driver_unregister+0x31/0x50 dax_pmem_exit+0x10/0xfe0 [dax_pmem]
Fixes: f1037ec0cc8a ("mm/memory_hotplug: fix remove_memory() lockdep splat") Signed-off-by: Jia He justin.he@arm.com Signed-off-by: Andrew Morton akpm@linux-foundation.org Reviewed-by: David Hildenbrand david@redhat.com Acked-by: Michal Hocko mhocko@suse.com Acked-by: Dan Williams dan.j.williams@intel.com Cc: stable@vger.kernel.org [5.6+] Cc: Andy Lutomirski luto@kernel.org Cc: Baoquan He bhe@redhat.com Cc: Borislav Petkov bp@alien8.de Cc: Catalin Marinas catalin.marinas@arm.com Cc: Chuhong Yuan hslester96@gmail.com Cc: Dave Hansen dave.hansen@linux.intel.com Cc: Dave Jiang dave.jiang@intel.com Cc: Fenghua Yu fenghua.yu@intel.com Cc: "H. Peter Anvin" hpa@zytor.com Cc: Ingo Molnar mingo@redhat.com Cc: Jonathan Cameron Jonathan.Cameron@Huawei.com Cc: Kaly Xin Kaly.Xin@arm.com Cc: Logan Gunthorpe logang@deltatee.com Cc: Masahiro Yamada masahiroy@kernel.org Cc: Mike Rapoport rppt@linux.ibm.com Cc: Peter Zijlstra peterz@infradead.org Cc: Rich Felker dalias@libc.org Cc: Thomas Gleixner tglx@linutronix.de Cc: Tony Luck tony.luck@intel.com Cc: Vishal Verma vishal.l.verma@intel.com Cc: Will Deacon will@kernel.org Cc: Yoshinori Sato ysato@users.sourceforge.jp Link: http://lkml.kernel.org/r/20200710031619.18762-3-justin.he@arm.com Signed-off-by: Linus Torvalds torvalds@linux-foundation.org
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 6289a909ea36..ce3d858319bd 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1757,7 +1757,7 @@ static int __ref try_remove_memory(int nid, u64 start, u64 size) */ rc = walk_memory_blocks(start, size, NULL, check_memblock_offlined_cb); if (rc) - goto done; + return rc;
/* remove memmap entry */ firmware_map_remove(start, start + size, "System RAM"); @@ -1781,9 +1781,8 @@ static int __ref try_remove_memory(int nid, u64 start, u64 size)
try_offline_node(nid);
-done: mem_hotplug_done(); - return rc; + return 0; }
/**
Hi Greg, If anybody wants to backport it to stable tree, there are 2 pre-condition for this commit ("[PATCH] mm/memory_hotplug: fix unpaired mem_hotplug_begin/done")
1. eca499ab3 ("mm/hotplug: make remove_memory() interface usable") applied in v5.2, it disabled the BUG() when check_memblock_offlined_cb() failed. 2. f1037ec0c ("mm/memory_hotplug: fix remove_memory() lockdep splat") in v5.5, it introduced the unpair but depends on eca499ab3
I checked https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/mm/mem.... Looks like stable tree v4.19 hasn't applied eca499ab3 but applied f1037ec0c. Hence I don't think v4.19 needs this patch.
-- Cheers, Justin (Jia He)
-----Original Message----- From: gregkh@linuxfoundation.org gregkh@linuxfoundation.org Sent: Wednesday, August 19, 2020 8:29 PM To: Justin He Justin.He@arm.com; Jonathan.Cameron@Huawei.com; Kaly Xin Kaly.Xin@arm.com; akpm@linux-foundation.org; bhe@redhat.com; bp@alien8.de; Catalin Marinas Catalin.Marinas@arm.com; dalias@libc.org; dan.j.williams@intel.com; dave.hansen@linux.intel.com; dave.jiang@intel.com; david@redhat.com; fenghua.yu@intel.com; hpa@zytor.com; hslester96@gmail.com; logang@deltatee.com; luto@kernel.org; masahiroy@kernel.org; mhocko@suse.com; mingo@redhat.com; peterz@infradead.org; rppt@linux.ibm.com; stable@vger.kernel.org; tglx@linutronix.de; tony.luck@intel.com; torvalds@linux-foundation.org; vishal.l.verma@intel.com; will@kernel.org; ysato@users.sourceforge.jp Cc: stable@vger.kernel.org Subject: FAILED: patch "[PATCH] mm/memory_hotplug: fix unpaired mem_hotplug_begin/done" failed to apply to 4.19-stable tree
The patch below does not apply to the 4.19-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to stable@vger.kernel.org.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From b4223a510e2ab1bf0f971d50af7c1431014b25ad Mon Sep 17 00:00:00 2001 From: Jia He justin.he@arm.com Date: Tue, 11 Aug 2020 18:32:20 -0700 Subject: [PATCH] mm/memory_hotplug: fix unpaired mem_hotplug_begin/done
When check_memblock_offlined_cb() returns failed rc(e.g. the memblock is online at that time), mem_hotplug_begin/done is unpaired in such case.
Therefore a warning: Call Trace: percpu_up_write+0x33/0x40 try_remove_memory+0x66/0x120 ? _cond_resched+0x19/0x30 remove_memory+0x2b/0x40 dev_dax_kmem_remove+0x36/0x72 [kmem] device_release_driver_internal+0xf0/0x1c0 device_release_driver+0x12/0x20 bus_remove_device+0xe1/0x150 device_del+0x17b/0x3e0 unregister_dev_dax+0x29/0x60 devm_action_release+0x15/0x20 release_nodes+0x19a/0x1e0 devres_release_all+0x3f/0x50 device_release_driver_internal+0x100/0x1c0 driver_detach+0x4c/0x8f bus_remove_driver+0x5c/0xd0 driver_unregister+0x31/0x50 dax_pmem_exit+0x10/0xfe0 [dax_pmem]
Fixes: f1037ec0cc8a ("mm/memory_hotplug: fix remove_memory() lockdep splat") Signed-off-by: Jia He justin.he@arm.com Signed-off-by: Andrew Morton akpm@linux-foundation.org Reviewed-by: David Hildenbrand david@redhat.com Acked-by: Michal Hocko mhocko@suse.com Acked-by: Dan Williams dan.j.williams@intel.com Cc: stable@vger.kernel.org[5.6+] Cc: Andy Lutomirski luto@kernel.org Cc: Baoquan He bhe@redhat.com Cc: Borislav Petkov bp@alien8.de Cc: Catalin Marinas catalin.marinas@arm.com Cc: Chuhong Yuan hslester96@gmail.com Cc: Dave Hansen dave.hansen@linux.intel.com Cc: Dave Jiang dave.jiang@intel.com Cc: Fenghua Yu fenghua.yu@intel.com Cc: "H. Peter Anvin" hpa@zytor.com Cc: Ingo Molnar mingo@redhat.com Cc: Jonathan Cameron Jonathan.Cameron@Huawei.com Cc: Kaly Xin Kaly.Xin@arm.com Cc: Logan Gunthorpe logang@deltatee.com Cc: Masahiro Yamada masahiroy@kernel.org Cc: Mike Rapoport rppt@linux.ibm.com Cc: Peter Zijlstra peterz@infradead.org Cc: Rich Felker dalias@libc.org Cc: Thomas Gleixner tglx@linutronix.de Cc: Tony Luck tony.luck@intel.com Cc: Vishal Verma vishal.l.verma@intel.com Cc: Will Deacon will@kernel.org Cc: Yoshinori Sato ysato@users.sourceforge.jp Link: http://lkml.kernel.org/r/20200710031619.18762-3-justin.he@arm.com Signed-off-by: Linus Torvalds torvalds@linux-foundation.org
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 6289a909ea36..ce3d858319bd 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1757,7 +1757,7 @@ static int __ref try_remove_memory(int nid, u64 start, u64 size) */ rc = walk_memory_blocks(start, size, NULL, check_memblock_offlined_cb); if (rc) -goto done; +return rc;
/* remove memmap entry */ firmware_map_remove(start, start + size, "System RAM"); @@ -1781,9 +1781,8 @@ static int __ref try_remove_memory(int nid, u64 start, u64 size)
try_offline_node(nid);
-done: mem_hotplug_done(); -return rc; +return 0; }
/**
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
On Thu, Aug 20, 2020 at 02:27:40AM +0000, Justin He wrote:
Hi Greg, If anybody wants to backport it to stable tree, there are 2 pre-condition for this commit ("[PATCH] mm/memory_hotplug: fix unpaired mem_hotplug_begin/done")
- eca499ab3 ("mm/hotplug: make remove_memory() interface usable") applied
in v5.2, it disabled the BUG() when check_memblock_offlined_cb() failed. 2. f1037ec0c ("mm/memory_hotplug: fix remove_memory() lockdep splat") in v5.5, it introduced the unpair but depends on eca499ab3
I checked https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/mm/mem.... Looks like stable tree v4.19 hasn't applied eca499ab3 but applied f1037ec0c. Hence I don't think v4.19 needs this patch.
Thanks, I'll just leave this out of 4.19.y for now then.
greg k-h
linux-stable-mirror@lists.linaro.org