patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Anatoly Burakov <anatoly.burakov@intel.com>
Cc: dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'ipc: add warnings about not using IPC with memory API' has been queued to LTS release 18.11.2
Date: Tue, 14 May 2019 15:43:50 +0100	[thread overview]
Message-ID: <20190514144406.7526-6-ktraynor@redhat.com> (raw)
In-Reply-To: <20190514144406.7526-1-ktraynor@redhat.com>

Hi,

FYI, your patch has been queued to LTS release 18.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/20/19. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/38d3874a0cf2cbfd5552d52eea99776cbd1e5b57

Thanks.

Kevin Traynor

---
From 38d3874a0cf2cbfd5552d52eea99776cbd1e5b57 Mon Sep 17 00:00:00 2001
From: Anatoly Burakov <anatoly.burakov@intel.com>
Date: Fri, 3 May 2019 12:50:49 +0100
Subject: [PATCH] ipc: add warnings about not using IPC with memory API

[ upstream commit 3855b4150037142435b5c1f4195e44c142785f1f ]

IPC and memory-related API's should not be mixed because memory
relies on IPC internally. Add explicit warnings to IPC API and
to the documentation about this.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 doc/guides/prog_guide/env_abstraction_layer.rst | 8 ++++++++
 doc/guides/prog_guide/multi_proc_support.rst    | 5 +++++
 lib/librte_eal/common/include/rte_eal.h         | 7 +++++++
 3 files changed, 20 insertions(+)

diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst
index 94d19682e..2bb77b019 100644
--- a/doc/guides/prog_guide/env_abstraction_layer.rst
+++ b/doc/guides/prog_guide/env_abstraction_layer.rst
@@ -148,4 +148,12 @@ A default validator callback is provided by EAL, which can be enabled with a
 of memory that can be used by DPDK application.
 
+.. warning::
+    Memory subsystem uses DPDK IPC internally, so memory allocations/callbacks
+    and IPC must not be mixed: it is not safe to allocate/free memory inside
+    memory-related or IPC callbacks, and it is not safe to use IPC inside
+    memory-related callbacks. See chapter
+    :ref:`Multi-process Support <Multi-process_Support>` for more details about
+    DPDK IPC.
+
 + Legacy memory mode
 
diff --git a/doc/guides/prog_guide/multi_proc_support.rst b/doc/guides/prog_guide/multi_proc_support.rst
index 966097924..63d08b609 100644
--- a/doc/guides/prog_guide/multi_proc_support.rst
+++ b/doc/guides/prog_guide/multi_proc_support.rst
@@ -319,4 +319,9 @@ IPC thread, sending messages while processing another message or request is
 supported.
 
