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 3B65643073 for ; Tue, 15 Aug 2023 17:11:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 338DB43260; Tue, 15 Aug 2023 17:11:02 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by mails.dpdk.org (Postfix) with ESMTP id A04EE42B71; Tue, 15 Aug 2023 17:10:59 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gAiSw6LJCtI4LB0YyUSk3upDHwUAVP4WQO42ytsHkGsx34uA6Yi9dQINPuifCWj9kUTLgMWnTpMB4TkVxTDJ1/QUgTAPI2oB61/wDuCReNbKtRoksl25H+z1sABN7kaXOkrRItYBbr2il5lKg2PlwumPWPrGUlwoQogfP5iMbLLAmsUwQnrfTd4ynar/4GBr3yC6PCnzelZewHCMmipvK7PV/ssanXq+CXkRaCaYS3XqQEvXkJJgF4DppDzw4wJsEYRS5GNA9/rO1LzNL/9QfVwVSltIsN86u4g5otu/uosoXATsUOKoiyKdu9IOOI8P4e6w6DMcw+KOpYK/IhaNjQ== 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=X2MnzKoH4YFkz9Zrhrulv5jvFHeRl22fQpAuLyXaxEA=; b=bI4EIcmnJk661J86PJmoMDzvny3zehRKBL0IF+40R/9ObIIQ485zFTPIcSMoaV8sGpRWnnly0zLGyf9K7fv7mYQTK4+vb5XIv2esO4XFeqTWLhH1Aaav1Rhu6FYqaFRX+Uuzhfi7FKthrvg8/iXwgnz0VVTvppLUX3nWcTjZmwUFs45I6fOO6IRLNXGhP8enm9A52RbaBG+Lu3QTT8R9HFTaXLHxMxPfOdPIjjnd+xwbdr5jNnnbflB+vILs/JrEx/QtFi8Mk81Pt+JnSg+GzP8JxDadNIDgVRKR4ZDB4yTr6SsD4MQ7OGvtK5jYchzK8AQNqfRg3WacRMr5iIY4cA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=monjalon.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X2MnzKoH4YFkz9Zrhrulv5jvFHeRl22fQpAuLyXaxEA=; b=YQBBaBy5fYMOKB+TGoxGNUHbtR8kuLgu2JMCOj9EhkdYgU5i9WPJoUluGsU/RaG7LivTaCtu62ThzJZIsCWRGITX5jeJbBrP4RWxd7pde5NvxVQs3PhJAEGo8OT78pqK+hHbdVs0KOXfIAubV7Epo8bYggSn6VZ0ofdNuh46dfo= Received: from MW3PR05CA0023.namprd05.prod.outlook.com (2603:10b6:303:2b::28) by CH0PR12MB8577.namprd12.prod.outlook.com (2603:10b6:610:18b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Tue, 15 Aug 2023 15:10:57 +0000 Received: from CO1PEPF000044F8.namprd21.prod.outlook.com (2603:10b6:303:2b:cafe::f8) by MW3PR05CA0023.outlook.office365.com (2603:10b6:303:2b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.14 via Frontend Transport; Tue, 15 Aug 2023 15:10:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044F8.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6723.3 via Frontend Transport; Tue, 15 Aug 2023 15:10:56 +0000 Received: from BLR-5CG134626B.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 15 Aug 2023 10:10:54 -0500 From: Vipin Varghese To: , CC: , , Subject: [PATCH] app/dma-perf: fix physical address seg-fault Date: Tue, 15 Aug 2023 20:40:41 +0530 Message-ID: <20230815151042.1778-1-vipin.varghese@amd.com> X-Mailer: git-send-email 2.41.0.windows.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F8:EE_|CH0PR12MB8577:EE_ X-MS-Office365-Filtering-Correlation-Id: 6bbee97f-e21e-4cb7-aaa9-08db9da1d3b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LAo0NSgbTC3HAcklqMMFdbqpXDMz21iVlBHAFy0JsV+7D2s1N+C4bJocGhUAx381Xpp57aAeFrFPSZ/wUdpzW2kvXpuWKiKiDb/MlTyWxb8qp5racTKnLcX0mjmW4YCvAIA/UDZcpB/9BpLr2cjEhiQN6cdxMRbtsVx6aguuHEuUzDuqFYB6fyazWq49xemZ8uIKkg3fKwp9meLaX+t3Ac9DO7TCVH3QYaU3Dnp+OprT+wh6l1dVloK0mmaEvAfQycxyvw78oCz67tqIVKPiQoDkiryEmrHkC848APBv75thTGq/g7R1IpTVlC807yVRO/9elQC66IJH3Htzzi8kd6D3MxnNau3TqQKrvaC3PvB91g/FrONzzuGfFX/i3KHKk+1gYjHPbqOIWMpiWfuDltQFdJ6L4lUJRZPCU07zk8d/DDlzUiNRsk8mwfp8pAeCZqXI1as3jwrEHOGOvhoaIHVZdVvkpIM+uwfNisv3eUS8mY9ZmMu0Mo3Lt1NoT6SAooKqEHhXy2VflBTPzhX0smOb6LQy/c35tv2fCLXmCfXblIChjxEPEgekgJW3rQGsE+QJbnUAjJ1WJySiDH/oDtROU+PLnFX5/E4QC5alHxB/CdbqkXDPWqHsnmO25xzFwKNZGvLrngYi5J9ajEv6hRMU2G7IprW0Uzpc7qi23L2stBVSLei4/EtFh+QtvscCm4Pddc5TzL8144OvtnxJ8oxw8wpdA5M1/Ro5p2R6TPoAyJ1Kz4pktg/cQerec0rUHL30a86K34sZ4abLG242SA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(396003)(376002)(136003)(39860400002)(346002)(451199024)(1800799009)(186009)(82310400011)(46966006)(36840700001)(40470700004)(8936002)(2616005)(41300700001)(54906003)(70586007)(6666004)(336012)(426003)(1076003)(36860700001)(47076005)(40480700001)(478600001)(44832011)(7696005)(8676002)(40460700003)(36756003)(86362001)(81166007)(356005)(16526019)(26005)(82740400003)(83380400001)(2906002)(316002)(4326008)(110136005)(5660300002)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2023 15:10:56.8622 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6bbee97f-e21e-4cb7-aaa9-08db9da1d3b4 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F8.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB8577 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 do_cpu_mem_copy uses DPDK API rte_mbuf_data_iova to return the start of the virtual address for both src and dst. But in case of iova mode set as PA, this results in seg-fault. This is because rte_memcpy VA address and not PA. this fix checks the iova mode and invokes rte_memcpy with the right arguments. Bugzilla ID: 1269 Fixes: 623dc9364dc6 ("app/dma-perf: introduce DMA performance test") Cc: cheng1.jiang@intel.com Cc: stable@dpdk.org Signed-off-by: Vipin Varghese --- tested for both va and pa CMD: PA: dpdk-test-dma-perf --iova-mode=pa -- --config test.ini VA: dpdk-test-dma-perf --iova-mode=va -- --config test.ini DC: dpdk-test-dma-perf --iova-mode=dc -- --config test.ini Log: fails for dc mode `EAL: invalid parameters for --iova-mode` test.ini: ``` [case1] type=CPU_MEM_COPY mem_size=10 buf_size=64,8192,2,MUL src_numa_node=0 dst_numa_node=0 cache_flush=0 test_seconds=2 lcore = 7 eal_args=--in-memory --no-pci ``` --- app/test-dma-perf/benchmark.c | 36 ++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/app/test-dma-perf/benchmark.c b/app/test-dma-perf/benchmark.c index 0601e0d171..73200e1935 100644 --- a/app/test-dma-perf/benchmark.c +++ b/app/test-dma-perf/benchmark.c @@ -279,6 +279,10 @@ do_cpu_mem_copy(void *p) struct rte_mbuf **srcs = para->srcs; struct rte_mbuf **dsts = para->dsts; uint32_t i; + bool isAddrPaMode = false; + + if (rte_eal_iova_mode() == RTE_IOVA_PA) + isAddrPaMode = true; worker_info->stop_flag = false; worker_info->ready_flag = true; @@ -286,16 +290,30 @@ do_cpu_mem_copy(void *p) while (!worker_info->start_flag) ; - while (1) { - for (i = 0; i < nr_buf; i++) { - /* copy buffer form src to dst */ - rte_memcpy((void *)(uintptr_t)rte_mbuf_data_iova(dsts[i]), - (void *)(uintptr_t)rte_mbuf_data_iova(srcs[i]), - (size_t)buf_size); - worker_info->total_cpl++; + if (true == isAddrPaMode) { + while (1) { + for (i = 0; i < nr_buf; i++) { + /* copy buffer form src to dst */ + rte_memcpy((void *)dsts[i], + (void *)srcs[i], + (size_t)buf_size); + worker_info->total_cpl++; + } + if (worker_info->stop_flag) + break; + } + } else { + while (1) { + for (i = 0; i < nr_buf; i++) { + /* copy buffer form src to dst */ + rte_memcpy((void *)(uintptr_t)rte_mbuf_data_iova(dsts[i]), + (void *)(uintptr_t)rte_mbuf_data_iova(srcs[i]), + (size_t)buf_size); + worker_info->total_cpl++; + } + if (worker_info->stop_flag) + break; } - if (worker_info->stop_flag) - break; } return 0; -- 2.34.1