[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Xen-devel] [PATCH RFCv2 3/6] mm/memory_hotplug: fix online/offline_pages called w.o. mem_hotplug_lock
- To: David Hildenbrand <david@xxxxxxxxxx>, linux-mm@xxxxxxxxx
- From: Rashmica <rashmica.g@xxxxxxxxx>
- Date: Mon, 3 Sep 2018 10:36:24 +1000
- Cc: Kate Stewart <kstewart@xxxxxxxxxxxxxxxxxxx>, Michal Hocko <mhocko@xxxxxxxx>, linux-doc@xxxxxxxxxxxxxxx, Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>, Balbir Singh <bsingharora@xxxxxxxxx>, Heiko Carstens <heiko.carstens@xxxxxxxxxx>, Paul Mackerras <paulus@xxxxxxxxx>, "K. Y. Srinivasan" <kys@xxxxxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Michael Neuling <mikey@xxxxxxxxxxx>, Stephen Hemminger <sthemmin@xxxxxxxxxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Pavel Tatashin <pasha.tatashin@xxxxxxxxxx>, linux-acpi@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, Len Brown <lenb@xxxxxxxxxx>, Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>, Dan Williams <dan.j.williams@xxxxxxxxx>, YASUAKI ISHIMATSU <yasu.isimatu@xxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Vlastimil Babka <vbabka@xxxxxxx>, Oscar Salvador <osalvador@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Mathieu Malaterre <malat@xxxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, "Rafael J. Wysocki" <rjw@xxxxxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, Philippe Ombredanne <pombredanne@xxxxxxxx>, Martin Schwidefsky <schwidefsky@xxxxxxxxxx>, devel@xxxxxxxxxxxxxxxxxxxxxx, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, linuxppc-dev@xxxxxxxxxxxxxxxx
- Delivery-date: Mon, 03 Sep 2018 05:01:12 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Hi David,
On 21/08/18 20:44, David Hildenbrand wrote:
There seem to be some problems as result of 30467e0b3be ("mm, hotplug:
fix concurrent memory hot-add deadlock"), which tried to fix a possible
lock inversion reported and discussed in [1] due to the two locks
a) device_lock()
b) mem_hotplug_lock
While add_memory() first takes b), followed by a) during
bus_probe_device(), onlining of memory from user space first took b),
followed by a), exposing a possible deadlock.
Do you mean "onlining of memory from user space first took a),
followed by b)"?
In [1], and it was decided to not make use of device_hotplug_lock, but
rather to enforce a locking order.
The problems I spotted related to this:
1. Memory block device attributes: While .state first calls
mem_hotplug_begin() and the calls device_online() - which takes
device_lock() - .online does no longer call mem_hotplug_begin(), so
effectively calls online_pages() without mem_hotplug_lock.
2. device_online() should be called under device_hotplug_lock, however
onlining memory during add_memory() does not take care of that.
In addition, I think there is also something wrong about the locking in
3. arch/powerpc/platforms/powernv/memtrace.c calls offline_pages()
without locks. This was introduced after 30467e0b3be. And skimming over
the code, I assume it could need some more care in regards to locking
(e.g. device_online() called without device_hotplug_lock - but I'll
not touch that for now).
Can you mention that you fixed this in later patches?
The series looks good to me. Feel free to add my reviewed-by:
Reviewed-by: Rashmica Gupta <rashmica.g@xxxxxxxxx>
|
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|