DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Anatoly Burakov <anatoly.burakov@intel.com>
Cc: dev@dpdk.org, John McNamara <john.mcnamara@intel.com>,
	Marko Kovacevic <marko.kovacevic@intel.com>,
	stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 19.02 v2] malloc: fix deadlock when using malloc stats
Date: Fri, 21 Dec 2018 14:35:57 +0100	[thread overview]
Message-ID: <7780238.sPL5XOYxUe@xps> (raw)
In-Reply-To: <517a31eda38a8334a9a9dbc941f0e2bcc067073c.1545395127.git.anatoly.burakov@intel.com>

21/12/2018 13:26, Anatoly Burakov:
> 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: 72cf92b31855 ("malloc: index heaps using heap ID rather than NUMA node")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
> 
> Notes:
>     This is the best we can do for 19.02 without breaking ABI.

Applied, thanks

      reply	other threads:[~2018-12-21 13:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-04 12:22 [dpdk-dev] [PATCH 18.11] " Anatoly Burakov
2018-12-21 12:09 ` Thomas Monjalon
2018-12-21 12:12   ` Burakov, Anatoly
2018-12-21 12:26 ` [dpdk-dev] [PATCH 19.02 v2] " Anatoly Burakov
2018-12-21 13:35   ` Thomas Monjalon [this message]

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=7780238.sPL5XOYxUe@xps \
    --to=thomas@monjalon.net \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=john.mcnamara@intel.com \
    --cc=marko.kovacevic@intel.com \
    --cc=stable@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).