From patchwork Fri Jan 12 06:14:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "He, Hongbo" X-Patchwork-Id: 10159635 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 32ACC602A7 for ; Fri, 12 Jan 2018 06:14:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F58A28906 for ; Fri, 12 Jan 2018 06:14:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 117F928912; Fri, 12 Jan 2018 06:14:34 +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 AE9F128906 for ; Fri, 12 Jan 2018 06:14:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6D9D76E6EF; Fri, 12 Jan 2018 06:14:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0087.outbound.protection.outlook.com [104.47.41.87]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2A48E6E6EF for ; Fri, 12 Jan 2018 06:14:30 +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=DBrcFOxBjzGiWXt7BgJHo1Qihv+835CkKV7s0Ggq+7g=; b=AMPN/XQJUGvnKuu8qPTqGd4juLe5XXkFkllDlRsRvRz6w8qOpxbn2eWK52ogZ46auTTR6swEbfcXd/NV0BMTOEdGdHghuRrFP/KfC7hXl+sN1BbaG2fXx2J+1Pd/OcoijutC0mt4Zg8ZVPGzMPLbbLPySBDSM/vGawmtXJhZIhA= Received: from BN6PR1201CA0008.namprd12.prod.outlook.com (10.174.238.18) by DM5PR1201MB0058.namprd12.prod.outlook.com (10.174.106.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Fri, 12 Jan 2018 06:14:29 +0000 Received: from BY2NAM03FT011.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::204) by BN6PR1201CA0008.outlook.office365.com (2603:10b6:405:4c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.407.7 via Frontend Transport; Fri, 12 Jan 2018 06:14:28 +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 BY2NAM03FT011.mail.protection.outlook.com (10.152.84.233) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.345.12 via Frontend Transport; Fri, 12 Jan 2018 06:14:28 +0000 Received: from roger-build-server.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.361.1; Fri, 12 Jan 2018 00:14:26 -0600 From: Roger He To: Subject: [PATCH 2/2] drm/ttm: only free pages rather than update global memory count together Date: Fri, 12 Jan 2018 14:14:17 +0800 Message-ID: <1515737657-2983-2-git-send-email-Hongbo.He@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515737657-2983-1-git-send-email-Hongbo.He@amd.com> References: <1515737657-2983-1-git-send-email-Hongbo.He@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)(396003)(39380400002)(376002)(39860400002)(346002)(2980300002)(428003)(189003)(199004)(59450400001)(104016004)(2351001)(305945005)(53936002)(106466001)(97736004)(105586002)(4326008)(36756003)(356003)(77096006)(53416004)(2906002)(478600001)(316002)(72206003)(54906003)(47776003)(76176011)(81156014)(48376002)(16586007)(51416003)(8676002)(5660300001)(81166006)(86362001)(8936002)(68736007)(2950100002)(6916009)(15650500001)(6666003)(50466002)(7696005)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0058; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT011; 1:wNBIHUoEd+MaKhfgs6gnxz07eYFaZkwQSon+bXoCjNagNLgDz7BA0zbmgiaRJ8hbEvwrLsad3tshs/K9aAK0XJY8Pr7bRXC6QAWDSMA4jVDbKd4onbq9GBQgEqjVZyTz X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2c1ea68b-80c9-4fea-f73c-08d55983bc8b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020077)(4652020)(5600026)(4604075)(2017052603307)(7153060); SRVR:DM5PR1201MB0058; X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0058; 3:+zOX9vc2f1ZOiSwkeG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xawLhKM7wCpG0N8a2rE521D0kQtmNv1psEDepcxhaWfoZMYk+rSWV8zNL8+L/8B5fW0rHCJbojhrtDhi46JuqpBSCiVZo/yJPbDDP73A2MbZnvvF1XdBTGSNtUJ8ILdXKty4e50PXo7J/ODHCoKNbvIwrfxF+j5G0eV2MZz5CE7me+I1HxH6GyFYbPg/jl6DNVItJxGN3pRGnuIjkOs6jVp+5EdMR4AnUJbbSvIbSt9rjmh6PDeHG58hieZ+67p7Y5ZkXUrs0GRTjWJEBgRNJx6f0vIncORkCBThxByB7xUfx+/AXIjb96NB+jBLBl9szD5sNKGLqgmo/2KYQ338SEEgTJhl7d6TO1xDSxlM1U3/Zjo4wLXejtRZXv3malSrbGFDWE7hf4BqoOoN2TQ2aBy99MHc/sfyeXLGXbWWQ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(93006095)(93003095)(3231023)(944501140)(10201501046)(6055026)(6041268)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM5PR1201MB0058; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR1201MB0058; X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0058; 4:rDcd+ayno1R9JmgYKA4O8/5ABHx9iZCaIuf//dQkr2YvR3TWzzNiOB8icSC4WgoXQFvjWqDZo/uDCb6Ch4sm/+oJDLQ6gLldScv5i3TuzqQoJz/etYJmo23/0Q78OziE/Bxk9QZjQEDB6KBv4ePoFKisZNSsqdI+cW2u4+29snR+5UGvo/2YN715UX7jl1vwSOdYTa4QQmOhoduj7xthe0uPktQMmaCJuMBxbTqe5etBZ3St7CNFmIePKZLIMalZPql2azRz7ox7grTf2prTK5bQIhEDQkyHWvuPcws2k9hxXObksDMxL3FmjN3wi3Jp X-Forefront-PRVS: 0550778858 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR1201MB0058; 23:OAgWW/fOA8WFlNgVv2HFjYieM6O8IYepzItsbIb?= =?us-ascii?Q?ekrdedy48yBWy0ordz1TdeXGGbC18U7Zak3KE4T5eiptvO245IlZBvzqQFXc?= =?us-ascii?Q?qQSLhphlvsT19WxIusbt0n4w1XmB0MLQaqNLEKJdcw0Tn5ufz0ie497jVtZh?= =?us-ascii?Q?Qm3cVoZpQ8j59zXGEd+A9lEAaRULp+nJWCPcivxVfPdaKJNi9QMzNXTIRMjD?= =?us-ascii?Q?WqjzLPaaJX8H6TrOTMsPzPl0CHs+nK9sQc52vrYVBEm8ZplGSqriDNsWyF/l?= =?us-ascii?Q?SC3u7qt284pw31fc5AoLJK5j57paqbODQI4M/1xr3moi8XGGSPGoWNoP6GQi?= =?us-ascii?Q?eK0cDVIB9vHfjmZqZ4InsLyoZKVRkLDUT0wylrxsRvLQYDD2ySwpfvVV9Pk+?= =?us-ascii?Q?gvOL+x4MkXBMVeiFf8HU+aw7WgE5Ji53L4HJulemOCtmwzbZ/DUa6n/QkdxX?= =?us-ascii?Q?iGFD94yASnTGNY0fR4c0G8+oNkVpYBJUKXIvdveH64GSrJw77PacJ3DYekFo?= =?us-ascii?Q?09t0zqO2Ax4vI8lFuwTbY1/FlLo6td1GNmS6D74uQP/7jHt1WFq3SH/l/sQg?= =?us-ascii?Q?oAINqsMHQR5a72AezKBlfWxCtux37ZYRwH5s1YuaOHDrkWqk2GOpo00O4Chi?= =?us-ascii?Q?A9/DPvStnUxE9er8hD//tX8SNG9jTRkepFpDnvLBju0B2cPG1NIEJAtn2Qih?= =?us-ascii?Q?jMO75zovBFKEi7EXeG0sdnI7YIw0L520zB2rTz6xmFvGe3fNYSGQvU38cpkE?= =?us-ascii?Q?THaqn21S/aaTc88nSjAOtj1fZCUl/7eQ4WMe5XBcfdbnOhQ1hwvms+FGvrH/?= =?us-ascii?Q?EKy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N8wOsLQ5LL80EriRrmLiMYGE1I2m2HlG0ac+VipvizMjAZNmDPFODVd1kD3MHGQeE3AaSRfus7Wi+/iwqNfqswoHHw6lwZsXedRyTs0cRXARX8TKOkYJ21NZBb2buB7PPBYOVGdSARO+/bp16MAPDrAIYu5Us3i5NSMIwJaCJgJ8suFq0c444BOiR2NAgNFIocwapC065HiyWEe1mzah2xVLX+0SGA1nE SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0058; 20:xVm7/XKG9dA6l3bBv0LnODjEOiw33PdTsyjW0tQNapjdWJT9vH9w5wS/nFMZiwXlS0iumQwsV/2wzhWkLYBUedD+CItBXdjMyyaJNrxIi32fv3wS663RYzYMgBhxJ6ZZ/wfddYKgEVdZwIyMZwRVb3Hk7G8dk4N12VtsQoicIF96Fd9g113Q/6UOy+JIWM46WlNGwcVusBIkfvYtJUBHkmXAYoVKfk96ihAkOf7CWS+K+NGzEGE9ROsdiY11FnpM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2018 06:14:28.0107 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2c1ea68b-80c9-4fea-f73c-08d55983bc8b 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: DM5PR1201MB0058 Cc: Roger He , 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 if ttm_get_pages or ttm_mem_global_alloc_page fail, should not update global memory count. Signed-off-by: Roger He Tested-by: Andrey Grodzovsky Acked-by: Andrey Grodzovsky --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c index 0eab24e..aebabf1 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c @@ -1075,7 +1075,8 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx) ret = ttm_get_pages(ttm->pages, ttm->num_pages, ttm->page_flags, ttm->caching_state); if (unlikely(ret != 0)) { - ttm_pool_unpopulate(ttm); + ttm_put_pages(ttm->pages, ttm->num_pages, ttm->page_flags, + ttm->caching_state); return ret; } @@ -1083,7 +1084,8 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx) ret = ttm_mem_global_alloc_page(mem_glob, ttm->pages[i], PAGE_SIZE, ctx); if (unlikely(ret != 0)) { - ttm_pool_unpopulate(ttm); + ttm_put_pages(ttm->pages, ttm->num_pages, + ttm->page_flags, ttm->caching_state); return -ENOMEM; } }