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 BC76B42EC6 for ; Thu, 20 Jul 2023 07:20:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B376C41143; Thu, 20 Jul 2023 07:20:07 +0200 (CEST) Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by mails.dpdk.org (Postfix) with ESMTP id 3C6E340223 for ; Tue, 18 Jul 2023 03:01:02 +0200 (CEST) Received: by mail-qk1-f173.google.com with SMTP id af79cd13be357-7679d444210so419978485a.2 for ; Mon, 17 Jul 2023 18:01:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=threatblockr-com.20221208.gappssmtp.com; s=20221208; t=1689642061; x=1692234061; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ftU5jVtwz+bAV2jqa2OHXPNHnR/6lrblDoaxG5GV5xA=; b=jaWT68oPT0AevaEcMKVHMpn2ILjAM46ngt6Mh55zqcVCsjoZR2WKuzZucCssiXvS06 3Y7AHnbU/+dCQ0k2oTa0uxR7vBX7Jn/BqGvW9Qp9tuYJQrzWOZrBSXcfe/B+ehN8BwvZ qAyelImRfuVOTLZJcGArTynEQQHOGOWu5PKWsQOt3Iz7zObHhlvdDqMvG7K10E/KeLT3 Pbm42L9Sh+ziaoxhJcQCL75gwbzZxgosqo4fiAFfTRAAgnYw3Qxe5brnBuCI32XnTgld TDF0uCg5Ou8yqdXvsI8+RIxohPmxvhLM4G4cTk1XruT2ROTQVXiSh/DaBA3YEUwsKJEb ezrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689642061; x=1692234061; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ftU5jVtwz+bAV2jqa2OHXPNHnR/6lrblDoaxG5GV5xA=; b=fcP0jLmhVrx29gD0MEJ0x9Khiucpzg1owZeiD0K6+WjQvFt/2fcLRa9Y44lyGQ+/So y0LNTk09lZ8WJZm7k3B+KUSls4c5SdpY3nFYAlWMfQgtTvQ7kUK1Jdhoaoup+VzepFpe RvsI5Xisdsgpe3IW+RQw0Li00EYYqXyWyc2/XFTmV+eP52MoRGjFmYjb8iPPCgDC+ICa clJe4dc+W8R8bcPLnpDMVQRZ/++6OW4Rbf1o93yPJIiWeyveMiap0Og9JfuHEjQPTWji SRN0m7czJJd8VIyAzBowDvER8xx4MhypmpptrukJ6Hsq8oExXw/7lVOz4PvCjzE+EcKG AuBA== X-Gm-Message-State: ABy/qLZnt5ZSltxxxrgQwI47AIqpnApbZ2RGgZhMFFHPrF5WefZt//rv w19j7NHNaaiuf3+W4YqKFaGyUg== X-Google-Smtp-Source: APBJJlEDrHtTs4XIP2D6ZtQeAgI32SRavrjngmH5feY9V9QZluL+POPU2kGv3+0gyWoyf38E0ndA7w== X-Received: by 2002:a05:620a:2950:b0:75e:d895:6a46 with SMTP id n16-20020a05620a295000b0075ed8956a46mr14529037qkp.44.1689642061514; Mon, 17 Jul 2023 18:01:01 -0700 (PDT) Received: from localhost.localdomain (dyn-170-246-97.myactv.net. [24.170.246.97]) by smtp.gmail.com with ESMTPSA id s2-20020a05620a030200b0076814f80d5asm238610qkm.4.2023.07.17.18.01.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 18:01:01 -0700 (PDT) From: Jonathan Erb To: Thomas Monjalon , Anatoly Burakov Cc: dev@dpdk.org, Jonathan Erb , stable@dpdk.org Subject: [PATCH] eal/linux: prevent deadlocks on rte init and cleanup Date: Mon, 17 Jul 2023 21:00:46 -0400 Message-Id: <20230718010047.456679-1-jonathan.erb@threatblockr.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Thu, 20 Jul 2023 07:20:06 +0200 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 Resolves a deadlock that can occur when multiple secondary processes are starting and stopping. A deadlock can occur because eal_memalloc_init() is taking a second unnecessary read lock. If another DPDK process that is terminating enters rte_eal_memory_detach() and acquires a write lock wait state before the starting process can acquire it's second read lock then no process will be able to proceed. Cc: stable@dpdk.org Signed-off-by: Jonathan Erb --- .mailmap | 2 +- lib/eal/linux/eal_memalloc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.mailmap b/.mailmap index 6eccf0c555..a64bfcf1d2 100644 --- a/.mailmap +++ b/.mailmap @@ -663,7 +663,7 @@ John OLoughlin John Ousterhout John W. Linville Jonas Pfefferle -Jonathan Erb +Jonathan Erb Jon DeVree Jon Loeliger Joongi Kim diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c index f8b1588cae..a34f1cf2f9 100644 --- a/lib/eal/linux/eal_memalloc.c +++ b/lib/eal/linux/eal_memalloc.c @@ -1740,7 +1740,7 @@ eal_memalloc_init(void) eal_get_internal_configuration(); if (rte_eal_process_type() == RTE_PROC_SECONDARY) - if (rte_memseg_list_walk(secondary_msl_create_walk, NULL) < 0) + if (rte_memseg_list_walk_thread_unsafe(secondary_msl_create_walk, NULL) < 0) return -1; if (rte_eal_process_type() == RTE_PROC_PRIMARY && internal_conf->in_memory) { @@ -1778,7 +1778,7 @@ eal_memalloc_init(void) } /* initialize all of the fd lists */ - if (rte_memseg_list_walk(fd_list_create_walk, NULL)) + if (rte_memseg_list_walk_thread_unsafe(fd_list_create_walk, NULL)) return -1; return 0; } -- 2.34.1