DPDK patches and discussions
 help / color / mirror / Atom feed
From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [dpdk-dev] [Bug 81] Use of rte_memseg_contig_walk in vhost_kernel.c causes deadlock
Date: Tue, 14 Aug 2018 16:00:45 +0000	[thread overview]
Message-ID: <bug-81-3@http.bugs.dpdk.org/> (raw)

https://bugs.dpdk.org/show_bug.cgi?id=81

            Bug ID: 81
           Summary: Use of rte_memseg_contig_walk in vhost_kernel.c causes
                    deadlock
           Product: DPDK
           Version: 18.08
          Hardware: All
                OS: All
            Status: CONFIRMED
          Severity: normal
          Priority: Normal
         Component: vhost/virtio
          Assignee: dev@dpdk.org
          Reporter: seanbh@gmail.com
  Target Milestone: ---

Deadlock can occur when allocating memory if a virtio_user device is in use.
The execution path that causes is this is as follows:


alloc_more_mem_on_socket(...);
  try_expand_heap(...);

    // RW Write Lock taken here...
    rte_rwlock_write_lock(&mcfg->memory_hotplug_lock);

    try_expand_heap_primary(...);
      eal_memalloc_mem_event_notify(...);
        virtio_user_mem_event_cb(...);
          vhost_kernel_ioctl(...);
            prepare_vhost_memory_kernel(...);
              rte_memseg_contig_walk(...);

                // Attempt to take RW Read Lock here...
                rte_rwlock_read_lock(&mcfg->memory_hotplug_lock);


Replacing rte_memseg_contig_walk() with rte_memseg_walk_thread_unsafe() in
prepare_vhost_memory_kernel() will remove the deadlock, but could cause issues
as prepare_vhost_memory_kernel() may also be called outside of memalloc event
notify context.

-- 
You are receiving this mail because:
You are the assignee for the bug.

                 reply	other threads:[~2018-08-14 16:00 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=bug-81-3@http.bugs.dpdk.org/ \
    --to=bugzilla@dpdk.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 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).