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 7ECA8A0A0E for ; Mon, 10 May 2021 18:16:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 792AA40140; Mon, 10 May 2021 18:16:54 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam07on2059.outbound.protection.outlook.com [40.107.95.59]) by mails.dpdk.org (Postfix) with ESMTP id 2975740140 for ; Mon, 10 May 2021 18:16:53 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z3RUb75NNu3OiSOCuHVIQaFILwp4t2/MnUTyNKNibMsA59Bmw6RCTGUYZJOC50Y+JgskqM6dz2pqBDFXWWD3uahks62/ZhoOYrIkC7rbw7ZNqbLYya/c23EHUZpjdNAOC3/9OnBY3/Ex22ia8YIIujCgNangKQKcrZ+A8x2IEsCW+Swwnic/4XUiSbpwVFW+NoEgqjoA5l2mUi4Opb7nEPL8hALEv+GNlFgpVeU2OOD0AJbZGwJunuR+ebVnYNiYBn1Erx998SwFw1sz37UoCkRkI8REsNxhL0xuoFlh/VyYIm2LSVBnHBD2+5KQTFHRam7ds+KwTixwZBolAF7AMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=67bceG0T8V26sFIEpLe6Lj8SIxEg1o1F60RiYVvoL54=; b=HnKlTGgnuk5jmuEjR+HlwcGAeLoer4INng6P8M1W20eeAU3M7stYq7XGlov03wZCDdcE8Yh8r+aR5hSIV95vprx5UgZBQL/SlqJGVO68eAGnmitLoVMcX2HZ1ocdR1U8k5x0yuaaJJF3GOCs/jSPwarD5P9KAYBeysvNKEvl2p34e/q6tuPLgRSXOgd6zkUsAv2o0JlsxWZjoKgdqB8av5mwMTq7zBCsJA7UdKURl4iOsyfPd69tJZ7Owr73MgRb0mRoxxNTtBAcxP8Vzao30YYg7LaoyP0fTEK1u4Ye3SzsRYBNkk7lf5aoYog+/Al1Fq4BbKhQ9lHFerp4JPhMKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=arm.com smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=67bceG0T8V26sFIEpLe6Lj8SIxEg1o1F60RiYVvoL54=; b=VPj0hbu/g0rl8jH/yGaeOuWgkJoxwgSfMarmk2r38t2b685vzFcrDzMQAG26SIctvLrz7uf9gcYdnUkaAXFiZ4tM7rhPOxSQFMFBMJQxnoKI0LW9tOLWdNF+LW8uNpeYIX24RDp89X9rhDX0myeIc4XVYgSXnhcz6d01h4sYXcmsGKdMLJtJY9vKnEqVxi7L2lQyQb8tm+gkudRy4+oiYhIVAimyGz3shNLsLKWwkAz2U8/XLkegIQlsM+JCtbC3MVi1kAgHEnLaNTN3XG9D0pBPW2dExQ3Pvk+vK1VNMxdfN0EFg83H4R5flC0YU0SCUp27/nWhN5uBx6Aw7VLmuA== Received: from DM5PR07CA0134.namprd07.prod.outlook.com (2603:10b6:3:13e::24) by DM6PR12MB4435.namprd12.prod.outlook.com (2603:10b6:5:2a6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24; Mon, 10 May 2021 16:16:52 +0000 Received: from DM6NAM11FT019.eop-nam11.prod.protection.outlook.com (2603:10b6:3:13e:cafe::f9) by DM5PR07CA0134.outlook.office365.com (2603:10b6:3:13e::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.31 via Frontend Transport; Mon, 10 May 2021 16:16:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT019.mail.protection.outlook.com (10.13.172.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Mon, 10 May 2021 16:16:51 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 16:16:49 +0000 From: Xueming Li To: Luc Pelletier CC: Luca Boccassi , Olivier Matz , Honnappa Nagarahalli , dpdk stable Date: Tue, 11 May 2021 00:01:25 +0800 Message-ID: <20210510160258.30982-136-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210510160258.30982-1-xuemingl@nvidia.com> References: <20210510160258.30982-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 765b7250-d53c-4f89-b66b-08d913cf0561 X-MS-TrafficTypeDiagnostic: DM6PR12MB4435: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SjBmeTwpvNWQfCPO6Ul8sjnCn5FzK22Gw58j/xlz3EoYRIyaz+hN//Xo+ej/KXx5aYT1y6pIVzg20qkIwdPvGm7/dYZu/FLe7jE4HcSSIT/EbOrH2p5qRbF3kGorsjQOg8T5Sk2Ep7EaszFWCXxinEwV/SdB3x6KxNrZeAosGVUmqj7AEs81GQx5ZFmrpGcCoFiiIew1E6+8SpceIJOnRxbr7jgF7jtq5C5aIzRJc9AGhbbOdrIuLww2B47POP9iQqWmWoeNCOpxQwE50Te7P2kCQqN7vXNGw1NziHtcuyr6dkJ5/+3sj5Ffsm0gXfQ5UiR5gXqaFKehjOMYzIFQxjok0NGmrQD4nPZ59KdQq8rGMfTcfyic1eEwsBcZ2bs++Z6FeO/MSZlUUPbtx3DriH6US7TwOkfvcHvp2xJP/jkuHz8UjAHxdgKCjLPQEWXbWY4SKn7yHp6s7CvfcLSspSzI6FHlPI26uo7OHAB+rAR0VkL9RHfZSxV4fDkE9TmrLHpc4RcL/Zx5NNwpGy36c2UnZ2JlpM2lsETOQqLz+IOlgUr2XlsMQgbWH82lIUKV3uCxfcUKNIBJKZc010mgVUwiK0fY18U3v0S64vd4hjoSVnw0J9u491x4l8vQSPu5SAT5+MjbMcxTVDG111nQ6Y0z5erYkhRQBfd5Op+WzdKRLF00uUgrAfOJWGSynzIo+jDzbjKXhoqtDWGD3uzJ3lze4EBxcs3Wx1m7v5ddTeUywkg7LVrMCuCWeVb3Z3Fd99dRUfyuIKDjMAqcxsF0ig== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(39860400002)(396003)(136003)(346002)(376002)(36840700001)(46966006)(53546011)(356005)(6916009)(316002)(36860700001)(4326008)(6286002)(7696005)(2906002)(36906005)(5660300002)(83380400001)(2616005)(54906003)(16526019)(82740400003)(8676002)(26005)(47076005)(55016002)(70586007)(70206006)(966005)(6666004)(36756003)(336012)(478600001)(8936002)(86362001)(1076003)(7636003)(426003)(82310400003)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2021 16:16:51.8004 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 765b7250-d53c-4f89-b66b-08d913cf0561 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT019.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4435 Subject: [dpdk-stable] patch 'eal: fix hang in control thread creation' has been queued to stable release 20.11.2 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.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/12/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/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/1324beafbae000e862df621c2378fa3b2631f98c Thanks. Xueming Li --- >From 1324beafbae000e862df621c2378fa3b2631f98c Mon Sep 17 00:00:00 2001 From: Luc Pelletier Date: Wed, 7 Apr 2021 16:16:06 -0400 Subject: [PATCH] eal: fix hang in control thread creation Cc: Luca Boccassi [ upstream commit af68c1d699be6c369e296b775bdbf13ae18b79cc ] The affinity of a control thread is set after it has been launched. If setting the affinity fails, pthread_cancel is called followed by a call to pthread_join, which can hang forever if the thread's start routine doesn't call a pthread cancellation point. This patch modifies the logic so that the control thread exits gracefully if the affinity cannot be set successfully and removes the call to pthread_cancel. Fixes: 6383d2642b62 ("eal: set name when creating a control thread") Signed-off-by: Luc Pelletier Acked-by: Olivier Matz Reviewed-by: Honnappa Nagarahalli --- lib/librte_eal/common/eal_common_thread.c | 29 +++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c index 3347e91bf2..03dbcd9e86 100644 --- a/lib/librte_eal/common/eal_common_thread.c +++ b/lib/librte_eal/common/eal_common_thread.c @@ -187,14 +187,18 @@ static void *ctrl_thread_init(void *arg) eal_get_internal_configuration(); rte_cpuset_t *cpuset = &internal_conf->ctrl_cpuset; struct rte_thread_ctrl_params *params = arg; - void *(*start_routine)(void *) = params->start_routine; + void *(*start_routine)(void *); void *routine_arg = params->arg; __rte_thread_init(rte_lcore_id(), cpuset); pthread_barrier_wait(¶ms->configured); + start_routine = params->start_routine; ctrl_params_free(params); + if (start_routine == NULL) + return NULL; + return start_routine(routine_arg); } @@ -218,14 +222,12 @@ rte_ctrl_thread_create(pthread_t *thread, const char *name, params->refcnt = 2; ret = pthread_barrier_init(¶ms->configured, NULL, 2); - if (ret != 0) { - free(params); - return -ret; - } + if (ret != 0) + goto fail_no_barrier; ret = pthread_create(thread, attr, ctrl_thread_init, (void *)params); if (ret != 0) - goto fail; + goto fail_with_barrier; if (name != NULL) { ret = rte_thread_setname(*thread, name); @@ -236,19 +238,22 @@ rte_ctrl_thread_create(pthread_t *thread, const char *name, ret = pthread_setaffinity_np(*thread, sizeof(*cpuset), cpuset); if (ret != 0) - goto fail_cancel; + params->start_routine = NULL; pthread_barrier_wait(¶ms->configured); ctrl_params_free(params); - return 0; + if (ret != 0) + /* start_routine has been set to NULL above; */ + /* ctrl thread will exit immediately */ + pthread_join(*thread, NULL); -fail_cancel: - pthread_cancel(*thread); - pthread_join(*thread, NULL); + return -ret; -fail: +fail_with_barrier: pthread_barrier_destroy(¶ms->configured); + +fail_no_barrier: free(params); return -ret; -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-05-10 23:59:30.107955900 +0800 +++ 0137-eal-fix-hang-in-control-thread-creation.patch 2021-05-10 23:59:26.530000000 +0800 @@ -1 +1 @@ -From af68c1d699be6c369e296b775bdbf13ae18b79cc Mon Sep 17 00:00:00 2001 +From 1324beafbae000e862df621c2378fa3b2631f98c Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Luca Boccassi + +[ upstream commit af68c1d699be6c369e296b775bdbf13ae18b79cc ] @@ -16 +18,0 @@ -Cc: stable@dpdk.org