All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Ott <sebott@linux.vnet.ibm.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Heiko Carstens <heiko.carstens@de.ibm.com>
Subject: [PATCH] mm, add_memory_resource: hold device_hotplug lock over mem_hotplug_{begin, done}
Date: Sun, 26 Feb 2017 12:42:44 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.20.1702261231580.3067@schleppi.fritz.box> (raw)

With 4.10.0-10265-gc4f3f22 the following warning is triggered on s390:

WARNING: CPU: 6 PID: 1 at drivers/base/core.c:643 assert_held_device_hotplug+0x4a/0x58
[    5.731214] Call Trace:
[    5.731219] ([<000000000067b8b0>] assert_held_device_hotplug+0x40/0x58)
[    5.731225]  [<0000000000337914>] mem_hotplug_begin+0x34/0xc8
[    5.731231]  [<00000000008b897e>] add_memory_resource+0x7e/0x1f8
[    5.731236]  [<00000000008b8bd2>] add_memory+0xda/0x130
[    5.731243]  [<0000000000d7f0dc>] add_memory_merged+0x15c/0x178
[    5.731247]  [<0000000000d7f3a6>] sclp_detect_standby_memory+0x2ae/0x2f8
[    5.731252]  [<00000000001002ba>] do_one_initcall+0xa2/0x150
[    5.731258]  [<0000000000d3adc0>] kernel_init_freeable+0x228/0x2d8
[    5.731263]  [<00000000008b6572>] kernel_init+0x2a/0x140
[    5.731267]  [<00000000008c3972>] kernel_thread_starter+0x6/0xc
[    5.731272]  [<00000000008c396c>] kernel_thread_starter+0x0/0xc
[    5.731276] no locks held by swapper/0/1.
[    5.731280] Last Breaking-Event-Address:
[    5.731285]  [<000000000067b8b6>] assert_held_device_hotplug+0x46/0x58
[    5.731292] ---[ end trace 46480df21194c96a ]---


The following patch fixes that for me:

----->8
mm, add_memory_resource: hold device_hotplug lock over mem_hotplug_{begin, done}

With commit 3fc219241 ("mm: validate device_hotplug is held for memory hotplug")
a lock assertion was added to mem_hotplug_begin() which led to a warning
when add_memory() is called. Fix this by acquiring device_hotplug_lock in
add_memory_resource().

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
---
 mm/memory_hotplug.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 1d3ed58..c633bbc 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1361,6 +1361,7 @@ int __ref add_memory_resource(int nid, struct resource *res, bool online)
 		new_pgdat = !p;
 	}
 
+	lock_device_hotplug();
 	mem_hotplug_begin();
 
 	/*
@@ -1416,6 +1417,7 @@ int __ref add_memory_resource(int nid, struct resource *res, bool online)
 
 out:
 	mem_hotplug_done();
+	unlock_device_hotplug();
 	return ret;
 }
 EXPORT_SYMBOL_GPL(add_memory_resource);
-- 
2.3.0

WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Ott <sebott@linux.vnet.ibm.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Heiko Carstens <heiko.carstens@de.ibm.com>
Subject: [PATCH] mm, add_memory_resource: hold device_hotplug lock over mem_hotplug_{begin, done}
Date: Sun, 26 Feb 2017 12:42:44 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.20.1702261231580.3067@schleppi.fritz.box> (raw)

With 4.10.0-10265-gc4f3f22 the following warning is triggered on s390:

WARNING: CPU: 6 PID: 1 at drivers/base/core.c:643 assert_held_device_hotplug+0x4a/0x58
[    5.731214] Call Trace:
[    5.731219] ([<000000000067b8b0>] assert_held_device_hotplug+0x40/0x58)
[    5.731225]  [<0000000000337914>] mem_hotplug_begin+0x34/0xc8
[    5.731231]  [<00000000008b897e>] add_memory_resource+0x7e/0x1f8
[    5.731236]  [<00000000008b8bd2>] add_memory+0xda/0x130
[    5.731243]  [<0000000000d7f0dc>] add_memory_merged+0x15c/0x178
[    5.731247]  [<0000000000d7f3a6>] sclp_detect_standby_memory+0x2ae/0x2f8
[    5.731252]  [<00000000001002ba>] do_one_initcall+0xa2/0x150
[    5.731258]  [<0000000000d3adc0>] kernel_init_freeable+0x228/0x2d8
[    5.731263]  [<00000000008b6572>] kernel_init+0x2a/0x140
[    5.731267]  [<00000000008c3972>] kernel_thread_starter+0x6/0xc
[    5.731272]  [<00000000008c396c>] kernel_thread_starter+0x0/0xc
[    5.731276] no locks held by swapper/0/1.
[    5.731280] Last Breaking-Event-Address:
[    5.731285]  [<000000000067b8b6>] assert_held_device_hotplug+0x46/0x58
[    5.731292] ---[ end trace 46480df21194c96a ]---


The following patch fixes that for me:

----->8
mm, add_memory_resource: hold device_hotplug lock over mem_hotplug_{begin, done}

With commit 3fc219241 ("mm: validate device_hotplug is held for memory hotplug")
a lock assertion was added to mem_hotplug_begin() which led to a warning
when add_memory() is called. Fix this by acquiring device_hotplug_lock in
add_memory_resource().

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
---
 mm/memory_hotplug.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 1d3ed58..c633bbc 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1361,6 +1361,7 @@ int __ref add_memory_resource(int nid, struct resource *res, bool online)
 		new_pgdat = !p;
 	}
 
+	lock_device_hotplug();
 	mem_hotplug_begin();
 
 	/*
@@ -1416,6 +1417,7 @@ int __ref add_memory_resource(int nid, struct resource *res, bool online)
 
 out:
 	mem_hotplug_done();
+	unlock_device_hotplug();
 	return ret;
 }
 EXPORT_SYMBOL_GPL(add_memory_resource);
-- 
2.3.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2017-02-26 11:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-26 11:42 Sebastian Ott [this message]
2017-02-26 11:42 ` [PATCH] mm, add_memory_resource: hold device_hotplug lock over mem_hotplug_{begin, done} Sebastian Ott
2017-02-27 16:20 ` Michal Hocko
2017-02-27 16:20   ` Michal Hocko
2017-02-28 11:57   ` Heiko Carstens
2017-02-28 11:57     ` Heiko Carstens
2017-03-01 12:51     ` Heiko Carstens
2017-03-01 12:51       ` Heiko Carstens
2017-03-01 15:52       ` Dan Williams
2017-03-01 15:52         ` Dan Williams
2017-03-01 17:04         ` Heiko Carstens
2017-03-01 17:04           ` Heiko Carstens
2017-03-01 22:55           ` Dan Williams
2017-03-01 22:55             ` Dan Williams
2017-03-06  8:22             ` Heiko Carstens
2017-03-06  8:22               ` Heiko Carstens
2017-03-09  6:26               ` Dan Williams
2017-03-09  6:26                 ` Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.20.1702261231580.3067@schleppi.fritz.box \
    --to=sebott@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.