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 C514041D8D for ; Mon, 27 Feb 2023 08:09:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C047E410DC; Mon, 27 Feb 2023 08:09:47 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12hn2223.outbound.protection.outlook.com [52.100.166.223]) by mails.dpdk.org (Postfix) with ESMTP id CDC9540A84 for ; Mon, 27 Feb 2023 08:09:46 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NZ/wU0xER6LpMpRnJQQv5ICN3GK5yt+lzDXFzMXodwtdTQmfJy8BPrygM2kxyCmEbrmGdp8EEEPBJl3alpAkX3ZHszamWD5848KaU/9NDk1q3c6prQDIug8uBvAzAN292qsY/B8mUy+NhWDD+F/DW1WVx//x2cZgjHPrlFOHUR1z78Dlu9wx1ZyrELVYifipJsYw27BlzcWSWhPawxde4/BZSywu7ykHfrvrdv1NO4sCOjRG2xIFMAgDgOmCRGKFxPFgFs/5ra7LXsBcA/mjZhLObaYM8piJxg0cc4DQ730mt/xacWcxBuYKe2SN2RO7EHbkRLv5+UrVI8BTVE/pUg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Gl/I7x1lAhevubfviHwm7jxD+PrRrjFb8PRlvwFX65s=; b=TITYAKCuzpKUmVFv3Wvpyllth+WvoI3KGpl1YUb6/v0x9zB509tagZMj0mO2Zt1SigvEFqd3FttEnx+vUN/oV5xaDyb6Ug4f0EIHCXIyvyp6cJs3DnUpN0hqL7tdsaMOKONMnErVexSr9DWjAODgxvMEhlZBfgQZm5YCgz1V55kWP1I/Qts2OUCKnZnPHs2pADQMC5Hfkv69mWtAvrWKiPXVTZDbkA4Zh81/ZyOYjIdwPdQJ2FCBgrbcV/EGOyT1X8u0HKBwlI47WHCn9nlWISuZP8SkvLCYheYy2czB3EqxcMT4kHIiYwcAUZnW41PNSVVCJG+JhUkM6+jVONaoyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject 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=Gl/I7x1lAhevubfviHwm7jxD+PrRrjFb8PRlvwFX65s=; b=UlPAW7+cqVyZmnDT9aTio+bfZvX57RITiNDmInwr+w+elY4HIfn5hxlNyItRoBgk4ZLiWwjrQj9ieaIjDayotSDGBdp2/jEauCQSaSeUdVCivHeYvWNdr26KQDIkMUMEDIVpFyJnyg/1PrhD0kXr22iOM0s+OT7EALg2t98fnIy6sSHN5+t6/JRj0qoIWeEVRHTDPMQpssYqdbfCXWIcrjLaPySojWZHXDwVT04umZD+2+SUUY/iuS+cCPwsRpCeIBpD4kIKEg84hDj3vyUKt0y6daX801H0sAyqEhi1qqEzS6uVZyrrSzkE7HEwlmu70SqLEA1IDeN++YlZi5oWKQ== Received: from DS7PR06CA0037.namprd06.prod.outlook.com (2603:10b6:8:54::12) by DM4PR12MB5769.namprd12.prod.outlook.com (2603:10b6:8:60::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.29; Mon, 27 Feb 2023 07:09:45 +0000 Received: from DM6NAM11FT028.eop-nam11.prod.protection.outlook.com (2603:10b6:8:54:cafe::68) by DS7PR06CA0037.outlook.office365.com (2603:10b6:8:54::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.29 via Frontend Transport; Mon, 27 Feb 2023 07:09:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DM6NAM11FT028.mail.protection.outlook.com (10.13.173.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.16 via Frontend Transport; Mon, 27 Feb 2023 07:09:44 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Sun, 26 Feb 2023 23:09:34 -0800 Received: from nvidia.com (10.126.230.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Sun, 26 Feb 2023 23:09:31 -0800 From: Xueming Li To: Ashish Sadanandan CC: John Levon , Julien Meunier , dpdk stable Subject: patch 'eal/linux: fix hugetlbfs sub-directories discovery' has been queued to stable release 22.11.2 Date: Mon, 27 Feb 2023 14:59:47 +0800 Message-ID: <20230227070107.15664-79-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230227070107.15664-1-xuemingl@nvidia.com> References: <20230227062349.13764-1-xuemingl@nvidia.com> <20230227070107.15664-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT028:EE_|DM4PR12MB5769:EE_ X-MS-Office365-Filtering-Correlation-Id: aba5277a-2f24-46b6-dd71-08db18919ae3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DlDdco9m1aYfV7WKD/jl7HqRG9kHGIYc+bA0UfuClvXH7JBiD/5iNaSW7ab1ODw3NEPi1kr9yiPRXhTyQegxffA9R3ZLl7/M2TW4+5qFz5Ab4tLxhNjnSP9vbS1ncPnL5Jqxs0PErTO0mg9bK8iM6wC+tKIhXtvpSQsBHUEAMTUu9tonCFLQLBJvpqZzQNFHfenaGKDU99hH7RTTSV8DpzlACpWtDlzy3Pgt44Yp9XDVfev6SzM3e/eJ1eafPck6ss8Fr504QLJ1oDHjAm7R2WLyIUXAWf3MKtTfRph1tOSIt8j/pKKVFV2ltEBcsPYtbjXAU3qGY/mOugbHeIxjz2b1TQ7MfCQapgAA9BFauotbwYw/0jsllJ9m81FXsRGLc/UABBQxlL2lErF6PqvrE8mhAXxRCUhB38tQbnrjS+9opgnPEOgWOiPDm1TixA0cj5GswCmsS5okDvM1/qpddDDAMt9bHbAZpnBEoJZH1Oe09nEVfasjMtgwvK+grKLycn+r7tOyhvzJDFfkx0X+IoXsBXUfupJxM26vjKLjclb+7//r3Fc4YjL/GTD+T0NUx0RorK6tGfbp998MijVR5/ukPrfsVdiFfV65KQiVxRyN6XvUO9qukNIISPo+hF5+Jpnut9+7d7BuNZNdCk9JGUWNzcYAu2mEnzqpohuZJvTDJ0jbXyuziJVeCDU/naQrhesvbC5qvaEg9/FUVHMvJKFNEZndf10826+IpgS4m56nSe3kYhLsLEnhob+KUvnG15ph+3uWY/Llw1nthmdaPmgEyTOGCpY4Y/y1W+Knck3D8u8U9wOhd535XwV1T6LrX5ueFlng/+Zj37IpDW9/mFP1SWeDnfnj8ML2OtNbdjY= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(136003)(39860400002)(396003)(376002)(346002)(5400799012)(451199018)(36840700001)(46966006)(40470700004)(40460700003)(36756003)(54906003)(316002)(966005)(478600001)(8936002)(5660300002)(7696005)(2906002)(8676002)(70206006)(70586007)(6916009)(4326008)(41300700001)(7636003)(82740400003)(36860700001)(34020700004)(356005)(86362001)(55016003)(40480700001)(6286002)(16526019)(186003)(26005)(2616005)(6666004)(53546011)(82310400005)(1076003)(83380400001)(336012)(47076005)(426003)(12100799018); DIR:OUT; SFP:1501; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2023 07:09:44.9287 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aba5277a-2f24-46b6-dd71-08db18919ae3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT028.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5769 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 22.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 03/01/23. 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://git.dpdk.org/dpdk-stable/log/?h=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=acacb53810bc6949ab5517b75e947cdd6e482e06 Thanks. Xueming Li --- >From acacb53810bc6949ab5517b75e947cdd6e482e06 Mon Sep 17 00:00:00 2001 From: Ashish Sadanandan Date: Sun, 8 Jan 2023 18:52:39 -0700 Subject: [PATCH] eal/linux: fix hugetlbfs sub-directories discovery Cc: Xueming Li [ upstream commit f9d1ef28619a2dd16cafca36f5a5ca6d3315c5fc ] The code added for allowing --huge-dir to specify hugetlbfs sub-directories has a bug where it incorrectly matches mounts that contain a prefix of the specified --huge-dir. Consider --huge-dir=/dev/hugepages1G is passed to rte_eal_init. Given the following hugetlbfs mounts $ mount | grep hugetlbfs hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M) hugetlbfs on /dev/hugepages1G type hugetlbfs (rw,relatime,pagesize=1024M) hugetlbfs on /mnt/huge type hugetlbfs (rw,relatime,pagesize=2M) get_hugepage_dir is first called with hugepage_sz=2097152. While iterating over all mount points, /dev/hugepages is incorrectly determined to be a match because it's a prefix of --huge-dir. The caller then obtains an exclusive lock on --huge-dir. In the next call to get_hugepage_dir, hugepage_sz=1073741824. This call correctly determines /dev/hugepages1G is a match. The caller again attempts to obtain an exclusive lock on --huge-dir and deadlocks because it's already holding a lock. This has been corrected by ensuring any matched mount point is either an exact match or a parent path of --huge-dir. Fixes: 24d5a1ce6b85 ("eal/linux: allow hugetlbfs sub-directories") Signed-off-by: Ashish Sadanandan Reviewed-by: John Levon Tested-by: Julien Meunier --- lib/eal/linux/eal_hugepage_info.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/eal/linux/eal_hugepage_info.c b/lib/eal/linux/eal_hugepage_info.c index 24411d9c5b..581d9dfc91 100644 --- a/lib/eal/linux/eal_hugepage_info.c +++ b/lib/eal/linux/eal_hugepage_info.c @@ -214,6 +214,8 @@ get_hugepage_dir(uint64_t hugepage_sz, char *hugedir, int len) char buf[BUFSIZ]; const struct internal_config *internal_conf = eal_get_internal_configuration(); + const size_t hugepage_dir_len = (internal_conf->hugepage_dir != NULL) ? + strlen(internal_conf->hugepage_dir) : 0; struct stat st; /* @@ -233,6 +235,7 @@ get_hugepage_dir(uint64_t hugepage_sz, char *hugedir, int len) while (fgets(buf, sizeof(buf), fd)){ const char *pagesz_str; + size_t mountpt_len = 0; if (rte_strsplit(buf, sizeof(buf), splitstr, _FIELDNAME_MAX, split_tok) != _FIELDNAME_MAX) { @@ -265,12 +268,16 @@ get_hugepage_dir(uint64_t hugepage_sz, char *hugedir, int len) break; } + mountpt_len = strlen(splitstr[MOUNTPT]); + /* - * Ignore any mount that doesn't contain the --huge-dir - * directory. + * Ignore any mount that doesn't contain the --huge-dir directory + * or where mount point is not a parent path of --huge-dir */ if (strncmp(internal_conf->hugepage_dir, splitstr[MOUNTPT], - strlen(splitstr[MOUNTPT])) != 0) { + mountpt_len) != 0 || + (hugepage_dir_len > mountpt_len && + internal_conf->hugepage_dir[mountpt_len] != '/')) { continue; } @@ -278,7 +285,7 @@ get_hugepage_dir(uint64_t hugepage_sz, char *hugedir, int len) * We found a match, but only prefer it if it's a longer match * (so /mnt/1 is preferred over /mnt for matching /mnt/1/2)). */ - if (strlen(splitstr[MOUNTPT]) > strlen(found)) + if (mountpt_len > strlen(found)) strlcpy(found, splitstr[MOUNTPT], len); } /* end while fgets */ -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-02-27 14:08:43.458882900 +0800 +++ 0080-eal-linux-fix-hugetlbfs-sub-directories-discovery.patch 2023-02-27 14:08:40.799237000 +0800 @@ -1 +1 @@ -From f9d1ef28619a2dd16cafca36f5a5ca6d3315c5fc Mon Sep 17 00:00:00 2001 +From acacb53810bc6949ab5517b75e947cdd6e482e06 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit f9d1ef28619a2dd16cafca36f5a5ca6d3315c5fc ] @@ -32 +34,0 @@ -Cc: stable@dpdk.org