From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Andrew Morton <akpm@linux-foundation.org>,
Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>,
Tang Chen <tangchen@cn.fujitsu.com>,
Vlastimil Babka <vbabka@suse.cz>,
David Rientjes <rientjes@google.com>,
Fabian Frederick <fabf@skynet.be>,
Zhang Zhen <zhenzhang.zhang@huawei.com>,
Vladimir Davydov <vdavydov@parallels.com>,
Wang Nan <wangnan0@huawei.com>
Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
linux-mm@kvack.org
Subject: [PATCH 2/3] memory_hotplug: add note about holding device_hotplug_lock and add_memory()
Date: Wed, 11 Feb 2015 16:44:21 +0100 [thread overview]
Message-ID: <1423669462-30918-3-git-send-email-vkuznets@redhat.com> (raw)
In-Reply-To: <1423669462-30918-1-git-send-email-vkuznets@redhat.com>
add_memory() is supposed to be run with device_hotplug_lock grabbed, otherwise
it can race with e.g. device_online(). ACPI memory hotplug does that already
but e.g. Hyper-V ballooning driver doesn't.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
mm/memory_hotplug.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 9fab107..41638eb 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1213,7 +1213,11 @@ int zone_for_memory(int nid, u64 start, u64 size, int zone_default)
return zone_default;
}
-/* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */
+/*
+ * NOTE: The caller must call lock_device_hotplug() to serialize hotplug
+ * and online/offline operations before this call.
+ * We are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG.
+ */
int __ref add_memory(int nid, u64 start, u64 size)
{
pg_data_t *pgdat = NULL;
--
1.9.3
next prev parent reply other threads:[~2015-02-11 15:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-11 15:44 [PATCH 0/3] memory_hotplug: hyperv: fix deadlock between memory adding and onlining Vitaly Kuznetsov
2015-02-11 15:44 ` [PATCH 1/3] driver core: export lock_device_hotplug/unlock_device_hotplug Vitaly Kuznetsov
2015-02-11 20:39 ` Andrew Morton
2015-02-12 4:04 ` Rafael J. Wysocki
2015-02-12 10:16 ` Vitaly Kuznetsov
2015-02-11 15:44 ` Vitaly Kuznetsov [this message]
2015-02-11 15:44 ` [PATCH 3/3] Drivers: hv: balloon: fix deadlock between memory adding and onlining Vitaly Kuznetsov
2015-02-11 20:30 ` [PATCH 0/3] memory_hotplug: hyperv: " David Rientjes
2015-02-12 6:39 ` David Rientjes
2015-02-12 15:39 ` Vitaly Kuznetsov
2015-02-12 10:15 ` Vitaly Kuznetsov
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=1423669462-30918-3-git-send-email-vkuznets@redhat.com \
--to=vkuznets@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=devel@linuxdriverproject.org \
--cc=fabf@skynet.be \
--cc=gregkh@linuxfoundation.org \
--cc=haiyangz@microsoft.com \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=tangchen@cn.fujitsu.com \
--cc=vbabka@suse.cz \
--cc=vdavydov@parallels.com \
--cc=wangnan0@huawei.com \
--cc=zhenzhang.zhang@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox