All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Subject: vhost memory hotplug deadlock
Date: Wed, 19 Sep 2018 12:10:27 -0700	[thread overview]
Message-ID: <20180919121027.57857295@xeon-e3> (raw)

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;
        }

                 reply	other threads:[~2018-09-19 19:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180919121027.57857295@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.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.