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 B0211A034D; Mon, 3 Jan 2022 18:37:46 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E4E8C41148; Mon, 3 Jan 2022 18:37:37 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2074.outbound.protection.outlook.com [40.107.243.74]) by mails.dpdk.org (Postfix) with ESMTP id 076D14003C for ; Mon, 3 Jan 2022 18:37:34 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e6bZT/2hM64ovZldMZc6vN37qle723CH5GOtGqdpYnbxTT4Dy1JaJEn82RSouVibJ17e7qPnDXWTwVYPY3gu7eOcHEe7UsGmW8hLeTs5jMPSDCHzX9kei8MdymidYu0zbWi0UjiqK2WMbhdOvfzzIf2z/z3/wYAirx6ps2VTVdf9Rw0v+YM3Lcc2lSKy2wa5y98CpwTXECkXqPVxiqaoWdGZIIB/eRhGNn8QtvtbBiuGO+lyOsGOcfGCecifLVcLTjpMHGpMaR7AGlA1/evxTVUHYwuDiSknYAZfEGC0i1ga3kYPZiAlcvhQsadc8quhy0TAPT0KE0jE45ZEo7o+3g== 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=OkdTox4plqxUBYxrxXqv2iVwrfQvqv/v85nXlPQy2mQ=; b=bBiKf6DA6/8nNsRPB1RCGkITDX4B1bWKx4W2zFsY43PbFC4aLVQ9zm7WtcrFbBZCj3/NX4IZxKiHIJmYvNbXjrs4YgNieO2dP0m/4nLINfn4YY0ZXeZ4AwRyubbLG++fUKSnRoUOXTfEc9yqQmW3+vsVPxj2gVXqSI0S2hGV2eaedJgA+5+3uEbcrPbeZ0vYhGsqlbQNj9O+upJeBN2XkC2U5IFDjrA6u7ShXL4cW5iiNBswocV/eTM11kcEGQwtK4GBbXBn60hRUmhdJR8BOuBiOROgB5twYWaopY/apD3i6NEKeJedRfuHC12yWt8vRdbA07zsK4ifexIRvlyY9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject 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=OkdTox4plqxUBYxrxXqv2iVwrfQvqv/v85nXlPQy2mQ=; b=cMlXT3YqO4e+0ncMKKVFxfcABgr5TEpws8CGe3hM8XKipOwRSFi7BaEfCvcHzkRyfpc6YIQO1X+kWH4NeFpcC6WxNUYSUKsxWTskkHHltUZDm9kaMxaOsthtwsvBEKWenw0ouCptkkn5B+XY5ns3gDBTFJ4G/q/6oVhuUoM4uTjoOWtthZJrCt6PoHFZz2eB4n3JkeWHuva0Fc3fvBqG6F0FH6ltZKBHp6cYD/2mz+clWTu59HCaIMY0zUcP7CyR6piN96Y7XDX5ZL58FcIB7nupTWa2c6UXW+MXZ+XA4qKUkwb2dpuFnAas20vY3y6+ZWnTbT2C/E9XkOpcT5blHw== Received: from MW4PR04CA0147.namprd04.prod.outlook.com (2603:10b6:303:84::32) by DM6PR12MB4281.namprd12.prod.outlook.com (2603:10b6:5:21e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.14; Mon, 3 Jan 2022 17:37:33 +0000 Received: from CO1NAM11FT065.eop-nam11.prod.protection.outlook.com (2603:10b6:303:84:cafe::78) by MW4PR04CA0147.outlook.office365.com (2603:10b6:303:84::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.15 via Frontend Transport; Mon, 3 Jan 2022 17:37:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.236) by CO1NAM11FT065.mail.protection.outlook.com (10.13.174.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4844.14 via Frontend Transport; Mon, 3 Jan 2022 17:37:33 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 3 Jan 2022 17:37:32 +0000 Received: from nvidia.com (172.20.187.6) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.986.9; Mon, 3 Jan 2022 09:37:31 -0800 From: To: CC: Elena Agostini Subject: [PATCH v1 2/3] app/test-gpudev: test aligned memory allocation Date: Tue, 4 Jan 2022 01:47:20 +0000 Message-ID: <20220104014721.1799-3-eagostini@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220104014721.1799-1-eagostini@nvidia.com> References: <20220104014721.1799-1-eagostini@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 704c61ac-9a53-4920-ed31-08d9cedfb983 X-MS-TrafficTypeDiagnostic: DM6PR12MB4281:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:510; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lZmUpOijhheFYd6p+KD6u82nAbjxRVd9Q8k9Vqz9bJZ3R4o5H3kyNKzMnHkLjMM6UCN2uWYYUT2WJ1j29IilL1+pe0v3EsmoAXFcYnhWY87FuC8vvZI1L8ChUdrH3A+0AQZ5zouswNJ/K+jZlNazwrfR8vo1YaOpJyiwKvkCJxAC8vFTlhUcYhh0AbVJXVgem3S1Pm+3y0B8OzhWHWyuIc54stADOU/SohvE1ZNFedglKVnUbh5XpasaOblyEx8NJg0QtAJFKdRHdhhNtZGAeWlUFlpq1alVC0A61hwVvWcoQZVvz83ddXs/rUDJg8Y8kWGDil0/SDBpMsumOONjBjgv4SNvA9S482oeHZq06vcBwfNAdXz/QE+rn6wZTe3cpEUZ6plOEP+QV8/DWgx1TRjERtyZTZMb/UGs1FfFpwV6FbVEL2agg2f5sJtGyi/vGV/Re0WiIZSj43eIWf+udk914HvrpK+ROlw3pSpbQL8JxdTX50KsaHZz58Pj9OEta/RqC9VHziXgu5y2DGWjWrK31saJKvaVEQMM9W4zt1HifFxKHnu15vhPMfAs7fOU69/mfiOYrm2KHkmZFauEq1L1w+1g43sTJi9/wb86J8gTgDbTNWvDZzOOomm4QrFe8KuL9B7+TC6Tz4wYtwBJ21mbtQ09t5MNHYk89g3zVJnqY5aC5BhyD/nMrctzlHKq7fH4tRO/q7/BT94mfJuy/WG43g30R5f8MyeedEH0thVgKMd9X8wrWACDj8BhJbR18tP4iWYQuChqb51CJqCwUAEcYuwYhOMCN/wBQuQPIgo= X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(36840700001)(40470700002)(46966006)(6666004)(8936002)(426003)(82310400004)(356005)(8676002)(86362001)(336012)(6286002)(40460700001)(36756003)(107886003)(2616005)(83380400001)(55016003)(7696005)(5660300002)(16526019)(508600001)(36860700001)(26005)(2876002)(186003)(47076005)(4326008)(70206006)(70586007)(81166007)(2906002)(316002)(1076003)(6916009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2022 17:37:33.3845 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 704c61ac-9a53-4920-ed31-08d9cedfb983 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT065.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4281 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 From: Elena Agostini Update gpudev app to test GPU memory aligned allocation. Signed-off-by: Elena Agostini --- app/test-gpudev/main.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/test-gpudev/main.c b/app/test-gpudev/main.c index 5c1aa3d52f..f36f46cbca 100644 --- a/app/test-gpudev/main.c +++ b/app/test-gpudev/main.c @@ -69,11 +69,12 @@ alloc_gpu_memory(uint16_t gpu_id) void *ptr_2 = NULL; size_t buf_bytes = 1024; int ret; + unsigned align = 4096; printf("\n=======> TEST: Allocate GPU memory\n\n"); - /* Alloc memory on GPU 0 */ - ptr_1 = rte_gpu_mem_alloc(gpu_id, buf_bytes); + /* Alloc memory on GPU 0 without any specific alignment */ + ptr_1 = rte_gpu_mem_alloc(gpu_id, buf_bytes, 0); if (ptr_1 == NULL) { fprintf(stderr, "rte_gpu_mem_alloc GPU memory returned error\n"); goto error; @@ -81,7 +82,8 @@ alloc_gpu_memory(uint16_t gpu_id) printf("GPU memory allocated at 0x%p size is %zd bytes\n", ptr_1, buf_bytes); - ptr_2 = rte_gpu_mem_alloc(gpu_id, buf_bytes); + /* Alloc memory on GPU 0 with 4kB alignment */ + ptr_2 = rte_gpu_mem_alloc(gpu_id, buf_bytes, align); if (ptr_2 == NULL) { fprintf(stderr, "rte_gpu_mem_alloc GPU memory returned error\n"); goto error; @@ -89,6 +91,11 @@ alloc_gpu_memory(uint16_t gpu_id) printf("GPU memory allocated at 0x%p size is %zd bytes\n", ptr_2, buf_bytes); + if (((uintptr_t)ptr_2) % align) { + fprintf(stderr, "Memory address 0x%p is not aligned to %u\n", ptr_2, align); + goto error; + } + ret = rte_gpu_mem_free(gpu_id, (uint8_t *)(ptr_1)+0x700); if (ret < 0) { printf("GPU memory 0x%p NOT freed: GPU driver didn't find this memory address internally.\n", -- 2.17.1