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 C93E4A034F for ; Wed, 10 Nov 2021 07:55:00 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C3095410F2; Wed, 10 Nov 2021 07:55:00 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2064.outbound.protection.outlook.com [40.107.100.64]) by mails.dpdk.org (Postfix) with ESMTP id CC287410FE for ; Wed, 10 Nov 2021 07:54:58 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BmIedGLiVyq0SiKsmx9+lsPIweIBbHGeTf6PQMfXfPRvctscOdW5XkFiw9VVeoSVuYwqmWf6WB+eq3zr51Bw6mDmoleEOte07dW9TjPtkOiYgANAjRk+kwALWyU2+BTSdcdFb4/9fmY2QCn1XuoiMc4oi5wRpUYl2aOxeKXbGUKstLa5BM8AeXqZrxkZHBvJTldzy7z49blDKYmRgLELeRf8/XHNHy5UP/dxByt0hDrm/Xhq6CyWw+5TXdRpVjKy672NzhmBwSbA15j5cjT20zA1Szd3OgJcwFYLWC/AgQfXintLZio0Wu0x0caaZcw2e5SWdntRz0JYH0EjJ/eeLg== 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=EFc+KftQLN0gckBoPiO8k9HPpQSuoDUBQOimfcdh7LU=; b=gIT76zGimsmj4+304u8BCYuftznnqkrAhfPYlf3qhKM5mhzaHA/J8+jQos48s+CMHvYvGm7anRbdc7a2wN68Qf+qYFOXTxogfAqO6VkVUfaTlh7oWt3ZqfrV/he1wK2jiXepBEMsZVWrcHJpBRwqCV5SUOGN7LhEIxR4q9rC1kOKttSqcZWmuUkxddmOzK2j7kjkpl43z7dQlaXTClTZM+0Xu1SXyPD6aSNjWv4g141qDFEFy5+HFiwncWQELTZRCn3eHBTJT+nrUpZJT8itDALOtJGInmAskq8t1p1XHAVWRY14bAoG3/IqDZqCxRFpgFTjvCIAQabH2NaHzHsF4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=EFc+KftQLN0gckBoPiO8k9HPpQSuoDUBQOimfcdh7LU=; b=i+b1qG8z0dwQQgFGQDUNZPYT+YcIm2G4hAWZhD5EHaL2y/05FLQq9Yaiwq5Eh+IYdX6SShxEYYYY3Vas2emfNgorUGRXw+potj6Sprjw5iKjEzwgdrW9EBOhIoWtkCKZp3xhXbn127GcBidPtdWg88L6mBWzvYhue4G+jvyV7WJ0Lt2mhX06D4tOmiLHfylR5ERpK5y5+M6BCSMl2lePx8Z5LmcjA8FbrdHSHWxHeLDGVYk4G8+ek7vDT5JUHJRLm52/cVyTOwbTqSza8Axo1ZWoQITcZbbqLCZFefVc1Dl1VckPS+KYyKwo4Ag7S8SiEBe0g6n81I4XxUW6cacCxA== Received: from DS7PR03CA0004.namprd03.prod.outlook.com (2603:10b6:5:3b8::9) by BY5PR12MB4004.namprd12.prod.outlook.com (2603:10b6:a03:1a8::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10; Wed, 10 Nov 2021 06:54:56 +0000 Received: from DM6NAM11FT017.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b8:cafe::ae) by DS7PR03CA0004.outlook.office365.com (2603:10b6:5:3b8::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10 via Frontend Transport; Wed, 10 Nov 2021 06:54:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; 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 DM6NAM11FT017.mail.protection.outlook.com (10.13.172.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Wed, 10 Nov 2021 06:54:55 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 10 Nov 2021 06:54:53 +0000 From: Xueming Li To: Dmitry Kozlyuk CC: Luca Boccassi , Bruce Richardson , dpdk stable Date: Wed, 10 Nov 2021 14:31:27 +0800 Message-ID: <20211110063216.2744012-204-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110063216.2744012-1-xuemingl@nvidia.com> References: <20211110063216.2744012-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 07a11926-c3b5-46c0-315f-08d9a417010f X-MS-TrafficTypeDiagnostic: BY5PR12MB4004: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Y7QGR2O/zkNpR036QaSneSlIzDeCl3wfedwlMO3we2r5Vg7W1zeJRwLYwOcbCSByPaVW2gVvpgTuHGBxNgo1GGPTYW1TT8vVFQep9HHM02pwAL8uRNYn7OZnO3mGSpavcOxoX+9y2imW48o5eK1Fiskp/wamT9Al6qxkNQ6km4752/zTxyxBRHiVMU/e5Vd2rbUa8Uioo0Zo7NR8joTUxVPeyzu3/0eYOMs0KfBI9/lTE5HtZ/rxh7wKbAafYoTK4wyMwtCqBnMJmIJD5I/kE6nLlJEDqD5SwzUhDAd5O21E8SWeijDUlqrS02FCxqW9pMYYRRJ1e2BLcmPsnQbGWD00dUoAgiUihRbxmctm6HN+xFBFhyMSX+VZB6hJW+PB962KNwuHIGu3IqQgE9OdfOA8QMngRD8JRU3MUTwCgv1MIgDdXSL/QhwKBKx5MzzunX9dymuSVsFAcxy7KOv3WiLJFIifuqA5l5lFu7TmtWetx7JtHnrfj1uMKVEYEflO/x/VEkYM8sdnm8oCBb/+7sJ6uhvOnnAi6ZZdlCEziRoihSvY3DnKKa4uX0Kohydlu5d/Ctts8yeLOO88jd0uSZk0wsMJjFOyoZM9D1Yi0Ks5DhKFA1vEG6X4fbtTv9ZgNZN6B67xCApzGeZBCir0OdlSF98xRU4a51WuV09iWO5b7WLBgMLDSlhV7EbBKnVDd7LzYqo/NFKtsLmYLljg3XxYIKHyJPWLFCFDLBNN1nibekNb7nSUSGwSDGWmO+zwObBeXPENALUQW5s6Xzhornf2wH0fmNcGOccrP80D0YwjXNoCxYcr2ZmiaDNyv8FoWpZ1tOsCnfirnpLyoT/dgA== 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)(46966006)(36840700001)(37006003)(966005)(2906002)(36756003)(53546011)(6862004)(316002)(2616005)(508600001)(54906003)(1076003)(336012)(82310400003)(6636002)(70206006)(6666004)(8936002)(70586007)(36860700001)(4001150100001)(26005)(8676002)(6286002)(426003)(55016002)(186003)(7696005)(7636003)(4326008)(356005)(86362001)(16526019)(47076005)(83380400001)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 06:54:55.7512 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07a11926-c3b5-46c0-315f-08d9a417010f 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: DM6NAM11FT017.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4004 Subject: [dpdk-stable] patch 'eal/freebsd: fix IOVA mode selection' has been queued to stable release 20.11.4 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.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/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/b36c2e6dbc7d554a7dda5c4d90dca4ebd3d0890e Thanks. Xueming Li --- >From b36c2e6dbc7d554a7dda5c4d90dca4ebd3d0890e Mon Sep 17 00:00:00 2001 From: Dmitry Kozlyuk Date: Tue, 2 Nov 2021 12:08:15 +0200 Subject: [PATCH] eal/freebsd: fix IOVA mode selection Cc: Xueming Li [ upstream commit 9790fc2149b7dc727526a13ff2bbeab09577aaef ] FreeBSD EAL selected IOVA mode PA even in --no-huge mode where PA are not available. Memory zones were created with IOVA equal to RTE_BAD_IOVA with no indication this field is not usable. Change IOVA mode detection: 1. Always allow to force --iova-mode=va. 2. In --no-huge mode, disallow forcing --iova-mode=pa, and select VA. 3. Otherwise select IOVA mode according to bus requests, default to PA. In case contigmem is inaccessible, memory initialization will fail with a message indicating the cause. Fixes: c2361bab70c5 ("eal: compute IOVA mode based on PA availability") Signed-off-by: Dmitry Kozlyuk Acked-by: Bruce Richardson --- lib/librte_eal/freebsd/eal.c | 37 ++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c index d784437669..957273a9bb 100644 --- a/lib/librte_eal/freebsd/eal.c +++ b/lib/librte_eal/freebsd/eal.c @@ -675,6 +675,8 @@ rte_eal_init(int argc, char **argv) const struct rte_config *config = rte_eal_get_configuration(); struct internal_config *internal_conf = eal_get_internal_configuration(); + bool has_phys_addr; + enum rte_iova_mode iova_mode; /* checks if the machine is adequate */ if (!rte_cpu_is_supported()) { @@ -775,19 +777,30 @@ rte_eal_init(int argc, char **argv) return -1; } - /* if no EAL option "--iova-mode=", use bus IOVA scheme */ - if (internal_conf->iova_mode == RTE_IOVA_DC) { - /* autodetect the IOVA mapping mode (default is RTE_IOVA_PA) */ - enum rte_iova_mode iova_mode = rte_bus_get_iommu_class(); - - if (iova_mode == RTE_IOVA_DC) - iova_mode = RTE_IOVA_PA; - rte_eal_get_configuration()->iova_mode = iova_mode; - } else { - rte_eal_get_configuration()->iova_mode = - internal_conf->iova_mode; + /* + * PA are only available for hugepages via contigmem. + * If contigmem is inaccessible, rte_eal_hugepage_init() will fail + * with a message describing the cause. + */ + has_phys_addr = internal_conf->no_hugetlbfs == 0; + iova_mode = internal_conf->iova_mode; + if (iova_mode == RTE_IOVA_PA && !has_phys_addr) { + rte_eal_init_alert("Cannot use IOVA as 'PA' since physical addresses are not available"); + rte_errno = EINVAL; + return -1; } - + if (iova_mode == RTE_IOVA_DC) { + RTE_LOG(DEBUG, EAL, "Specific IOVA mode is not requested, autodetecting\n"); + if (has_phys_addr) { + RTE_LOG(DEBUG, EAL, "Selecting IOVA mode according to bus requests\n"); + iova_mode = rte_bus_get_iommu_class(); + if (iova_mode == RTE_IOVA_DC) + iova_mode = RTE_IOVA_PA; + } else { + iova_mode = RTE_IOVA_VA; + } + } + rte_eal_get_configuration()->iova_mode = iova_mode; RTE_LOG(INFO, EAL, "Selected IOVA mode '%s'\n", rte_eal_iova_mode() == RTE_IOVA_PA ? "PA" : "VA"); -- 2.33.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-10 14:17:10.899340120 +0800 +++ 0203-eal-freebsd-fix-IOVA-mode-selection.patch 2021-11-10 14:17:02.014078251 +0800 @@ -1 +1 @@ -From 9790fc2149b7dc727526a13ff2bbeab09577aaef Mon Sep 17 00:00:00 2001 +From b36c2e6dbc7d554a7dda5c4d90dca4ebd3d0890e Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 9790fc2149b7dc727526a13ff2bbeab09577aaef ] @@ -18 +20,0 @@ -Cc: stable@dpdk.org @@ -23 +25 @@ - lib/eal/freebsd/eal.c | 37 +++++++++++++++++++++++++------------ + lib/librte_eal/freebsd/eal.c | 37 ++++++++++++++++++++++++------------ @@ -26,5 +28,5 @@ -diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c -index 9935356ed4..2c2baaa691 100644 ---- a/lib/eal/freebsd/eal.c -+++ b/lib/eal/freebsd/eal.c -@@ -677,6 +677,8 @@ rte_eal_init(int argc, char **argv) +diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c +index d784437669..957273a9bb 100644 +--- a/lib/librte_eal/freebsd/eal.c ++++ b/lib/librte_eal/freebsd/eal.c +@@ -675,6 +675,8 @@ rte_eal_init(int argc, char **argv) @@ -39 +41 @@ -@@ -777,19 +779,30 @@ rte_eal_init(int argc, char **argv) +@@ -775,19 +777,30 @@ rte_eal_init(int argc, char **argv)