From patchwork Fri Nov 10 04:30:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 10052373 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CABCB6032D for ; Fri, 10 Nov 2017 04:47:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA6FB2B251 for ; Fri, 10 Nov 2017 04:47:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF3EF2B253; Fri, 10 Nov 2017 04:47:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3E79A2B251 for ; Fri, 10 Nov 2017 04:47:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1626A6E9E7; Fri, 10 Nov 2017 04:47:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 851 seconds by postgrey-1.35 at gabe; Fri, 10 Nov 2017 04:47:02 UTC Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0070.outbound.protection.outlook.com [104.47.40.70]) by gabe.freedesktop.org (Postfix) with ESMTPS id 623CB6E9E7 for ; Fri, 10 Nov 2017 04:47:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=6E2chHdJ0WF7rrJDyVTwcILqn03/XSnIcccNPopdJHw=; b=YeuagTFxWvUPsDzYND43Q/ekxe+IDO9U5LByMV4RisBxfABzifP5sJ30/oU/WK38heXAwfBoTEKcGDK1D9fdTknLEzO5ncx1oSkokWIPAIrBMQX0MXjI4ief1G3tOXqQRB/iMIYO+QRCuCXRPqlof0IBD/LF+Re4pjrbXWYe0vk= Received: from CY1PR12CA0048.namprd12.prod.outlook.com (10.163.230.16) by BN6PR1201MB0050.namprd12.prod.outlook.com (10.174.114.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.12; Fri, 10 Nov 2017 04:32:49 +0000 Received: from DM3NAM03FT027.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::200) by CY1PR12CA0048.outlook.office365.com (2a01:111:e400:c42b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.218.12 via Frontend Transport; Fri, 10 Nov 2017 04:32:42 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by DM3NAM03FT027.mail.protection.outlook.com (10.152.82.190) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.218.12 via Frontend Transport; Fri, 10 Nov 2017 04:32:42 +0000 Received: from SCYBEXDAG03.amd.com (10.34.11.13) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 9 Nov 2017 22:32:41 -0600 Received: from ubuntu-1604-test.amd.com (172.27.224.252) by SCYBEXDAG03.amd.com (10.34.11.13) with Microsoft SMTP Server id 14.3.361.1; Fri, 10 Nov 2017 12:31:56 +0800 From: Andrey Grodzovsky To: , Subject: [PATCH libdrm 4/4] amdgpu: Add memory over allocation test. Date: Thu, 9 Nov 2017 23:30:03 -0500 Message-ID: <1510288203-21716-5-git-send-email-andrey.grodzovsky@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510288203-21716-1-git-send-email-andrey.grodzovsky@amd.com> References: <1510288203-21716-1-git-send-email-andrey.grodzovsky@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(376002)(346002)(2980300002)(428002)(189002)(199003)(50466002)(6666003)(2950100002)(77096006)(5660300001)(450100002)(4326008)(97736004)(305945005)(48376002)(36756003)(50226002)(68736007)(86362001)(50986999)(76176999)(101416001)(2906002)(189998001)(5003940100001)(47776003)(106466001)(53416004)(33646002)(105586002)(72206003)(478600001)(16586007)(54906003)(316002)(110136005)(8936002)(8676002)(81166006)(81156014)(356003)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR1201MB0050; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT027; 1:ubbIokOZxUvGPz0r2SKury1BMFdCgSda73Qieu8siDgjQnfBJQGxUMb2fysMbs81fFGQevcV15M/qPoXqcvyNEiRQKl7BxJ3JrpU9XydF6Bh78+Ir9no//B/E2mWZgh5 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6184fdb1-ba00-447b-730f-08d527f41525 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603258); SRVR:BN6PR1201MB0050; X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0050; 3:mekd6SL8ALzBhSFGqHko0zXSd2QqfvrjlSI57JA5HpxcAzPMhGfz0qkG+Nsv47R/iJWe9XIDpCROqyXR799EhMPb77OzyEjP46Ll1dAWW40hV2FMW6zQixBexdSoHVegF6goRqE1QASMuQdytzmSXpHdlSU7V1tYvw8dCsKzl/SiK9TdyKlLMjZEVBKguOlW93R5cHMVb3xjv1bWvqH4DMh15eF7CoQeyCEQFGqe8D+QdrVYbWokJfaHuP9JxA8L2NUztXY+mgK2LBr7S8cufMi+gBhWvS+0JrpdEYglO/7n1nlqDfvBLW4L8a6FEuLF/AsBmtIbINgSdaKpYlhYtKbVeLp0sq3Is8pdJNxjWcA=; 25:0Fyzk1Io14uQYIMd4A5tbpuJJ/VNTrZqw4zUS+GEKSGVxPKvFVOqx0Y8c42WAeJTN5vC6vayTXSbtsXPqpbvCThIBjh4lr1RqDIjODdOUFd1840vyEBsfUdmf9woqKfuvmZQXJtNTmof/3NDSvdEw6sAacq0nI62Pyzj5S4qd1qXmmh/8m5sBpAdPcXSlENCNpgZgiAuwmWdxI0JAUj/K503qJPfyNrKKxBsgClgg/mf0ZXZ+RigjDIyBM1fzSLJelL89kml7wMoIp9oV7yAJhzACdiVwNybsU7wUQCUKflzZEBNLr/1VBsW4IVvoxBdW0mXunPc+aEK73fzq+e8cw== X-MS-TrafficTypeDiagnostic: BN6PR1201MB0050: X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0050; 31:bk7CxdbG6OV4OG7f6MnIW/T8FL/vW6HEMQfpfOVc5yEo9nYkbtgs8Ei+uwd1oLg2s+Lyk8gVUq8A/jtjMSaGMif52IwoDMO/zC6BCA+VPSu+fYAf/aZF71nprR29GzmJmmBSZE97YTwu8A6IaxU+trZUTXT3H6kdeyCFVLla+Q1twxCH9b+B2tY15M++Ng2R684JLwhW2ZwuakdzfuLspUsl7qkYfZoCKogwnpf6IwM=; 20:AmvoERDgR9amLGcl6C61Q06n8LH6kyYAObDaTDln4h7xMNz9gIY4oJgxal/89dGuLXzUrGIh0AuJdRQQepwGOhIKAZQEWPHay3V+ILdTdK4qfO0+m2EG7rR55RgeoH2Ula2vJZ204UxVEPR/Bz89GDDLIEtZ++OpGRAU2Y5fCVvun/oJZGHcYNAKV6d9ZjmMCY6jbTQtzv8mOcPdkzAQL7su8Ys+7r5bnFqa0MnZfLLvzjCawc/VKsuSXXDpgZkk+nZwAR6B8CsUKCx1ySrymb7ElwSsJgESUeiwe9wULxu2ktX6y5kD2s5dlTyGqe3paSG3u0jt0rATvjUGHrR/RPywbzvFntjDVYaXxnvw/FSz4dI1XDuLLnGPvLB/Xf4nMI3U5IaA/xvwoxUwCykdDQ76beIvlDyu6XrGl68oQsBfx6psTCkRxVEy3KVuHERJkgVeolvByfz0CJyZm14bOElenaVT/lJmYz1aLIPsLSysrxx64G+IURdEZBuXwI/q X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(93006095)(93003095)(3002001)(10201501046)(3231021)(100000703101)(100105400095)(6055026)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(20161123560025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR1201MB0050; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR1201MB0050; X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0050; 4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YtGWOfrdUVZXGyQQSFiA21qAMs7WUXsNiuIUoUFV2XDDqBM4VLJaJpYUkSmyZUM5ObiFJf6I5fMcTk4OcSX+iza5VELSMPAAn0VUj02WsJPTjKVZrmPHEObRpmGahQE/ZKjijWlHWGlr6x0wEUGTsiagftUY=; 24:59W2sgzW7xRMjGB5VBOii97gpFUM2jw/YyNuiby9yGdnuGMeWgHsdjhtav/llP7PNkmNMYYC34T5Bzs2pgV8NT0doj/EkiW4IIBtOZv5IOk=; 7:DkS7MqIjflpc39fAX93XG/81W+T5BbjU7IcS/KoR5QEfpZ5rjd6dwecfZtH4fLLYrmxDWMv7R2x2DZSj2n7aGkpVNk68rMO477sN3sAH771YPultxE07Ir1ICdmmd2Ua8aboffpfPWF0eMQEj1he1/Dj2mTiQbpzUf2MbrrH4NWSDliGLRuL2Z890tGnSMbiNTpFwK/XStFjeEFTOZojoOrR2K8s7Oz3+G+xbaVhGYxObwXEcI2FY+ywAmVBQwDM SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0050; 20:/1/duYc/eOrYy8XamLH+ia51xgjGkrDAo260qf92a45a5EAO16TYSwHwTBfCq25GZJXJa/0mGheNAKvWUEBNOqv/zOwxH6CuwgzMB4qf3TwGKVaAOVRElnG69G4jsJ6hg9Nywx0oT6epDeV6RgMr1zcQdrS+ZH38AbuCNrLNtLFJc3uhJoHQm0PPuClyLEf05a2xZ+SkragODPy5DPwm6lM9Wfbk0xOcqMd5I8RrXbYCHdgevkxfebfZUKT2yKna X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2017 04:32:42.1336 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6184fdb1-ba00-447b-730f-08d527f41525 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=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB0050 Cc: Christian.Koenig@amd.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Allocates 1 TB of memory. Test is disabled by default since it's triggers OOM killer. Signed-off-by: Andrey Grodzovsky --- tests/amdgpu/amdgpu_test.c | 4 ++++ tests/amdgpu/bo_tests.c | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/tests/amdgpu/amdgpu_test.c b/tests/amdgpu/amdgpu_test.c index 91010dc..3b10f82 100644 --- a/tests/amdgpu/amdgpu_test.c +++ b/tests/amdgpu/amdgpu_test.c @@ -417,6 +417,10 @@ static void amdgpu_disable_suits() */ if (amdgpu_set_test_active(DEADLOCK_TESTS_STR, "compute ring block test", CU_FALSE)) fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg()); + + /* This test triggers OOM killer terminating the tester itself */ + if (amdgpu_set_test_active(BO_TESTS_STR, "Memory fail alloc Test", CU_FALSE)) + fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg()); } /* The main() function for setting up and running the tests. diff --git a/tests/amdgpu/bo_tests.c b/tests/amdgpu/bo_tests.c index 4545196..c6d89aa 100644 --- a/tests/amdgpu/bo_tests.c +++ b/tests/amdgpu/bo_tests.c @@ -47,6 +47,7 @@ static void amdgpu_bo_export_import(void); static void amdgpu_bo_metadata(void); static void amdgpu_bo_map_unmap(void); static void amdgpu_memory_alloc(void); +static void amdgpu_memory_fail_alloc(void); CU_TestInfo bo_tests[] = { { "Export/Import", amdgpu_bo_export_import }, @@ -55,6 +56,7 @@ CU_TestInfo bo_tests[] = { #endif { "CPU map/unmap", amdgpu_bo_map_unmap }, { "Memory alloc Test", amdgpu_memory_alloc }, + { "Memory fail alloc Test", amdgpu_memory_fail_alloc }, CU_TEST_INFO_NULL, }; @@ -244,3 +246,21 @@ static void amdgpu_memory_alloc(void) r = gpu_mem_free(bo, va_handle, bo_mc, 4096); CU_ASSERT_EQUAL(r, 0); } + +static void amdgpu_memory_fail_alloc(void) +{ + amdgpu_bo_handle bo; + amdgpu_va_handle va_handle; + uint64_t bo_mc; + int r; + + /* Test impossible mem allocation, 1TB */ + bo = gpu_mem_alloc(device_handle, 0xE8D4A51000, 4096, + AMDGPU_GEM_DOMAIN_VRAM, + AMDGPU_GEM_CREATE_NO_CPU_ACCESS, + &bo_mc, &va_handle); + + r = gpu_mem_free(bo, va_handle, bo_mc, 0xE8D4A51000); + CU_ASSERT_EQUAL(r, 0); +} +