From patchwork Fri Jan 26 10:22:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10185421 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 9B55B60211 for ; Fri, 26 Jan 2018 10:23:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A37162871D for ; Fri, 26 Jan 2018 10:23:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9714928BA7; Fri, 26 Jan 2018 10:23:17 +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 1C2582871D for ; Fri, 26 Jan 2018 10:23:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A6E536E4E2; Fri, 26 Jan 2018 10:23:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0054.outbound.protection.outlook.com [104.47.38.54]) by gabe.freedesktop.org (Postfix) with ESMTPS id 188706E4D6; Fri, 26 Jan 2018 10:23:13 +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=xDLntdhhV3Jk/UL4/4HbJ1wZ4qlSUUAJlnrkTzciWHQ=; b=zIsUTLsLM1+B1gLAq9d2l8+xEXKMhLMlAlE7pto6bVcml9d3h9LpcHmGJG3Nkn5zdmive/mA139npoIwDFZOphgR1TBCRMMHEd5YV2OMvFCUwU5558uZThNo6ojpHtw9re98xoE5perH41rYhyoO9s31OSOHOq0KUB8Fgm3RUks= Received: from MWHPR12CA0064.namprd12.prod.outlook.com (10.175.47.154) by MWHPR1201MB0064.namprd12.prod.outlook.com (10.174.98.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Fri, 26 Jan 2018 10:23:12 +0000 Received: from DM3NAM03FT027.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::207) by MWHPR12CA0064.outlook.office365.com (2603:10b6:300:103::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.444.14 via Frontend Transport; Fri, 26 Jan 2018 10:23:11 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; shipmail.org; dkim=none (message not signed) header.d=none; shipmail.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.444.13 via Frontend Transport; Fri, 26 Jan 2018 10:23:11 +0000 Received: from zhoucm1.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.361.1; Fri, 26 Jan 2018 04:23:10 -0600 From: Chunming Zhou To: , Subject: [PATCH 2/2] [WIP]drm/amdgpu: fix scheduling balance Date: Fri, 26 Jan 2018 18:22:47 +0800 Message-ID: <20180126102247.17923-2-david1.zhou@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180126102247.17923-1-david1.zhou@amd.com> References: <20180126102247.17923-1-david1.zhou@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)(39380400002)(396003)(39860400002)(346002)(376002)(2980300002)(428003)(189003)(199004)(305945005)(5660300001)(26005)(356003)(72206003)(53936002)(478600001)(50226002)(50466002)(186003)(86362001)(2906002)(48376002)(8936002)(2950100002)(6666003)(1076002)(36756003)(54906003)(316002)(110136005)(16586007)(77096007)(53416004)(104016004)(59450400001)(8676002)(81166006)(106466001)(105586002)(81156014)(76176011)(68736007)(97736004)(51416003)(336011)(7696005)(47776003)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR1201MB0064; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT027; 1:j2oyn3dCr0Aw2IuOSSE5proFMynpCW9AxekYyl4smqvXz8dmaFibTuy4IsBXJ61ToZBN0WOSQOHwcRbbP/0dPQW6yALJG+Id8+R+9UY4d1mrhgLKVHbEXSW7mbUccuqa X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2002642f-37eb-4743-b99a-08d564a6cd77 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:MWHPR1201MB0064; X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB0064; 3:gXIwTUKv4viucd0jp2akZ6TrVUUfJ1rhppjm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x+HbsYMpaUcPLxY/00qHA30XjZECtWIWed8uGYHoKsngGyvKfQ3jg8+X+t6Acs3bgBplSLnwnxPoqtaohvcZoI9Vjz4ewyfKcpkURrDbt6JKoAMi8yLcgiuGvTX9lITxpoj7tdCu+m58wZ0Yjm2U1h4Ctdsnu9T8G0mn7NsB1SoeXss1HenPmR1UgCt/RH8KTUWXSHwpftp/noD9brkB7wP4g/IE4nISzd/dXKpLRqvnMbTox3WCjPt7cXdUPjY1+CL9KLwsES577Di/HAtjV3jSBPyuzQIprAaqWQBXDGt45fUPqTgrb8opKd37xzwwf1e46GwG33Fff33dKAApJiq7vy8pMN35Bscnd7mk3dm4V3yYnHYJkJz0GRm7LYewNQELaxO6RlJtaFoUolqAn7vUNC94bBMxa3W5TLgPo2 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(93006095)(93003095)(3231023)(2400081)(944501161)(10201501046)(3002001)(6055026)(6041288)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123560045)(6072148)(201708071742011); SRVR:MWHPR1201MB0064; BCL:0; PCL:0; RULEID:; SRVR:MWHPR1201MB0064; X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB0064; 4:MfoygzAtS5vrjO7gp9S0+9QfoBcVTrUobM3PTPIdGS7O9Ux0GEFb1rDxMWCcJMIOuqqajzXNlEmTOhrvO8E+TmwekJKP1l5iWXT1YwKwP/Z+CvBwWvi+N6VjTUb4OsIV4YKNJZiPFr3HbZGbT1dLHDlCLRuSq247scJ4r8cIUuYOIsoWxIXm6w87L9fORCnFIrzuarXS+QjvlND6DGsapqdtcjQBWFksCzxJokvxfkJxPFaMvRjanmFHs5RxsQFRKlbew4MdhmnwsaooN60+AqQmRCANr4STAtQFmn52Pgjtbx1SMXKmq5nyIDyyw/yU X-Forefront-PRVS: 05641FD966 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR1201MB0064; 23:/q9JdEoW/sUoXi+i3rUxxOJ/LpeQKCL85oVCl01?= =?us-ascii?Q?tMcOWg3iTEq7Tb8GH11t19XnqYrs3lzqIHLJ0MTA+HczKJJI4sDgAJ65flHd?= =?us-ascii?Q?VgCKSY4llvdr9lNq+X+nTfE31nUjv9JCaVahqaVyKWNzjC+YMS6k1I6qcZi+?= =?us-ascii?Q?nojbAXfk2vFVckVCoH1bCoOHI5vHeIy329bxjyXy9TXHO+u4OLsYEzEzbCkj?= =?us-ascii?Q?oD219kqrF0WEkp4tHtInL67wKMdIL1ninwI7qu9Xn826LN/EPph0YbwK3E8E?= =?us-ascii?Q?Ur96fxcpC244hFNiKXueyFqJuQptoFjr7oaqopaC1r66CvKW+HdvvRii9Kyk?= =?us-ascii?Q?haB8G/GsqcVU+2DGTkwZ1IH9pYKeyCRTSBtLSEI2VfMq/biz+7K9Q1hn6au6?= =?us-ascii?Q?ptM2DEYByQuBLZhKCRdRz5xCc3t06cOB681Xzpjr6MGezrLXR8FNc93UdVlZ?= =?us-ascii?Q?Qy9iS0yItbLoFmKHuszIAlsmKi22hf0dsfAgNmtsb9uOWCoabW5375GMoQQ9?= =?us-ascii?Q?IbV9mDXsdX+I3S/3uXhQbetzanZc8YLPELtd+Wfo7aUb3mjVpNrShExnoEeS?= =?us-ascii?Q?JS9WMWmikqgSWIg2xnsqQuVGJHKMHjIVE7rvGVKLtH/Ku+rsTjy+s/cY6dQi?= =?us-ascii?Q?ZtPqWk+IwLCPqMruokFDeKDbrRP+aVNla0RGODz+ULfTfieYXyT9qi0kzSW6?= =?us-ascii?Q?sqsXueDUTZegp0bCtjqKQ3QsO7KhblMX9CNWSBFXH8PC8W4JlQTLCjt5iAm8?= =?us-ascii?Q?1rCq05SEzpIi+kPuyAo6lmw4YLkxMke5Muru2kOqiEMSfNtDewNMir++e4ag?= =?us-ascii?Q?dTBjMX31y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7:a1s2zwxEvnxBDGj6OcB3oDNl7utnUuZqOZk83AQXgr128Ehep68DA3r69TcBy8xR7RyBP12IvPc87GqHcG4C6dxzICvsD3ZsgRbj8NvXBDkM2XaJSMgIVnP0vR2ywq6FMpSpyoV6PFzAMD2q6QrNwIYi5+nz+dHBdPSVTxLkI3Hckgoa8dbHaqqvSowRWPLvSk9eQanf2bTk+hXlXCiMuVHPZRnLrAHgvRqO8CLuv8bIQsO8zRc21hBhhiNEkrE5 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB0064; 20:8T+7NE/Qxd+5Ojo5CNe3Cep2mz48pITya3Ems/Q79JyhwpUED+br1qiS3kbTh5vPzbpnKyqrS1IS2SEPKgnOU5/n+XKLf4Gz0rPqRPNQYi5XVR6RfsMWNKxdMP66b98CMF/JnGzeq/gVoHap+U3vA8Tj60+xf/fy+7eqEKfRdY/LHV9OTFubG63JTMgycQZbh1XJAGC05mofUP6NgRkru1MtNco3IHNeYn6OP/VZ/RlEnkTFwO3lFpBIKBqqK/S8 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2018 10:23:11.5129 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2002642f-37eb-4743-b99a-08d564a6cd77 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: MWHPR1201MB0064 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: christian.koenig@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Change-Id: I6535023db57d4ff5e79f7928595bf8ff1f60f23f Signed-off-by: Chunming Zhou --- drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c index 7abc1f3251ea..5bed3d8e364a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c @@ -173,6 +173,10 @@ static int amdgpu_gtt_mgr_new(struct ttm_mem_type_manager *man, spin_unlock(&mgr->lock); return 0; } + if (!ttm_man_check_bo(man, tbo, place)) { + spin_unlock(&mgr->lock); + return 0; + } atomic64_sub(mem->num_pages, &mgr->available); spin_unlock(&mgr->lock); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c index 9aca653bec07..7202599bb67f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c @@ -121,6 +121,9 @@ static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man, unsigned i; int r; + if (!ttm_man_check_bo(man, tbo, place)) + return 0; + lpfn = place->lpfn; if (!lpfn) lpfn = man->size;