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 BBC91A04A6; Fri, 7 Jan 2022 17:10:25 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 610E04068E; Fri, 7 Jan 2022 17:10:20 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2066.outbound.protection.outlook.com [40.107.223.66]) by mails.dpdk.org (Postfix) with ESMTP id 3643440042 for ; Fri, 7 Jan 2022 17:10:18 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V1/mv455Q2cqPuB2ENlPXccVAZiru+1/jovMKPxghmHrQfFcYmd8DNph4qAUYuPJzMBEa8T4K7m3qGwat1RymvSQBc/g3fF2w8zagcFLA0wvD/MoElLn3D/eLsjB9z1srLdkdzBV7OztYrwBw596FtU3iigxybY0Mdu0WuZdYAZFuwREWF6GOqX8HFxlru3DaOA0JvXOsmtE/m3j2ixSp04pRf/ubkDVnjik21dSHAki7qhoBCNRzH/FJPBDoKKR8R2rnnhA7IQ1E5HJprZWHprVRAcpwjVbv+6QRXb0bucEAy560Fho9cag9h7PDTRE9cRx5ejgEPChO9lxtgN9hw== 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=CPnP5qFlKKipVdoo3Dei8x4O+w5b4cFBKlZ77NCdaHSkH5PuiUN4macB1zox6KpywS/7Qd8b7MvUBpOVUMbtDfLkoMh14pn1BsT9IOokuG9G3PHAYZadsdycCCJ+LuVRFtAs0mrVB/m/QVVLrML7lljQUegHSKKTVj9UbBJX1f6UHOZZA1zee70g2RY9CgxYqtM4ip9dhxGJMLdDvlr2H+s//YV5I9MgVlVg3IcEXaciOzwdVgKpXS8dWsIrar/A6gIxNjB0+C9yWIWf7AnUmV/gCqtOVSJAJ2Huk4xC5gVAT17I3pk79DQmzPHREVB/5IlCAZvWCS9YdFm76BaatA== 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=EJXwOK3EsF4X6QCw0OJdRmvmxr1SMrnDMHGxGgSJ2JHTpF9ej2urCyrmckJVBg/UMssr7U+ViPo9YI8E5obxg74OfXJFq0zAWawg4m7rj9VBFldnM4I3tsiQ1NDdKPOaXfp72cbFS529/ip2M6g3Zzq/42Q7DEP9B1vZEEqFa/AkXY6720kOTRBxI/dDv+uThdRVKGX6ZHqlpxvmJNwJFpv3CAhx4viTb73IMpFTJbood4uId3BRHKVVxsO41E3aoCwo8TjwD3imr6AOOR2b/t9sLEWETyCiL+FNnDM+86doUSzyFGVbqeE6AIP484ODIIHmD1/0yywbz5kH4Cjxsw== Received: from DM5PR20CA0042.namprd20.prod.outlook.com (2603:10b6:3:13d::28) by MWHPR12MB1471.namprd12.prod.outlook.com (2603:10b6:301:e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.9; Fri, 7 Jan 2022 16:10:16 +0000 Received: from DM6NAM11FT005.eop-nam11.prod.protection.outlook.com (2603:10b6:3:13d:cafe::ff) by DM5PR20CA0042.outlook.office365.com (2603:10b6:3:13d::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.7 via Frontend Transport; Fri, 7 Jan 2022 16:10:16 +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 DM6NAM11FT005.mail.protection.outlook.com (10.13.172.238) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4867.7 via Frontend Transport; Fri, 7 Jan 2022 16:10:16 +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; Fri, 7 Jan 2022 16:10:15 +0000 Received: from nvidia.com (172.20.187.5) 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; Fri, 7 Jan 2022 08:10:14 -0800 From: To: CC: Elena Agostini Subject: [PATCH v2 2/3] app/test-gpudev: test aligned memory allocation Date: Sat, 8 Jan 2022 00:20:02 +0000 Message-ID: <20220108002003.21153-2-eagostini@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220108002003.21153-1-eagostini@nvidia.com> References: <20220104014721.1799-1-eagostini@nvidia.com> <20220108002003.21153-1-eagostini@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 76a905b2-69de-4f15-c1a0-08d9d1f831a5 X-MS-TrafficTypeDiagnostic: MWHPR12MB1471: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: HdNuUU0sdBIwlvfJHTMfjw8cgb4c2xvI8EtzBLiOAYx5vJxSb9xbnP7FHPGGYMAuLEFPNbHGnKoTzTNf61UnZ5QkmLiey2EJRaIyGDN41Oam1zAQZXMoBINulGZGTj8Q3QbrpWqFSNw1LTCrQzLcJjHkE74hgLRwWpfOMgC5GCOx5gxd8qquAekaxtK0jZGifquarjJwL4SuTI+baU6dXh++e6An/oDaIKhZvv5lFIE7Gj++fdLqygmOEtjv6A8ciDVc3icCGpwG7frumYuJmIXV+6XIknrkfSrCj7K0ImQ5IoqF3FEItSR+9i3kBTMryLmFAbonGan9bOo4QVHl3lNC9aJvEg4oYJuEKoMqjBlptAkmcktfw7quc550BETpzL7BkrJ9MQM9u8u2iQN7gLuYc2zQJdeqqx0+4kYQHESi84OFcCWtds0fr/tADPv3spGQ230t5ehsdZ3AR32DAzvDlVu97UEaCGXCuqM/hxZksM+Af3jgn3eD9p3aTI4Mno3LRmHTix/N4VGu+bagEVAxzrZr+kOR/NSphp9vgE9rgFnXeQ0Rkp/11CYEhs85VBSB5m0lzhJ2hgrFz9J28Qf6b9tTMYOS1U9D3nhfRmwza9Zl8zmkGMfIKrSSRXlFucH8C4F/vDdmtnjr5Rj+cfDoERU1jL7GctXI5ZEI787ZQ+zIPKpj5AljyTnNed4xEK8wi21qJc9Q8SVNsqJYO/kqZXOTeX4P2NAFUatv6Crkk0JAgAyP31LyWm0oMxhm1I7iRPRQEMyuAl3lB6R3kJnwvc98yTPdYYwhAMGcETo= 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)(40470700002)(46966006)(36840700001)(2876002)(81166007)(2906002)(36756003)(7696005)(6286002)(508600001)(55016003)(70206006)(47076005)(4326008)(70586007)(83380400001)(6916009)(5660300002)(356005)(336012)(426003)(2616005)(6666004)(16526019)(82310400004)(186003)(86362001)(8936002)(8676002)(36860700001)(316002)(40460700001)(1076003)(107886003)(26005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2022 16:10:16.3270 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 76a905b2-69de-4f15-c1a0-08d9d1f831a5 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: DM6NAM11FT005.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1471 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