From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 9ABF6A00E6 for ; Tue, 14 May 2019 16:44:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 917385B2A; Tue, 14 May 2019 16:44:37 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 1F2865B2A for ; Tue, 14 May 2019 16:44:36 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8480AC05E75A; Tue, 14 May 2019 14:44:34 +0000 (UTC) Received: from rh.redhat.com (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id A32E6608E1; Tue, 14 May 2019 14:44:32 +0000 (UTC) From: Kevin Traynor To: Anatoly Burakov Cc: dpdk stable Date: Tue, 14 May 2019 15:43:50 +0100 Message-Id: <20190514144406.7526-6-ktraynor@redhat.com> In-Reply-To: <20190514144406.7526-1-ktraynor@redhat.com> References: <20190514144406.7526-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 14 May 2019 14:44:34 +0000 (UTC) Subject: [dpdk-stable] patch 'ipc: add warnings about not using IPC with memory API' has been queued to LTS release 18.11.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 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 --- 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 ` 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);