numam-dpdk/lib/librte_eal
Anatoly Burakov ba731ea1dd malloc: fix deadlock when reading stats
Currently, malloc statistics and external heap creation code
use memory hotplug lock as a way to synchronize accesses to
heaps (as in, locking the hotplug lock to prevent list of heaps
from changing under our feet). At the same time, malloc
statistics code will also lock the heap because it needs to
access heap data and does not want any other thread to allocate
anything from that heap.

In such scheme, it is possible to enter a deadlock with the
following sequence of events:

thread 1		thread 2
rte_malloc()
			rte_malloc_dump_stats()
take heap lock
			take hotplug lock
failed to allocate,
attempt to take
hotplug lock
			attempt to take heap lock

Neither thread will be able to continue, as both of them are
waiting for the other one to drop the lock. Adding an
additional lock will require an ABI change, so instead of
that, make malloc statistics calls thread-unsafe with
respect to creating/destroying heaps.

Fixes: 72cf92b318 ("malloc: index heaps using heap ID rather than NUMA node")
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
2018-12-21 15:26:43 +01:00
..
bsdapp eal: close multi-process socket during cleanup 2018-12-21 01:15:41 +01:00
common malloc: fix deadlock when reading stats 2018-12-21 15:26:43 +01:00
linuxapp eal: close multi-process socket during cleanup 2018-12-21 01:15:41 +01:00
Makefile lib: use SPDX tag for Intel copyright files 2018-01-04 22:41:39 +01:00
meson.build mk: build with _GNU_SOURCE defined by default 2018-10-22 11:28:27 +02:00
rte_eal_version.map mem: allow usage of non-heap external memory in multiprocess 2018-12-20 18:14:55 +01:00