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 81712A04FD for ; Tue, 12 Jul 2022 21:23:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 78B2442684; Tue, 12 Jul 2022 21:23:56 +0200 (CEST) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by mails.dpdk.org (Postfix) with ESMTP id AF3C540F1A for ; Tue, 12 Jul 2022 21:23:53 +0200 (CEST) Received: by mail-wr1-f48.google.com with SMTP id r10so6381859wrv.4 for ; Tue, 12 Jul 2022 12:23:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qRgojSW76J4Sc2wHScSbAuE6Hy/AVvEnUUv7CZ14Eo8=; b=i7yFDvgSp0MkJO4e+5mBgS7nnqEq1DUa134ldtZCREsAA7HzC4lYSzwtosPVkZbMcZ H4NiS8CgqhrsaFjc6PkC3uiWrItw9Ne9/ul4nmD/No62lXHFGBSYhGnzB+OqtmsJoHMy toSzIKegLWZVR0n59dsKntvkv41+yplEcwTtw4k3+ItJxG6z/wpXwCU5b93ZYJ7UH5rf c80iNkFkS8i3wj6ZisP0uG8DnUiwgCMBWg9BP/c94G/mvkcutEqv+9vBbSkgMcnT5sVW i3nwWCO/ho21lGxXQ38KzHzs9gvvn3jfV7V91lhGMRt2kmS1P4JNUlhQltoydoSijxUr b0Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qRgojSW76J4Sc2wHScSbAuE6Hy/AVvEnUUv7CZ14Eo8=; b=xU0uyJiY+GAmfb1OQYwGnkr1Km+1fL6s60saHX31zPBs4388jKVRjMuevXt2CjeyNT Wu6IOPTMJ43XXS0bjnNXxyhVrconlp0B5Zw8d3bn83qKrwMrbUR5OSl3CkomybDeCxSt L/L1YZfRa29FaOa0x4AobN5IJANM7/GPogESx7kEvopwbNXbWJtKXzDH7oblUM1rUhXU r+DWWQFBZ/BT/BqJ5VV770oQpwuTt75veHE2DI5RfZEd87NJFxAUGMVVVSadDAyenaZp dwQsMQjnDh7r1vJ7bE6lk7n16f8yCoRrdYmusHTTxNHIwoGWRqyp76dtIMbuvyGzDLDZ Elww== X-Gm-Message-State: AJIora+9ngdpz2Sq+W9o8zrmaIaogGNT6R+fdwpsX6qb83mHpD/AaeEN XuUI8k0wxJ6S65kj/OSHMUA= X-Google-Smtp-Source: AGRyM1tmvfRqZpvolCCDFB0fnAZkEDD1FiyWl+cHlmePaImw/DqC8WMAdeJe+hHnGeYaLR5SKYd88g== X-Received: by 2002:adf:dd0d:0:b0:21d:666b:298e with SMTP id a13-20020adfdd0d000000b0021d666b298emr23848043wrm.412.1657653833205; Tue, 12 Jul 2022 12:23:53 -0700 (PDT) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id t123-20020a1c4681000000b003973c54bd69sm13859264wma.1.2022.07.12.12.23.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 12:23:52 -0700 (PDT) From: luca.boccassi@gmail.com To: David Marchand Cc: Maxime Coquelin , Matan Azrad , dpdk stable Subject: patch 'vdpa/mlx5: fix leak on event thread creation' has been queued to stable release 21.11.2 Date: Tue, 12 Jul 2022 20:23:45 +0100 Message-Id: <20220712192349.4174428-2-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220712192349.4174428-1-luca.boccassi@gmail.com> References: <20220706203506.3422496-31-luca.boccassi@gmail.com> <20220712192349.4174428-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Hi, FYI, your patch has been queued to stable release 21.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 07/14/22. 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 This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/dbe68f09585c4f671abb49f6ceee451a12b47c30 Thanks. Luca Boccassi --- >From dbe68f09585c4f671abb49f6ceee451a12b47c30 Mon Sep 17 00:00:00 2001 From: David Marchand Date: Mon, 20 Jun 2022 15:10:44 +0200 Subject: [PATCH] vdpa/mlx5: fix leak on event thread creation [ upstream commit ea2810fc215dbf748afdaa0e65df50427d2bc058 ] As stated in the manual, pthread_attr_init return value should be checked. Besides, a pthread_attr_t should be destroyed once unused. In practice, we may have no leak (from what I read in glibc current code), but this may change in the future. Stick to a correct use of the API. Fixes: 5cf3fd3af4df ("vdpa/mlx5: add CPU core parameter to bind polling thread") Signed-off-by: David Marchand Reviewed-by: Maxime Coquelin Acked-by: Matan Azrad --- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 30 +++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c index f8d910b33f..ecad139768 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c @@ -460,6 +460,7 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv) { int ret; rte_cpuset_t cpuset; + pthread_attr_t *attrp = NULL; pthread_attr_t attr; char name[16]; const struct sched_param sp = { @@ -469,22 +470,27 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv) if (!priv->eventc) /* All virtqs are in poll mode. */ return 0; - pthread_attr_init(&attr); - ret = pthread_attr_setschedpolicy(&attr, SCHED_RR); + ret = pthread_attr_init(&attr); + if (ret != 0) { + DRV_LOG(ERR, "Failed to initialize thread attributes"); + goto out; + } + attrp = &attr; + ret = pthread_attr_setschedpolicy(attrp, SCHED_RR); if (ret) { DRV_LOG(ERR, "Failed to set thread sched policy = RR."); - return -1; + goto out; } - ret = pthread_attr_setschedparam(&attr, &sp); + ret = pthread_attr_setschedparam(attrp, &sp); if (ret) { DRV_LOG(ERR, "Failed to set thread priority."); - return -1; + goto out; } - ret = pthread_create(&priv->timer_tid, &attr, mlx5_vdpa_event_handle, + ret = pthread_create(&priv->timer_tid, attrp, mlx5_vdpa_event_handle, (void *)priv); if (ret) { DRV_LOG(ERR, "Failed to create timer thread."); - return -1; + goto out; } CPU_ZERO(&cpuset); if (priv->event_core != -1) @@ -494,12 +500,16 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv) ret = pthread_setaffinity_np(priv->timer_tid, sizeof(cpuset), &cpuset); if (ret) { DRV_LOG(ERR, "Failed to set thread affinity."); - return -1; + goto out; } snprintf(name, sizeof(name), "vDPA-mlx5-%d", priv->vid); - ret = rte_thread_setname(priv->timer_tid, name); - if (ret) + if (rte_thread_setname(priv->timer_tid, name) != 0) DRV_LOG(DEBUG, "Cannot set timer thread name."); +out: + if (attrp != NULL) + pthread_attr_destroy(attrp); + if (ret != 0) + return -1; return 0; } -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-07-12 20:22:33.785142009 +0100 +++ 0002-vdpa-mlx5-fix-leak-on-event-thread-creation.patch 2022-07-12 20:22:33.709247162 +0100 @@ -1 +1 @@ -From ea2810fc215dbf748afdaa0e65df50427d2bc058 Mon Sep 17 00:00:00 2001 +From dbe68f09585c4f671abb49f6ceee451a12b47c30 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit ea2810fc215dbf748afdaa0e65df50427d2bc058 ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -25 +26 @@ -index 22f0920c88..4d819763d8 100644 +index f8d910b33f..ecad139768 100644 @@ -28 +29 @@ -@@ -504,6 +504,7 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv) +@@ -460,6 +460,7 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv) @@ -36 +37 @@ -@@ -513,22 +514,27 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv) +@@ -469,22 +470,27 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv) @@ -71 +72 @@ -@@ -538,12 +544,16 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv) +@@ -494,12 +500,16 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)