Subject: [PATCH AUTOSEL 4.19 165/237] powerpc/powernv: hold device_hotplug_lock when calling device_online()

From: Sasha Levin <[email-masked]>
Date: Sat, 16 Nov 2019 10:40:00 -0500

From: David Hildenbrand <[email-masked]>

[ Upstream commit cec1680591d6d5b10ecc10f370210089416e98af ]

device_online() should be called with device_hotplug_lock() held.

Link: http://lkml.kernel.org/r/[email-masked]
Signed-off-by: David Hildenbrand <[email-masked]>
Reviewed-by: Pavel Tatashin <[email-masked]>
Reviewed-by: Rashmica Gupta <[email-masked]>
Cc: Benjamin Herrenschmidt <[email-masked]>
Cc: Paul Mackerras <[email-masked]>
Cc: Michael Ellerman <[email-masked]>
Cc: Rashmica Gupta <[email-masked]>
Cc: Balbir Singh <[email-masked]>
Cc: Michael Neuling <[email-masked]>
Cc: Boris Ostrovsky <[email-masked]>
Cc: Dan Williams <[email-masked]>
Cc: Greg Kroah-Hartman <[email-masked]>
Cc: Haiyang Zhang <[email-masked]>
Cc: Heiko Carstens <[email-masked]>
Cc: John Allen <[email-masked]>
Cc: Jonathan Corbet <[email-masked]>
Cc: Joonsoo Kim <[email-masked]>
Cc: Juergen Gross <[email-masked]>
Cc: Kate Stewart <[email-masked]>
Cc: "K. Y. Srinivasan" <[email-masked]>
Cc: Len Brown <[email-masked]>
Cc: Martin Schwidefsky <[email-masked]>
Cc: Mathieu Malaterre <[email-masked]>
Cc: Michal Hocko <[email-masked]>
Cc: Nathan Fontenot <[email-masked]>
Cc: Oscar Salvador <[email-masked]>
Cc: Philippe Ombredanne <[email-masked]>
Cc: Rafael J. Wysocki <[email-masked]>
Cc: "Rafael J. Wysocki" <[email-masked]>
Cc: Stephen Hemminger <[email-masked]>
Cc: Thomas Gleixner <[email-masked]>
Cc: Vlastimil Babka <[email-masked]>
Cc: YASUAKI ISHIMATSU <[email-masked]>
Signed-off-by: Andrew Morton <[email-masked]>
Signed-off-by: Linus Torvalds <[email-masked]>
Signed-off-by: Sasha Levin <[email-masked]>
---
 arch/powerpc/platforms/powernv/memtrace.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
index 232bf5987f91d..dd3cc4632b9ae 100644
--- a/arch/powerpc/platforms/powernv/memtrace.c
+++ b/arch/powerpc/platforms/powernv/memtrace.c
@@ -244,9 +244,11 @@ static int memtrace_online(void)
 		 * we need to online the memory ourselves.
 		 */
 		if (!memhp_auto_online) {
+			lock_device_hotplug();
 			walk_memory_range(PFN_DOWN(ent->start),
 					  PFN_UP(ent->start + ent->size - 1),
 					  NULL, online_mem_block);
+			unlock_device_hotplug();
 		}
 
 		/*
-- 
2.20.1