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 A5C944307C; Wed, 16 Aug 2023 09:18:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 48B2840EF0; Wed, 16 Aug 2023 09:18:31 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2065.outbound.protection.outlook.com [40.107.237.65]) by mails.dpdk.org (Postfix) with ESMTP id 894B640041; Wed, 16 Aug 2023 09:18:29 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z8GlKXoO6UZaPczjRzLFmdRpIzNDmzSPOx25gogepXTMaMsmAujEUcXzElqYDMEUQdWtAJvyMqYdvZL673j2e6fniJN6/01/vWbC0KLlNcGDnV9LHe6eaKEp5A7sH3NcCiyt8m21DFtCBbIfxAdG1qLXU8J3d7eEQQCk4pD2M7uNS5p3suIWA6RyTlg6nSBYQOny7GZ/54GXcUY438/LwmDuabOU2TjEwJJhzYgvxrMFDWc1yoarx1l4viT81kwbR6osZVcP4hSJzb8WGcIIFUGnF4RWNj9BZyzitLGzJEydcP8kKXDYQEOUYK24i9e2tqrmrfXRqrXm4OTEH1BQkg== 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=H7/cRB3xjxRCda0imhgXdEV22htvuVfesZE6QlmnYbY=; b=dpKPEKDC6jj9cw6fvyCd6zYQbdkgahxtnEyn4h9d/0itp9+KBkDcf9Hp4+TwyA1ZwEZn7buX2wNd6RRlz+3JfgPh0YYY4YtNPhGE7q4iGPNFtomLzO2iJbYPaUPyobaZHbgt5Vzyi4N/1/med/kO7R9JIMTxqoqMeQCW2C/kXJlngytjKuT8doPQxDR8VFo8RUqb4CNZMpZ0YU77x8suZdrLOBj5bzNPUU2sdqkQT2Xi5cWdqTMC3IIRu9TgO8jMicx6hFK8+ublSj6kpgO2yuzMHbdg8NcOGe9KbifTl1dj0lBvbvsjHj3+b2BDGAqTlaqgShlYjye1xi1uMzijXA== 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=H7/cRB3xjxRCda0imhgXdEV22htvuVfesZE6QlmnYbY=; b=PvHYty2sZc7RcaZVaeaRWRWOaOtHXodVUsSemJa9avPL4Ql2qDLRuWI4l6HxSwVM6zRwLiAVcTj+RZenmCGbZBvdWMew2Z62SHdhWDbF5h5G9yRkb/txq8LiBqvsdK8IJy4OO3uOvwPUhZbtYYI1P5BvZpw5V1QzHG7oR6lfT0c= Received: from CYZPR17CA0011.namprd17.prod.outlook.com (2603:10b6:930:8c::18) by CH3PR12MB8936.namprd12.prod.outlook.com (2603:10b6:610:179::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Wed, 16 Aug 2023 07:18:27 +0000 Received: from CY4PEPF0000E9D0.namprd03.prod.outlook.com (2603:10b6:930:8c:cafe::cf) by CYZPR17CA0011.outlook.office365.com (2603:10b6:930:8c::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; Wed, 16 Aug 2023 07:18:27 +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 CY4PEPF0000E9D0.mail.protection.outlook.com (10.167.241.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6699.14 via Frontend Transport; Wed, 16 Aug 2023 07:18:27 +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; Wed, 16 Aug 2023 02:18:24 -0500 From: Vipin Varghese To: , CC: , , Subject: [PATCH] app/dma-perf: fix physical address seg-fault Date: Wed, 16 Aug 2023 12:48:10 +0530 Message-ID: <20230816071810.1796-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: CY4PEPF0000E9D0:EE_|CH3PR12MB8936:EE_ X-MS-Office365-Filtering-Correlation-Id: ae467ce3-cbe6-4590-88ed-08db9e28fc68 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: An7BMbJrALChfanKacOQzAYwX0kznKN3XJATxIOkedwfYyJa7AiVyYPaRGt/hBswFDFwaKiDUhXFIq/NtFBSKEbGXtxB5el4U7jr9Kedh39AAaRWCCqd7mgKXP0qm9ugpKb9c7R7e58KxyVtzS1TBVdoaFsm6sOrbFOB5YlrICugBAqnUCCWAt6hEGgDs2DW/UVuM/5sVMASf2IUD6N+Uc7z3wPTYltYVyfoaGjrUwwXECmH6kKDTnlNXkVWzoJd2XOb4HwyTzIN8G/8WYEJyiOKsHOFrv7G0lGwLQyYwTHFAZ9hitDE4bpR6GOQnLAJaLCvjy92MqXEGPYzGNEEV2kGS+nNTipYUWXAAs7r63QIab9e4tnyHGKakPbN8KhIvUcCt/GfViaTynYaCMQg8sO3LTFFJRJCg3c51sbc1ZqPQHOLgED3VX1epcik3V0uwFaVVRv/w8wyCWHv9IRkuGx1JZjnSKCu+4DpjhuVDh5OptfLTIX+332EUat7/egwZlO7GJfnXUn325/CKLRs4IALukEyBGp1H7xviAGW0Rz0KZk6mSggOm43GQUxdRlOU2VZ3R8n1nGLQ2Rxe16nPaFSgF84GlQlfl75tSdp3POUp54FMMwN25Nitr62yDJ6DwoXDaFRdhLQPDlMDaHgFPLpZLE9WP6jmwBQvg5my0U+BKxNdoyxVBa/6sRo8+MXt6u0uKPVRaRIcLKRGW5lW9pau/YGDx/tzNX8KEQG8n3hnc5bEO4vWvpaJwzhQaI0LYCI5nAjHPbMKIYrKW9Dwg== 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)(376002)(39860400002)(396003)(346002)(136003)(1800799009)(82310400011)(451199024)(186009)(46966006)(36840700001)(40470700004)(6666004)(54906003)(70586007)(70206006)(7696005)(2906002)(478600001)(16526019)(1076003)(336012)(426003)(26005)(110136005)(5660300002)(2616005)(83380400001)(41300700001)(316002)(47076005)(44832011)(36860700001)(8936002)(4326008)(82740400003)(8676002)(81166007)(356005)(40460700003)(36756003)(86362001)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2023 07:18:27.1459 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ae467ce3-cbe6-4590-88ed-08db9e28fc68 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: CY4PEPF0000E9D0.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8936 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-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 | 39 +++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/app/test-dma-perf/benchmark.c b/app/test-dma-perf/benchmark.c index 0601e0d171..5573acc9f9 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,33 @@ 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++) { + void *src = rte_pktmbuf_mtod(dsts[i], void *); + void *dst = rte_pktmbuf_mtod(srcs[i], void *); + + /* copy buffer form src to dst */ + rte_memcpy(dst, + src, + (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