DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] vhost memory hotplug deadlock
@ 2018-09-19 19:10 Stephen Hemminger
  0 siblings, 0 replies; only message in thread
From: Stephen Hemminger @ 2018-09-19 19:10 UTC (permalink / raw)
  To: dev

The Vhost memory handling will self deadlock.

The sequence is:
	rte_zmalloc
		malloc_heap_alloc
			heap_alloc_on_socket
				alloc_more_mem_on_socket
					try_expand_heap_primary

Acquires memory_hotplug_lock for write

	eal_memalloc_mem_event_notify
		vhost_user_mem_event_cb
			vhost_kernel_ioctl
				rte_memseg_contig_walk

Deadlocks acquiring memory_hotplug_lock for read

The following may fix it.

diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c
index d1be82162609..549235df0ca2 100644
--- a/drivers/net/virtio/virtio_user/vhost_kernel.c
+++ b/drivers/net/virtio/virtio_user/vhost_kernel.c
@@ -115,7 +115,8 @@ prepare_vhost_memory_kernel(void)
        wa.region_nr = 0;
        wa.vm = vm;
 
-       if (rte_memseg_contig_walk(add_memory_region, &wa) < 0) {
+       /* memory_hotplug_lock already held  */
+       if (rte_memseg_contig_walk_thread_unsafe(add_memory_region, &wa) < 0) {
                free(vm);
                return NULL;
        }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-09-19 19:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-19 19:10 [dpdk-dev] vhost memory hotplug deadlock Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).