From patchwork Thu Jan 18 05:16:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Kuehling X-Patchwork-Id: 10172675 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 8B4D360230 for ; Thu, 18 Jan 2018 09:48:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F02426E76 for ; Thu, 18 Jan 2018 09:48:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CEF726CFF; Thu, 18 Jan 2018 09:48: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=-2.6 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, 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 0D33B26CFF for ; Thu, 18 Jan 2018 09:48:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D5AA46E616; Thu, 18 Jan 2018 09:41:18 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0044.outbound.protection.outlook.com [104.47.42.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3E5DB6E3A1; Thu, 18 Jan 2018 05:17:16 +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=BeOiP03QoB/2BHsI8zfxMK2FHuwlQwqDMx5ti/V90a0=; b=bOfR//I+SLmvu5I91bdaSCN4Oe7G7hnslOeq4uwZMBiqGB+ZFO/xOz3YnpLgwvAnU/XwmVFNn2b82U7St2lHNYyiYkKov029FqkHX1a9Q+mozQQSNg5wu/h60bhPuInAglkcI/dR3rp4XCFqagOxw0jFw/0TPGiItKaKGSMSGSc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Felix.Kuehling@amd.com; Received: from Harpoon.amd.com (165.204.55.251) by DM5PR1201MB0236.namprd12.prod.outlook.com (10.174.107.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Thu, 18 Jan 2018 05:17:15 +0000 From: Felix Kuehling To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, christian.koenig@amd.com Subject: [PATCH] drm/ttm: Don't add swapped BOs to swap-LRU list Date: Thu, 18 Jan 2018 00:16:56 -0500 Message-Id: <1516252616-27549-1-git-send-email-Felix.Kuehling@amd.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [165.204.55.251] X-ClientProxiedBy: DM5PR0401CA0030.namprd04.prod.outlook.com (10.167.104.171) To DM5PR1201MB0236.namprd12.prod.outlook.com (10.174.107.135) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a0ef1fc6-0cb7-4e1d-cd54-08d55e32bd08 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM5PR1201MB0236; X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0236; 3:HqwTlPfyeZNPov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1qnl5AsgKMrmGmuvh+WxK+yEKB0ErXQw8GB7ioJEluVzA9gWnArr1MoN0nrK9Oa7D38VFTf3hoVTmMq6Dk6chKuhzP9vM9194PQpjyZ0X3EZrFFbWfxAQLxeR5wkU+A19RQXTwkozMk2yFjJr8OFz4tXmZjVIZgAF52aM6J85vmt6EHhgTPr7JqWVhnIXb/sQ/LLl8jgt54a4tl45SOctV19rWlOJlKkUrtC/AtPvp0fSfro1QaKLG+U40bgh7R9414qJZeQHdYYbCPBnOMUudpkcyOGRNcOwdV94QyFcvLc0f3/4W0mC1GulZl7sP5Ykt0He7Jsd4V; 4:K0W6/M/5l1+94xSM5psXBLInIMav2Za0zmxLEFIoaQgmuUADzrUJR6SBPUl2K5ZMQQDAJsFUG+Co2hjZ364LjA+lqJw3vozRMzoiw36IW+9sQFsNKHGN+o2sxfOm5TZ4o1yz8N+jkpaZSV8hBilW7LQst42RBxzi3zLG48M4M+Qp5zlDZdPffzodxQqbNoGt0HemHTW6qRR0rDkTnbMBXdd67xqqz8ONZ1Hf5nnmex7aowM+qSTu62khdFiTXPtMKsNSFa2JuRyNvhurKO61GxsEZLD7KpL1M7+fsQq50TEZ9uOxC3d/G2+fKdWUKBGM 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)(10201501046)(93006095)(93001095)(3231023)(944501161)(6055026)(6041268)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR1201MB0236; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR1201MB0236; X-Forefront-PRVS: 05568D1FF7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(396003)(39380400002)(39860400002)(366004)(189003)(199004)(81166006)(81156014)(6486002)(7736002)(6116002)(3846002)(51416003)(305945005)(8676002)(450100002)(106356001)(8936002)(50466002)(59450400001)(6636002)(478600001)(105586002)(50226002)(36756003)(386003)(5660300001)(48376002)(6666003)(4326008)(47776003)(53936002)(26005)(66066001)(72206003)(68736007)(86362001)(25786009)(53416004)(52116002)(316002)(16586007)(2906002)(7696005)(16526018)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0236; H:Harpoon.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR1201MB0236; 23:fJ2g6UALnR15behpcqdUExSbbaTnh2PoZJRzKwT?= =?us-ascii?Q?4l3iDBdRaVu6SpUClPzHBYQTWCiRvj7t1BDs2KIEPRS+sQVsiRMhI1nBtxsh?= =?us-ascii?Q?HiGVy0WFKNiBBIISbLgiLJERpGTUxgmSsR2AVTz4eTV2YrokKpj3uOVkqXoa?= =?us-ascii?Q?qy+em8itI2G08YbG0b8WRt+BcU0mmpzfU0sOjn97REakowKgOGyVJ88HGNbV?= =?us-ascii?Q?NxMGxjAx+Xch73xJWo7BOcbasbTgkuVetVYJh/7aS2myq6TTdw/v8q3073sx?= =?us-ascii?Q?PZ/2V3ZB0nK5OyyjcUP+XJJe9qlH6pMFFQceEZzsKnFtco0Wy+k1yJjXvu8p?= =?us-ascii?Q?R3ciIHwMgfFR7+/Dk37X5gQfNTHpm2TOYfBmSVDy0isA3mD7R1C+cwGn1o6p?= =?us-ascii?Q?BTiFVCOq+KE+B+miY9rzFaCrKrNJ0cp3ueiB7oMIPgOetsJqvcsBuCn0xcDT?= =?us-ascii?Q?Qb+8ip1gAF0UJ32fiXQV0yReOPVF8RWwWZW54OZ5tUi2wmFS87NJj19mHide?= =?us-ascii?Q?0D7MTwgqOAj/w28aAPkhDjitFztKVwDJKEPcANFdQ5hRmLkvZ7wj4ypRrRNc?= =?us-ascii?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s2AIKwqezVFgbI=; 5:ZarhjDZBIMEAa+70gIbB2pUBwTc0QjLZ+FUlR7aNUxpA+AykveUUaxbixpsHIvv5balcg9fC9Qf2UkdNBhx5xQVlSaR4I8otAJrVIFZGb5+9rgfI/DG/ZhBXXkGJfbDn4RuaiSSax2haOXdMsrJfIx7iIYawLG6KQ4LULEBjSK4=; 24:EpMG87CIIQfFuHIf08msmuzkkYQYHSBppX3D68mBbDzuJCSjse3UmgQN0XCg4D/mcniPdKlTs1YWpFW4HIiFoVPIVVaQUElX0M5or/XH5NE=; 7:jqxTT99C71o1J3n2dJRHc2nwzzqqocG5TJgrB39WETU4vvhD6ySB7FQ4s5sGCDlrG6iO1xN1VtYQ9F5VelfqPketbEDUkztIYd8j+evNm8vhHAshRKdWe7/A4B5jVQMSIEXV8vS7IJDZ3rFiauGxEKDnDlyWUYBCdMfMJv8TyVSgaOQYbZ1zwXfCGW9vCpkHWQ4raghy0L5k9MmVXPlkhnyXh6/VSupij284CczxGktvR7a7koLzcfwyjs7mcsZ4 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0236; 20:3i2kqJTAkj69JrRGEHnjnTDcm7hr4lhWnkApnrT47ZrDWNrsZ6Ow6e/bgyOdifa+WjKDqOwA85PIjjcLcZF1bK2vhu/r2X4OLYTXo0OnM4TncWOr/3Ub+mhFV99Dzd3v8OGqM4p+F+LAvHlhRJPTDvNhD09gZi5TY7BZVQZruLdKatap08Q9dsYU8Xl8to9hXtD5MMdHkF/JBEdkVLRLOLsT6iMB9lbFXefu6CRWiRf7vkjpjSQ6lrZN1UTLjZHv X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 05:17:15.3764 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a0ef1fc6-0cb7-4e1d-cd54-08d55e32bd08 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0236 Cc: Felix Kuehling 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 A BO that's already swapped would be added back to the swap-LRU list for example if it validation failed under high memory pressure. This could later lead to swapping it out again and leaking previous swap storage. This commit adds a condition to prevent that from happening. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/ttm/ttm_bo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 97c3da6..7192473 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -175,7 +175,8 @@ void ttm_bo_add_to_lru(struct ttm_buffer_object *bo) list_add_tail(&bo->lru, &man->lru[bo->priority]); kref_get(&bo->list_kref); - if (bo->ttm && !(bo->ttm->page_flags & TTM_PAGE_FLAG_SG)) { + if (bo->ttm && !(bo->ttm->page_flags & TTM_PAGE_FLAG_SG) && + !bo->ttm->swap_storage) { list_add_tail(&bo->swap, &bo->glob->swap_lru[bo->priority]); kref_get(&bo->list_kref);