From patchwork Wed Nov 22 11:44:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "He, Hongbo" X-Patchwork-Id: 10070313 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 48BEC601D5 for ; Wed, 22 Nov 2017 11:44:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3873F297AE for ; Wed, 22 Nov 2017 11:44:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2CB6F29C01; Wed, 22 Nov 2017 11:44:44 +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 D1ADA297AE for ; Wed, 22 Nov 2017 11:44:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 202596E634; Wed, 22 Nov 2017 11:44:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0087.outbound.protection.outlook.com [104.47.36.87]) by gabe.freedesktop.org (Postfix) with ESMTPS id 696CF6E634; Wed, 22 Nov 2017 11:44:42 +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=GZ3uUmAmBkZnNVl4DExYYuMPXRwEvRQVNt72nYiNeCA=; b=zPL3ChFmz3FhuWmIlq7Kmy2uUlJu25OzzZ2n/ZpbWHeWsDag2U1oh2TwksMN1fTF3sZu7PEBTxRK7iA9TKEdHYMnUBJsoT1BR0X7YrurEdBxWRSM7nIdIFc1Em09PqYE2JESCRITYo3fQpOAX5gb1DJpNwGyTa+4gW1fucJBvD0= Received: from CY1PR1201CA0022.namprd12.prod.outlook.com (10.169.17.160) by CY4PR12MB1270.namprd12.prod.outlook.com (10.168.167.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Wed, 22 Nov 2017 11:44:40 +0000 Received: from CO1NAM03FT044.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::207) by CY1PR1201CA0022.outlook.office365.com (2a01:111:e400:5b9a::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.239.5 via Frontend Transport; Wed, 22 Nov 2017 11:44:40 +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 SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT044.mail.protection.outlook.com (10.152.81.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.239.4 via Frontend Transport; Wed, 22 Nov 2017 11:44:40 +0000 Received: from roger-build-server.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.361.1; Wed, 22 Nov 2017 05:44:38 -0600 From: Roger He To: , Subject: [PATCH 2/3] drm/ttm: add page order support in ttm_pages_put Date: Wed, 22 Nov 2017 19:44:28 +0800 Message-ID: <1511351069-4757-2-git-send-email-Hongbo.He@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511351069-4757-1-git-send-email-Hongbo.He@amd.com> References: <1511351069-4757-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)(6009001)(39860400002)(346002)(376002)(2980300002)(428002)(199003)(189002)(8936002)(575784001)(77096006)(86362001)(97736004)(50226002)(5003940100001)(106466001)(5660300001)(189998001)(47776003)(105586002)(6666003)(2950100002)(4326008)(53936002)(110136005)(48376002)(50466002)(68736007)(72206003)(450100002)(478600001)(305945005)(53416004)(50986999)(2906002)(16586007)(316002)(356003)(36756003)(81156014)(104016004)(81166006)(8676002)(101416001)(76176999); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1270; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT044; 1:MOx926/Rnx55o0jtHUiSCi+HfLANm36pK/IIIdpipKfCGOP3PQJgz/XqyMHekKfrCliLZhhF3jTNksF+yQ+234UDBAitS1jSM3W8ZKRCeE3UgP77SNDMJ4U0wqGyjSyW X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 86f5e060-9763-4497-b0f3-08d5319e6a97 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600022)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603258); SRVR:CY4PR12MB1270; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1270; 3:cDmyj465W4p0nI56NZKlqyKgXs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6iPi64Gl48PBD34NDQxbHD+2i+O3qSxQlL7BjGIZtFElYj9tgIuEYxr61jr9an3qo7RkpmfkPWa3UkNDvAbASEoQdUQMe9Hc4IPScnndM7ZXXWuc/hjzjUMTBZmlrlfiLIRudgiY9Cd9BuEelu/A1BkPckTDFS3026+5MXYxsf53lDYbOX1Cz9F1+9/ulwIeuvm3Jz5iLemiVGvIQPDWM01x34hbuKxr08MP07WDZC2OtnlEZTar+CmzDdhC1PySe70pfm8cogJjDA9iHRE3hpU/as2P1ShRH9jEwaMWg6+dc6yCAbpNGJLf37Xc7qj/mffxhj7qI0VRJ+dW/n3aDGh0PR8pHPfusj7mg/UzPDH53CfR+ULXekK0IjIQ5R9Nn+xTtUNrOihgZZ/XlnPwPUHoaGCqGdlZc03nWW/O0tmSrVomkneWIAJwDOawuo4dHrJnjDVd5uomJGyeXK X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(3231022)(100000703101)(100105400095)(3002001)(93006095)(93003095)(6055026)(6041248)(20161123562025)(20161123558100)(20161123564025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR12MB1270; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR12MB1270; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1270; 4:zV8Scavrgk7BzFh7xQ4GwgjYYK3dz6rLXUd34Q/PXR7D/XjPhrrL7NKzqtXE4Lryj2NNCgFb3WVkYcPi2uGinGdMw9ED0DMLCcLmZjM/+Kixk1sV+BmPEZYFRxlwszBGlF1n4tQRVDeN8ZM3IslqLnerroBDfQvuaQrgCWiGRIBUBus8n6CmqseJB11DYjkjF9vcq8kx5G2SNVN0a23myZCxTNYyr6l5XXbe+ZkxyCiFgLgh3EL9svxFqwsDNssrTRynPS3BI0c2nXTaP/9Ic5DJsGqIHA5o+zi62cv+fe8rCKFzDQsz0fgCRrfy3fOx X-Forefront-PRVS: 0499DAF22A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR12MB1270; 23:8NrIdFjAxUd/C4sDrmclcc+HkSe06duCijrBdnF8o?= =?us-ascii?Q?fXa8/QR8HdthSN1Mt1FFuCRZX15npWU60yhTAKYUlESBbTh4HwSbkBfbLenA?= =?us-ascii?Q?tzZz/ptvXk0JJeyBcdQ/MxOojO23maCURfxyC9+yxwbzpw8cIaERUp2YTyJz?= =?us-ascii?Q?AUkYE/LiKTDju94tgqchtpsAEECKEB0vLzGh7k0e/+2cxfbxnx3rMgkoq6w1?= =?us-ascii?Q?2/bWCljoUGewB6u2iN7ShRbVNxD7oLRXY0PNMQCA3HIPC3LlnY4Pw/dQPnmn?= =?us-ascii?Q?dN71eJX+AKUlTseejLDj47auJhHcFeZ1oBBGDWfvY2e8KF4cVoPDq3d3sWFv?= =?us-ascii?Q?DwJZ88fCnHP/kVQ6T9AnfVpawsswX6jMhCyVKa2/EOBshp9u4JzeQ86d71+6?= =?us-ascii?Q?rSU1fERNdsFeRxDioaAFmOfO/OVr0Z9XR04ajBkR514w+N8xUq5cfB+cEvXU?= =?us-ascii?Q?U4oQRT7Gi92FZ5Nfg8aXB1zvnzH0mrafBEBe7Z8GDNJNtXckJ3xj0ywe2+Uk?= =?us-ascii?Q?7vP8QY++vGl2r9R2YaLHYwAhEqDCPRhROEhezQfB6cOui4KMvIpqxdtnuJ3j?= =?us-ascii?Q?VhDYbrdm2eRGoAKQpLjLAH8xxSGpC+cK9QzMk4HYbMznMUZqj7sTyT3rBIm/?= =?us-ascii?Q?9v3Bby+2b9XXfEN5JC5Qqr59AYVumd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1cuVmtpWR2NKko=; 24:Eaz6NItvaebu015KPdEBgjrlhV9V7I+WSUWNHQNsO2poIY5PUwAcjWZbH+n+r+0RK0kwat43Cq65iIyxwVPUslyR8T0Fgw3dLc1IE4k+jss=; 7:3i7fey+qHAtpnSZhs55f5O43VKSEbCw19ovMEeu9GkSRINw+e822hbm/n5kmXkgsHv9mIK27xEMmphq+PdP1e+xKOsEDrqxYAHwjej2NmX0x8xjNtKhR6ngTRZPnmfXGcG+HgRH8SCs8yM5sj+uhLouU5IiqOpndR78aav2CATekU2WRBAQ1vdHENw5Xl8BqvNf++QT7Y83UXSXVBug3/qInMiX858CKYvzjRoDAEYjc65dQ5oCGW7ESLoj1y7Cn SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1270; 20:0ANm+HQCmkBNSPLd/2Lq880whOaHS3NsHqv6vv71HoSIaCO5UAswtx0shNFZcLNkL77VbjJio7cGNMJnAacnV/Ek3JOYNKoF0/dIINxBWFQ1CJ02B3OUc98qQkOyMm/7RPyu7WWAZJQ1qgSZMA61BhmL12W75yfPp5H8boIaSOxdXM178BefDuAMdKiCyPWtEUWOOcgFvuimlThkwyEvFSZOwivtGuBxcXohu1qSUqKpxpw7Me6hbE+xQJZ/O0cL X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2017 11:44:40.3994 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 86f5e060-9763-4497-b0f3-08d5319e6a97 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1270 Cc: Roger He 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 Change-Id: Ia55b206d95812c5afcfd6cec29f580758d1f50f0 Signed-off-by: Roger He --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c index cdbb731..25b0fa5 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c @@ -296,13 +296,23 @@ static struct ttm_page_pool *ttm_get_pool(int flags, bool huge, } /* set memory back to wb and free the pages. */ -static void ttm_pages_put(struct page *pages[], unsigned npages) +static void ttm_pages_put(struct page *pages[], unsigned npages, + unsigned int order) { - unsigned i; - if (set_pages_array_wb(pages, npages)) - pr_err("Failed to set %d pages to wb!\n", npages); - for (i = 0; i < npages; ++i) - __free_page(pages[i]); + unsigned int i, pages_nr = (1 << order); + + if (order == 0) { + if (set_pages_array_wb(pages, npages)) + pr_err("Failed to set %d pages to wb!\n", npages); + } + + for (i = 0; i < npages; ++i) { + if (order > 0) { + if (set_pages_wb(pages[i], pages_nr)) + pr_err("Failed to set %d pages to wb!\n", pages_nr); + } + __free_pages(pages[i], order); + } } static void ttm_pool_update_free_locked(struct ttm_page_pool *pool, @@ -365,7 +375,7 @@ static int ttm_page_pool_free(struct ttm_page_pool *pool, unsigned nr_free, */ spin_unlock_irqrestore(&pool->lock, irq_flags); - ttm_pages_put(pages_to_free, freed_pages); + ttm_pages_put(pages_to_free, freed_pages, pool->order); if (likely(nr_free != FREE_ALL_PAGES)) nr_free -= freed_pages; @@ -400,7 +410,7 @@ static int ttm_page_pool_free(struct ttm_page_pool *pool, unsigned nr_free, spin_unlock_irqrestore(&pool->lock, irq_flags); if (freed_pages) - ttm_pages_put(pages_to_free, freed_pages); + ttm_pages_put(pages_to_free, freed_pages, pool->order); out: if (pages_to_free != static_buf) kfree(pages_to_free);