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 9195D43073 for ; Tue, 15 Aug 2023 17:04:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C44A42B71; Tue, 15 Aug 2023 17:04:34 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2041.outbound.protection.outlook.com [40.107.237.41]) by mails.dpdk.org (Postfix) with ESMTP id 2FFDE4114B; Tue, 15 Aug 2023 17:04:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IORWQM4JPPynLMMNqVQOjlDWnbbhc/S0S9BZl0hmawKZf4ILyWJ/38dGplAWrRpIN6lWqKSJ2HO5NNlNPgPNN0Qp0RJovDCMcxXBqcZQLCK83BNZxfpIPZVRGtASc0I11BK1AR43iXjwOZ4QWu9HyzjpAM/3ry6yZdlj9JmyPBEwCfP/UUgZ7lxYm8byu8n49dMD8aqeAbdET55fAHk4PjGEGR3kUZDsioJHkhjvEpA1aLqPzgi3eBfQl7/XpcTRytiu9G/ufrrSCakEexxI99C7VuRXdFLS78f5jwpbYVjPjmYCy09Xmc2zfHwLBUmZgqcdjbYHo1oLsZkdEAEeOw== 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=i0AnnYbg2G4dOofjYB3lnjUC+udp7zV657ayODwXrAY=; b=dUF5gzN3/QCg6jCULI9ZQmwBt3WdDb+RqZjq4xdMM77nYifC9FH4FjUiwuNAncMcUjyVjMPcIQbK36KWqCLDLJuK4MGr5a6ANSfZIXh0tI+z5M2xaNdzfJXrFlwjXoO7yikMuPqztGRfq2D7TRobchKUFrztAJgE0qpWoRFySu0NRuzd+yG6peUTjoYTd0T058zNYkQya57/Y5g9GmllaW3sZBj7CCAYMIYFQXNtTXekMgd8I+WxKy5HI700rNCWO1oBCpabAcwCD5unES1yXSCIBfJveEYvr9+AQjTRanujDfvDyaMnHRcmLHBBdRM1yPd0+3ZNqh6xQltgi89g5g== 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=i0AnnYbg2G4dOofjYB3lnjUC+udp7zV657ayODwXrAY=; b=Rd2odvt++guohhNMmZiKVAt4zw/g4Y7GWrDGDUPr6H9j9QFHzA+37hVih+6j3fEDQCvWqCTyRDjI40yFIADigof87zy8XHy3FPy6Wxvlziqi9A2uw+New/DGPlyGKLzH7Vis9pljCl27+ljeD4bnhdakAM36IenMXf+PW7A50NI= Received: from CH0PR03CA0341.namprd03.prod.outlook.com (2603:10b6:610:11a::18) by DM4PR12MB5200.namprd12.prod.outlook.com (2603:10b6:5:397::11) 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:04:31 +0000 Received: from CO1PEPF000044FA.namprd21.prod.outlook.com (2603:10b6:610:11a:cafe::f5) by CH0PR03CA0341.outlook.office365.com (2603:10b6:610:11a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.33 via Frontend Transport; Tue, 15 Aug 2023 15:04:31 +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 CO1PEPF000044FA.mail.protection.outlook.com (10.167.241.200) 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:04:30 +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:04:27 -0500 From: Vipin Varghese To: , CC: , , Subject: [PATCH] app/dma-perf: fix physical address seg-fault Date: Tue, 15 Aug 2023 20:34:08 +0530 Message-ID: <20230815150408.1763-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: CO1PEPF000044FA:EE_|DM4PR12MB5200:EE_ X-MS-Office365-Filtering-Correlation-Id: ea7dbb29-c940-437f-19dd-08db9da0ed4f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LAGpynqmQJ1tQjVbhcWdWJUv2ZaU/LvfrSMA5CMudb+wxY4SDcerYRvK3A1Yd2attuChX+6UlMO0wNKvWAgu+ONx5gPUrG+nTZ2QXR/MzVGIPAzca+mBBA5uWURc7BH56mq/TTxCMDKBJg9CDCAYpldksKSF41QxRGL6CQP9N+BUlZzazyB1qzeNhkJrbTT/8bDW0Xh3IHkF9QOoRD339v3hSx3YEjfdPRnq9sKPhAZ6H2eIu2ni1yUWsvfyFcI+6MEJJUFU5aYQ8+f6ya+w41yfeIIE/OyxUOkZOty1oreMamXxer30VvwEXL7w30l0mLgefYwhwnvUvwJunbxBrn7zCZmV7X9k2QQz57lNYbufcnL7hP9GgHREo0f1N6mZkNU/bi68GNE7kdrAEUW8r8kmiRcVA7aJ9T1MzPRVmcovmUbe6dFVOEJaueUopmaCM0euH3TvfLxOI1bg9bl79Os4+ckqBziDWTZfOLxqC3nNx/1BOE//yxBLJysw0WKWcNUpi4aUgY2rS30Iwhro/fInLmgAMPTjcgyN4OXoouIL+CpZ5wP2qD5PKmxKfsYklkOlS17tHYvBOGGbc1yVxsjdjp4dZGRfAIXO+2YWGqHPU4Uj7dRZrNEbsoQE9C4uf3dJxjh4+6VNZozsYgu7ZCXQYZgkq0mwG+cp6ZKew5vSNrN4wTsRLZ2E4VUcG4YoQrUUjZbMB+UJkcE7AB74T5TcEZofHKUV+zWVxH1mBc93JEjxRBOaz9kt5PcnrAahh/i/iCNjWMEwRwRqTi1ieA== 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)(39860400002)(136003)(346002)(376002)(451199024)(1800799009)(186009)(82310400011)(46966006)(36840700001)(40470700004)(86362001)(70586007)(70206006)(4326008)(41300700001)(2906002)(81166007)(316002)(478600001)(47076005)(426003)(5660300002)(2616005)(36860700001)(40480700001)(356005)(82740400003)(83380400001)(26005)(8936002)(16526019)(40460700003)(6666004)(1076003)(8676002)(44832011)(336012)(7696005)(54906003)(36756003)(110136005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2023 15:04:30.3206 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ea7dbb29-c940-437f-19dd-08db9da0ed4f 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: CO1PEPF000044FA.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5200 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 mode and invoked rte_memcpy accrodingly. 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