From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B8AC1A0C4C for ; Mon, 12 Jul 2021 15:14:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A04764069D; Mon, 12 Jul 2021 15:14:28 +0200 (CEST) Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by mails.dpdk.org (Postfix) with ESMTP id 8C8C541177 for ; Mon, 12 Jul 2021 15:14:27 +0200 (CEST) Received: by mail-wr1-f49.google.com with SMTP id a13so25543715wrf.10 for ; Mon, 12 Jul 2021 06:14:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V7w0iRELWHZYNIdnvAGvtdLltvGybxABKA0qQMriYPU=; b=tNIY/i+QmSJoLgmOfeaIeJuSQuaZeBUQCjuvdGePbKeEqeev8rkH0FjWf8kBXO+xZ/ nkgJtrp6akjmRWudeHQwoAZY+MLRDsnVTYKO7+JDBQmJciWgdSfpRWIRXIUU1NlM95yE b+zYzSNo4Wf0WryrP2QFdhjaDeR5EHgRpbf7bL0foVO508li421AWNg3kOap9Pn5tFWd PVI7EvAQh57T+cTwRr0VksyWtF6zZWiDEFsbJDS9hxPmB4KyGvCb7nS6D79RVwuF78Nz yblT7owojqJXBtoTyK5JD6aHOxmOCvseHwDwR4pH50YX7b8R5US5D1oSirlyTR/5Ek0h KwJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V7w0iRELWHZYNIdnvAGvtdLltvGybxABKA0qQMriYPU=; b=XpBpC7KAkE+LOgaxJMcQuoUeAOdlWd/Og5jWRYkpd/+7RSdeF0SGjxbckuGArbuawu G0/liG9bwIhcm4YpaPExR8AxYBU0cHFCdIrtx/QmmIGcYHNGbfgNckLawvuLJSUTiJRm RdYTos6M7daSaPDEE6w13TLGgMBj83PFgbVECSAcq3PkvNDVidlxdgZDrftBpOfC/pHv kP/bK2QcG/p5ZUop5O4c9SkDRxGGLwBoijrzuY6U4fTR69ueuyf0Qi1Ryu9UNgmcJsPW gxCv3ltJjLnoYBzLEbs1+lSQlsm1frDKR42m8LY8kfSDoZ1BYWbeFMTOHzWBLy06NIaC oHEA== X-Gm-Message-State: AOAM532bRENyX6ldQxFVuhyTui70W/HnjgS63sgJERYdzmbmTovjQgc8 Bud/6+Ardj9eI74D88LnjOM= X-Google-Smtp-Source: ABdhPJyH1LPG5ag99LXb1QNH/08DqDdja3nf3GktamyuUWI084ptG53zPcepEFSFDrSDClUWHV/9zA== X-Received: by 2002:a05:6000:1d1:: with SMTP id t17mr52016968wrx.267.1626095667381; Mon, 12 Jul 2021 06:14:27 -0700 (PDT) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id o14sm14771425wmq.31.2021.07.12.06.14.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 06:14:26 -0700 (PDT) From: luca.boccassi@gmail.com To: David Marchand Cc: Owen Hilyard , Maxime Coquelin , dpdk stable Date: Mon, 12 Jul 2021 14:05:18 +0100 Message-Id: <20210712130551.2462159-83-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210712130551.2462159-1-luca.boccassi@gmail.com> References: <20210712130551.2462159-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'ipc: stop mp control thread on cleanup' has been queued to stable release 20.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 stable release 20.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/14/21. 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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/c3881a8282a8a7683c0912f003b5da5df2323393 Thanks. Luca Boccassi --- >From c3881a8282a8a7683c0912f003b5da5df2323393 Mon Sep 17 00:00:00 2001 From: David Marchand Date: Wed, 7 Jul 2021 13:02:29 +0200 Subject: [PATCH] ipc: stop mp control thread on cleanup [ upstream commit e7885281ded1dbda63dcf3f6eb3640131113a6eb ] When calling rte_eal_cleanup, the mp channel cleanup routine only sets mp_fd to -1 leaving the rte_mp_handle control thread running. This control thread can spew warnings on reading on an invalid fd. This is especially noticed with ASAN enabled. To handle this situation, set mp_fd to -1 to signal the control thread it should exit, but since this thread might be sleeping on the socket, cancel the thread too. Fixes: 85d6815fa6d0 ("eal: close multi-process socket during cleanup") Reported-by: Owen Hilyard Signed-off-by: David Marchand Reviewed-by: Maxime Coquelin --- lib/librte_eal/common/eal_common_proc.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c index dc4a2efa82..ebd0f6673b 100644 --- a/lib/librte_eal/common/eal_common_proc.c +++ b/lib/librte_eal/common/eal_common_proc.c @@ -35,6 +35,7 @@ #include "eal_internal_cfg.h" static int mp_fd = -1; +static pthread_t mp_handle_tid; static char mp_filter[PATH_MAX]; /* Filter for secondary process sockets */ static char mp_dir_path[PATH_MAX]; /* The directory path for all mp sockets */ static pthread_mutex_t mp_mutex_action = PTHREAD_MUTEX_INITIALIZER; @@ -383,7 +384,7 @@ mp_handle(void *arg __rte_unused) struct mp_msg_internal msg; struct sockaddr_un sa; - while (1) { + while (mp_fd >= 0) { if (read_msg(&msg, &sa) == 0) process_msg(&msg, &sa); } @@ -567,14 +568,11 @@ open_socket_fd(void) } static void -close_socket_fd(void) +close_socket_fd(int fd) { char path[PATH_MAX]; - if (mp_fd < 0) - return; - - close(mp_fd); + close(fd); create_socket_path(peer_name, path, sizeof(path)); unlink(path); } @@ -584,7 +582,6 @@ rte_mp_channel_init(void) { char path[PATH_MAX]; int dir_fd; - pthread_t mp_handle_tid; const struct internal_config *internal_conf = eal_get_internal_configuration(); @@ -645,7 +642,16 @@ rte_mp_channel_init(void) void rte_mp_channel_cleanup(void) { - close_socket_fd(); + int fd; + + if (mp_fd < 0) + return; + + fd = mp_fd; + mp_fd = -1; + pthread_cancel(mp_handle_tid); + pthread_join(mp_handle_tid, NULL); + close_socket_fd(fd); } /** -- 2.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-07-12 13:41:40.919562023 +0100 +++ 0083-ipc-stop-mp-control-thread-on-cleanup.patch 2021-07-12 13:41:36.702127027 +0100 @@ -1 +1 @@ -From e7885281ded1dbda63dcf3f6eb3640131113a6eb Mon Sep 17 00:00:00 2001 +From c3881a8282a8a7683c0912f003b5da5df2323393 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit e7885281ded1dbda63dcf3f6eb3640131113a6eb ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ - lib/eal/common/eal_common_proc.c | 22 ++++++++++++++-------- + lib/librte_eal/common/eal_common_proc.c | 22 ++++++++++++++-------- @@ -25 +26 @@ -diff --git a/lib/eal/common/eal_common_proc.c b/lib/eal/common/eal_common_proc.c +diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c @@ -27,2 +28,2 @@ ---- a/lib/eal/common/eal_common_proc.c -+++ b/lib/eal/common/eal_common_proc.c +--- a/lib/librte_eal/common/eal_common_proc.c ++++ b/lib/librte_eal/common/eal_common_proc.c