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 B28AD4307E; Wed, 16 Aug 2023 11:42:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8BBB3410D0; Wed, 16 Aug 2023 11:42:38 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2060.outbound.protection.outlook.com [40.107.94.60]) by mails.dpdk.org (Postfix) with ESMTP id 4777240EF0; Wed, 16 Aug 2023 11:42:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RBanlBNEgx+VV1Nln2036F9ckbdZqV4ZcITC6E/EWZbV5cLLqt72SLBz0xQe1utyxqhQMQboWBcQZypap1s2GchxwUGPsHSP5/HLMI2H7QqJuchwyg2el56aD+lWvO3h6mlarQeUEGamTZN3jyrQ0H2Pbio1syMFhBUqqne7rQy9WXLU2rTSyQaEk/8GTHPJuI6piaY+WDtm8pH2HbsLdZ/e/jgUzfklTUENaVpEnMcIB4dwuQSpvtgZHxhQ+z4eVgB7/Tv2UYr22Yy7RUwKiGVIyPu/0OLDjfI43Hdxxl0Il00dV/kAn19f/Ps+MV0R9zysA1J8XeIQ61k54C4s0Q== 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=KpvZVWMbXZ4n92xDafheKqA6ZEGrb8aKRpLsFZMOe6Q=; b=Y/oAbPF54AhG/RKeNWlrBOTKPwSYbuNzWOeR52+58Dkg83ciyjrScIrW1AcuIBZIpU0Ln+VBGmJrS4jAhSnQr6Yr65eoBuvOTqUfBnqwHfNACiFxF0qVe1Fog0YhdRY8lDcZraLXCoJfeCNEna0wYlmAu+ChfpU27YzT7Q5XGcAvRtMucCpYJyuipTKgFcvxWGGOETD3DekzqOVK0lbJFwnmVj8OeilxzBN2KuCe7Mr2bFk9tSjk97W0T2AfXsi1wgQxDOryOCraris0LDmvTE8L4thIAwtr9qyJTv2ecPUkhT+8K+AgmkhNPDfq9Jqw2J91mul2fUnsZwPWFUEqOg== 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=KpvZVWMbXZ4n92xDafheKqA6ZEGrb8aKRpLsFZMOe6Q=; b=PMcneAjhEwC+ndfzctO4gnNPxx6G+m7lKj4l4tw6bN0jVWX7Nypy7/IQKo7Fe4J0TALWoscSVLFxFo9mLwagmL0wvh9HJQA1Q+PMZuLBkLV5Vs+anBF78VwDA+LBTMp7UHmImrzbe3LITbJ0FG67GWRO9XqTxw9rRaR8Cv8elHA= Received: from SN6PR05CA0016.namprd05.prod.outlook.com (2603:10b6:805:de::29) by DM6PR12MB4864.namprd12.prod.outlook.com (2603:10b6:5:209::22) 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 09:42:33 +0000 Received: from SN1PEPF00026367.namprd02.prod.outlook.com (2603:10b6:805:de:cafe::e9) by SN6PR05CA0016.outlook.office365.com (2603:10b6:805:de::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.14 via Frontend Transport; Wed, 16 Aug 2023 09:42:33 +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 SN1PEPF00026367.mail.protection.outlook.com (10.167.241.132) 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 09:42:33 +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 04:42:30 -0500 From: Vipin Varghese To: , , CC: , , Subject: [PATCH v2] app/dma-perf: fix physical address seg-fault Date: Wed, 16 Aug 2023 15:12:16 +0530 Message-ID: <20230816094216.1847-1-vipin.varghese@amd.com> X-Mailer: git-send-email 2.41.0.windows.3 In-Reply-To: <20230816071810.1796-1-vipin.varghese@amd.com> References: <20230816071810.1796-1-vipin.varghese@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00026367:EE_|DM6PR12MB4864:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a5511b2-6414-45a7-dea9-08db9e3d1dd8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Vr2JN187aRqGMQtVhLNsFSC4D5YCbOEQjI9AnFuknA1NnFsz4S0xKU+kDLMhnzzcxl+ujcxD89E5ZZQk71sXqhLVRBGO4SqR5NM4gMKVNUSeQGEmnQ0NMgs4i2gKaGz7GaLt1+8MnXy+OPdHSGGdJkHemf0wpfaxg5T5D8LbKKG/rQ39gttE34NNA9AC/9KKZG1WcnDDt6yLZ6TX82YI4DTkvSCTcnhCZDCOVJX/McxRgTHN3in6Mb3G1QNR63A73SpksWZgjqVTlk0m1t1i4RQmeALnpqoG+WDbwBMmXzPgQzWHm2vuHuirkGGtymQ92DZD2ZAhmzBWHaK96nwOX45VyzErZ8YELkuHx0hqgzDCT2tOcJsY0Zfc1Y6PAaF2LniYHRGWH8zRahp4winQql91f5tIAp4PtaR/4zt7wG3dwmX/XUu/Yf1RwsKpbpeb6OuL32MJ6TDfZr1gYA7y3eu3F32N6VN+knIUT+SnEV5iiKKPP5OrTMJLXANgr2sDOWVgRrdK2Z5SWD8M1TOI3k3Et8ZCeYGG8/84am4z9zSPGAFCw+zEOaJK3jF5m7wLdgnrc3IueBh8c0wEhN2YQy32oSqk+7ClCpNF7YcUAzVF+rvjGNjuXAsnjtowu8CqL2a/W7WHXwOh2x1DrJKJAf3IqLzinABIUMFuq0TH4Yk0OWQLub3gNgRZn0T2t26HGfUltRbNW1R0xmyCs0VeXvmgg54Jeq3AySnPMugPRJGLi2bTbIv9m6a4YR+KBsyi6SYYO8JOj/BPZDttnlTAtQ== 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)(346002)(396003)(136003)(376002)(39860400002)(1800799009)(451199024)(82310400011)(186009)(46966006)(36840700001)(40470700004)(40460700003)(2906002)(83380400001)(86362001)(478600001)(40480700001)(336012)(426003)(36756003)(2616005)(7696005)(6666004)(1076003)(26005)(16526019)(5660300002)(44832011)(41300700001)(36860700001)(82740400003)(316002)(54906003)(356005)(81166007)(70206006)(70586007)(110136005)(4326008)(8676002)(8936002)(47076005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2023 09:42:33.3534 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9a5511b2-6414-45a7-dea9-08db9e3d1dd8 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: SN1PEPF00026367.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4864 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 uses VA address and not PA. This fix invokes `rte_pktmbuf_mtod` for both src and dst. 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 Suggested-by: Anoob Joseph --- v2: - suggest use of pktmbuf_mtod for both va and pa. 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/test-dma-perf/benchmark.c b/app/test-dma-perf/benchmark.c index 0601e0d171..1d1c9bde99 100644 --- a/app/test-dma-perf/benchmark.c +++ b/app/test-dma-perf/benchmark.c @@ -288,10 +288,11 @@ do_cpu_mem_copy(void *p) 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((void *)(uintptr_t)rte_mbuf_data_iova(dsts[i]), - (void *)(uintptr_t)rte_mbuf_data_iova(srcs[i]), - (size_t)buf_size); + rte_memcpy(dst, src, (size_t)buf_size); worker_info->total_cpl++; } if (worker_info->stop_flag) -- 2.34.1