+Since the memory sybsystem uses IPC internally, memory allocations and IPC must
+not be mixed: it is not safe to use IPC inside a memory-related callback, nor is
+it safe to allocate/free memory inside IPC callbacks. Attempting to do so may
+lead to a deadlock.
+
 Asynchronous request callbacks may be triggered either from IPC thread or from
 interrupt thread, depending on whether the request has timed out. It is
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index 67a4ffb6b..1d3553cea 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -229,4 +229,6 @@ struct rte_mp_reply {
  * As we create  socket channel for primary/secondary communication, use
  * this function typedef to register action for coming messages.
+ *
+ * @note No memory allocations should take place inside the callback.
  */
 typedef int (*rte_mp_t)(const struct rte_mp_msg *msg, const void *peer);
@@ -238,4 +240,6 @@ typedef int (*rte_mp_t)(const struct rte_mp_msg *msg, const void *peer);
  * this function typedef to register action for coming responses to asynchronous
  * requests.
+ *
+ * @note No memory allocations should take place inside the callback.
  */
 typedef int (*rte_mp_async_reply_t)(const struct rte_mp_msg *request,
@@ -312,4 +316,7 @@ rte_mp_sendmsg(struct rte_mp_msg *msg);
  * @note The caller is responsible to free reply->replies.
  *
+ * @note This API must not be used inside memory-related or IPC callbacks, and
+ *   no memory allocations should take place inside such callback.
+ *
  * @param req
  *   The req argument contains the customized request message.
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-05-14 15:39:07.601604422 +0100
+++ 0006-ipc-add-warnings-about-not-using-IPC-with-memory-API.patch	2019-05-14 15:39:07.303559011 +0100
@@ -1 +1 @@
-From 3855b4150037142435b5c1f4195e44c142785f1f Mon Sep 17 00:00:00 2001
+From 38d3874a0cf2cbfd5552d52eea99776cbd1e5b57 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 3855b4150037142435b5c1f4195e44c142785f1f ]
+
@@ -10,2 +11,0 @@
-Cc: stable@dpdk.org
-
@@ -20 +20 @@
-index c27f730c7..f15bcd976 100644
+index 94d19682e..2bb77b019 100644
@@ -51 +51 @@
-index 0603eaf25..7db022532 100644
+index 67a4ffb6b..1d3553cea 100644
@@ -54 +54 @@
-@@ -226,4 +226,6 @@ struct rte_mp_reply {
+@@ -229,4 +229,6 @@ struct rte_mp_reply {
@@ -61 +61 @@
-@@ -235,4 +237,6 @@ typedef int (*rte_mp_t)(const struct rte_mp_msg *msg, const void *peer);
+@@ -238,4 +240,6 @@ typedef int (*rte_mp_t)(const struct rte_mp_msg *msg, const void *peer);
@@ -68 +68 @@
-@@ -309,4 +313,7 @@ rte_mp_sendmsg(struct rte_mp_msg *msg);
+@@ -312,4 +316,7 @@ rte_mp_sendmsg(struct rte_mp_msg *msg);

  parent reply	other threads:[~2019-05-14 14:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-14 14:43 [dpdk-stable] patch 'net/mlx5: fix Multi-Packet RQ mempool name' " Kevin Traynor
2019-05-14 14:43 ` [dpdk-stable] patch 'net/mlx5: fix release of Rx queue object' " Kevin Traynor
2019-05-14 14:43 ` [dpdk-stable] patch 'doc: fix typo in mlx5 guide' " Kevin Traynor
2019-05-14 14:43 ` [dpdk-stable] patch 'ipc: unlock on failure' " Kevin Traynor
2019-05-14 14:43 ` [dpdk-stable] patch 'doc: fix typo in IPC guide' " Kevin Traynor
2019-05-14 14:43 ` Kevin Traynor [this message]
2019-05-14 14:43 ` [dpdk-stable] patch 'ipc: add warnings about correct API usage' " Kevin Traynor
2019-05-14 14:43 ` [dpdk-stable] patch 'power: fix cache line alignment' " Kevin Traynor
2019-05-14 14:43 ` [dpdk-stable] patch 'test/barrier: fix typo in log' " Kevin Traynor
2019-05-14 14:43 ` [dpdk-stable] patch 'test/barrier: fix allocation check' " Kevin Traynor
2019-05-14 14:43 ` [dpdk-stable] patch 'test/barrier: fix for Power CPUs' " Kevin Traynor
2019-05-14 14:43 ` [dpdk-stable] patch 'hash: fix position returned in free slots' " Kevin Traynor
2019-05-14 14:43 ` [dpdk-stable] patch 'hash: fix total entries count' " Kevin Traynor
2019-05-14 14:43 ` [dpdk-stable] patch 'examples/ipsec-secgw: fix build error log' " Kevin Traynor
2019-05-14 14:43 ` [dpdk-stable] patch 'devtools: fix symbol name in check " Kevin Traynor
2019-05-14 14:44 ` [dpdk-stable] patch 'devtools: accept experimental symbol promotion' " Kevin Traynor
2019-05-14 14:44 ` [dpdk-stable] patch 'devtools: fix check of symbol added as stable API' " Kevin Traynor
2019-05-14 14:44 ` [dpdk-stable] patch 'doc: fix formatting in testpmd guide' " Kevin Traynor
2019-05-14 14:44 ` [dpdk-stable] patch 'eventdev: fix Rx adapter event flush' " Kevin Traynor
2019-05-14 14:44 ` [dpdk-stable] patch 'event/dsw: ignore scheduling type for single-link queues' " Kevin Traynor
2019-05-14 14:44 ` [dpdk-stable] patch 'app/testpmd: fix offload flags after port config' " Kevin Traynor
2019-05-14 14:44 ` [dpdk-stable] patch 'doc: fix JSON interface for power sample' " Kevin Traynor

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=20190514144406.7526-6-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=anatoly.burakov@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).