From patchwork Thu Jan 18 16:56:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felix Kuehling X-Patchwork-Id: 10173719 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 1EB60603B5 for ; Thu, 18 Jan 2018 16:56:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E0E71FE8A for ; Thu, 18 Jan 2018 16:56:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02B672837D; Thu, 18 Jan 2018 16:56:47 +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 B20E41FE8A for ; Thu, 18 Jan 2018 16:56:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DCE996E6A0; Thu, 18 Jan 2018 16:56: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-sn1nam02on0067.outbound.protection.outlook.com [104.47.36.67]) by gabe.freedesktop.org (Postfix) with ESMTPS id 02F796E699; Thu, 18 Jan 2018 16:56:41 +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=5MLuFTRMQXgVd+euk5hRocpROiQcpfTV6BZQFlhfA/0=; b=dW8A8rgNcDNjZSw/z4amZCF4UZudj+gxcjkwW+kNmJPQCJOrK7WTm2hUpE8HDdQoxMi1AuLSHxrIK4lYIhlfjx4NO+QHKvLmY0xHGqxf0Wr5ZrMgYU+MWIc8M14VXMCallr1a2njW6MdQT1gssrGB9Mxlfwyexe/kgDjfys+xR0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Felix.Kuehling@amd.com; Received: from Harpoon.amd.com (165.204.55.251) by DM5PR1201MB0235.namprd12.prod.outlook.com (10.174.107.23) 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 16:56:40 +0000 From: Felix Kuehling To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, christian.koenig@amd.com, Hongbo.He@amd.com Subject: [PATCH 1/2] drm/ttm: Don't add swapped BOs to swap-LRU list Date: Thu, 18 Jan 2018 11:56:16 -0500 Message-Id: <1516294577-29078-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: DM5PR0401CA0065.namprd04.prod.outlook.com (10.167.104.42) To DM5PR1201MB0235.namprd12.prod.outlook.com (10.174.107.23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 231e6706-d77c-43dd-c749-08d55e947205 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM5PR1201MB0235; X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0235; 3:0iwS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iw+OTL2sp5JTgXsL0R3ZTHsUawBywyf7JmShcdsbNKiAWziI+1yniF20wYeI3+tEBw4488I64zY4sd9aevoFynvXXlhiIQkm1VZR//2cPjVaRztv6lX/NVtbTv2rDOGpeS8TwpeQKvldzXu2nZrYFiWIgw9Q8roX/idnFKAEtN1VEHt+JluOc8ZzYVRTx0BhWUC9SZ0pxYkw/8XzgaD70h46hknjIX0Ey0OVbnUVuCB38JdXPOaAUV3TZHggBvZRhMfAvOZg+rWgFBnwVpceIR6Hkk2S4LCcOt4OkleebdOyQop+sxXNP8wQXNQhbPIBxuHXvN5v8mTNaqlDaWdJPpojBe; 4:7VAkm/2JKzcQ703KyKwbcsGz4NtustV0rP7/lwhHHqrdwFWumnl3v2lf0SsimWJucqnJ2SLnNfLRLS1t2GEkEvI7GfPl1OiHN1Ic/hzb7Yo1GMWkmigNGBkAyvC/0gzt8AXx52zZCMM2CQq7e3hhDvnJ3qfC+dlVMydNiEh1HlIDRrHKde5XASSU0F0tcyWeuUj3HM90v8/1mXv5napQR9TG/7mMrsRAbdpnmEf9x/Un4vhwOLXzuFpHQT9TVl56wSr4TB1TZDBzeRq1fl9KFvoGlN/+Vyi33u6VRB52aOAqiBuuUOGh5juPkw45GwaX 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)(2400064)(944501161)(6055026)(6041268)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:DM5PR1201MB0235; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR1201MB0235; X-Forefront-PRVS: 05568D1FF7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(39380400002)(396003)(366004)(39860400002)(189003)(199004)(72206003)(5660300001)(478600001)(25786009)(97736004)(36756003)(53936002)(2906002)(450100002)(105586002)(53416004)(3846002)(6116002)(4326008)(106356001)(86362001)(6666003)(316002)(305945005)(81156014)(8936002)(7736002)(59450400001)(50226002)(47776003)(6486002)(66066001)(26005)(81166006)(6636002)(68736007)(51416003)(50466002)(16526018)(52116002)(7696005)(386003)(16586007)(8676002)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0235; 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; DM5PR1201MB0235; 23:7PwTa3G0igaNrim21aJx+hzA/dzRr1sqC2eqLCj?= =?us-ascii?Q?uUveviv+qNgM5dmGOyO2NcU+NUCJqK3e7dVZvBX4tT6Zwkvo+G9yADny1y+J?= =?us-ascii?Q?XE2nM0lAJPuOmyDGZny+Dz0OgocnYi0OLa48cCpjWZXXM45rDdf934YW6JTa?= =?us-ascii?Q?UloEj4amo2+UK/VWEiXPV5GxgEfDW9dgpb2cm7lU3cymyjt/8VeEPIZHW84K?= =?us-ascii?Q?nbBovD9TfCwXNdGi76EIR3bNEnLEOr4TAUwLs7aWDxWp3Wl9dMv8/UthkMnO?= =?us-ascii?Q?MbmQF0DBKK/esnAl83neEKA6yCWGL7P6fr6brYN/L6H4r4VaF2VfJpvA+SDy?= =?us-ascii?Q?62O6+MBkUCFiz+ZJ2g+omQilYZVQftb8B7RFblIxZjjnht9MEtvs+sS0e6xU?= =?us-ascii?Q?metDrOLbWr3juJc8iVctPd1tw2Ot2sn7Rx0nTjd5I9XIiwVmLtUl6u1QMuAg?= =?us-ascii?Q?H9fQ/iC6POD092slp41Hl3Qjql56z09LcrgVFBXvz2ctU/xf64p0a8ynj+KR?= =?us-ascii?Q?1e6Ibf7eMh0Oc+nbnEGUuPloYp6XtwCgZL62/mQapgIdFTQTk+6VESHnkozZ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aUZFM6cXM53B+WWH194kWT0kXOjHo=; 5:3PIOQBL+GblMNTe3oO1rckuJhNgOc8nJ5p/7WIyAsU8kBRIJywW18Dy07tkcgRytK1JxggoSyzB6NeT5rT4VxRKxevwVrfdsphcJHja6eeBLiPJ7EpLeFOFbFj+HLv55E6U1Pk6u2OLRf82elx7LjIr1mx8o4A52hU29uTQ4/VE=; 24:svzs/xqVx1r935/UQ//Xl7wCZKy0SrwTT5bbL0MFNtpigPDdvhixJi8p3Gz65uVQH7NhkvMv5yIw8rbnDRoFCiGfUIzqBgtjpRf4pfvGtvU=; 7:fN7rXR2cw7FUNDAW7YpX8kSZCUXReKEfiGdu9pyrl8oCIcQX2wlHN3+Tm2QDkJcc5C2DfvUpBc21w0+gGt8q4JDBSHXIPmOSE6WiF50p9yo3gXCKVWJIyQzblNENQH7ZQ1iZ4W/6zcdSZ6Q/v+n9v0Zj8O7qt7m52qT80YrtW9o0AoX60E2JoG4F0Ra091SLUWpQWAt7sb239VvnX4TRIVdvnH5xUgtqpHpY7smdedBOX0qPXLK3Bf6pJJRxOypX SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0235; 20:ZvFr/aBcZQHXjY08mfU+a3To4nnKWMwlX3nUpPJ/msziE+zn8boWOfkrXw1AuR26pN6yaYIHNq7F9p/lDXzVvv785R8cDl6GsHbH6Aq8eAzzl77xiv07jKfzUXfAPqlmoK7HDEvBx0Yy1PynIggbgA9POEZVaReoD4Z+3O2pCs+jANf5jOOtiSW5ZG0dofs6yhndcNxgswilurFDpgbO2qpX4WMKNTKmE3UUMb9ACHbw2l7sAjx+JirpI2m05R16 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 16:56:40.1601 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 231e6706-d77c-43dd-c749-08d55e947205 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0235 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 its 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. v2: Check page_flags instead of swap_storage Signed-off-by: Felix Kuehling Reviewed-by: Christian König for both. --- 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 2eb71ff..62518b6 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -170,7 +170,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 | TTM_PAGE_FLAG_SWAPPED))) { list_add_tail(&bo->swap, &bo->glob->swap_lru[bo->priority]); kref_get(&bo->list_kref);