From patchwork Tue Nov 9 13:16:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pan, Xinhui" X-Patchwork-Id: 12610741 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BD24C433EF for ; Tue, 9 Nov 2021 13:16:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2097861130 for ; Tue, 9 Nov 2021 13:16:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2097861130 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C06AE8970E; Tue, 9 Nov 2021 13:16:02 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2084.outbound.protection.outlook.com [40.107.244.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id 99B92893A2; Tue, 9 Nov 2021 13:16:01 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D0/KNcn0YQEIi4a1UqXfNObrV5f276pyRZJCA0alEaHG0H0CHrZEIJo0q/u3ZW5Pu3sYKQvtUJ3oRpyNwfIIcm5v0jCkle9W/UUKZN45wgy0b+ibIDxoG/EYpTOqc80Xqy6j57KkpSOmPUwwaI0MZOdm/H8+RhRPwsMAQocdmuyq5UZcrGKT27clsCkJmSvyce5k6fCAIgAEuCunyJu5Modfh/izcSl+dTv3j62PH5XMni5cTKX1W/bqJZc1XNF303AVO+Bss/Fw32a/EQlCFQlP36kXZ00RWCS8kRqdCicnGBICVM+bpnNNyMRM04FF7Z1840CtwFSYipo+ZgyNgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cPKWIaU9c5l4F0NorzLLaVTxW5NhkijlH7NoRubdrZ0=; b=VbqqyPu3BKI0bW69WoJ1oRSPDWMFBvIWjfSnCPwRylVt44zBn+rC4HtLkr3oTPaTENOFbmfFw/nGSMgmXxJ6UK7lCEmIS/bN/WH2qRXqpDwyiHlfrWbJYl2zJquxAkRJAW4elVoCwg8wCWxnUguuJ2L5P+ijkHejVssalr44ZK9v5+7sCzYy1qySAjJZgej2w8wAgaAH+N01D0crrs4ZPrc2iV2iMH03QAiMSZE3wjkqfggQMGcM2dTNcXYhEChOZVYJFdy3DXWWxGK9W5/K7ebPMdrdQZUaKVBQiLZ4h3Xgf/NqwFEkjRO6YIhkOrEK5UH55IJSfc38QXaXU7RmWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cPKWIaU9c5l4F0NorzLLaVTxW5NhkijlH7NoRubdrZ0=; b=ey5N4+swh/2BcQz7XC/96NO2z0KS376OSuaWQYBqi89zETXp30vUIysuP3FVmYJyXzaNS6VpXu7TQEbGz7rZRUQrTDBXa12qW9Wn0JNSpMhndAb9W6z8/B05tNKEtvf8ACFu32iLc/SPVYm1HZCb5xAHXREv0P3Sqct9bHTl9j0= Received: from DM4PR12MB5165.namprd12.prod.outlook.com (2603:10b6:5:394::9) by DM4PR12MB5373.namprd12.prod.outlook.com (2603:10b6:5:39a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.15; Tue, 9 Nov 2021 13:16:00 +0000 Received: from DM4PR12MB5165.namprd12.prod.outlook.com ([fe80::3070:7b8d:5f19:ce5f]) by DM4PR12MB5165.namprd12.prod.outlook.com ([fe80::3070:7b8d:5f19:ce5f%8]) with mapi id 15.20.4669.016; Tue, 9 Nov 2021 13:16:00 +0000 From: "Pan, Xinhui" To: "Koenig, Christian" , "amd-gfx@lists.freedesktop.org" Subject: =?utf-8?b?5Zue5aSNOiDlm57lpI06IFtQQVRDSF0gZHJtL3R0bTogUHV0IEJPIGlu?= =?utf-8?b?IGl0cyBtZW1vcnkgbWFuYWdlcidzIGxydSBsaXN0?= Thread-Topic: =?utf-8?q?=E5=9B=9E=E5=A4=8D=3A_=5BPATCH=5D_drm/ttm=3A_Put_BO_?= =?utf-8?q?in_its_memory_manager=27s_lru_list?= Thread-Index: AQHX1VvXjWHPm2/pokm2eFnZq+sX9Kv7Hb8AgAAAQ4eAAAO0AIAAAa9XgAAIFFs= Date: Tue, 9 Nov 2021 13:16:00 +0000 Message-ID: References: <20211109111954.41968-1-xinhui.pan@amd.com> <76d78ff7-efe4-4796-ec18-a668757f2e04@amd.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_Enabled=True; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_SetDate=2021-11-09T13:15:59.367Z; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_Name=AMD Official Use Only; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_ContentBits=0; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_Method=Standard; suggested_attachment_session_id: 4953c3de-7d4d-c349-025a-c72601edacc7 authentication-results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0605e3f1-f262-4c59-5a0b-08d9a38312e5 x-ms-traffictypediagnostic: DM4PR12MB5373: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fVZ2k9kIzFaUpk8hiPvGJnuYbotsQF1mk5HJldGx4OXOR3o6iv9AmzOTWXlyGiEDtTgdyZJtPuLFzJ4MYab4v5JzI5u3OwabTe074emMJ9hM01sVvjuXawizuO5Vul5MxMCKrRz8tAr4YrR/NIJX6Z3BgavlnJ7MPn4NWIIoZ1OvWV+FZ2p64eDSSzGvBo3mCZeXfbCK+DzmUrx00bNW+1Ykl9Hk6ZEBwgUe8aM1sHMjgbB+M3ITu0+jg0FrtWyo1BpHqEDJqB/AB09wROXlWJL7sWD2NISjtUZb8olHUXZ9kfX6Dz4bTsbsDwpfy8z7Mw6zzXcgAn0elUjCu0Q7ZlD+rhn4ZJPcfh5sFszu9hcyaZPTlNtO8y0tFNgBpt4jJn1Bi1hKomvXKOoGAa7ga36rivx2jmvn8dn6w9XQgVwE96vmGXYb94ewtMGW24MJSX0iB4nA53EaY6VMcNq3xn4GyRB8ZCyWziU0km+v/A8V2a0MegEMhG8F+MPT4A+DcNBeMzgdBm7lzby4vQtEbIZwxDP8oi9ogzoBfawpnwYG0xMrX/qT4gLHUkt++VFKxGFfpJOkQKuGBo5/XDOwWsq5dXE9WgIjnaedLZo16bowOKujSzTgUliPoOxL+5+z0AvTIORoUoyN2j1u6g3Yj2i4Ds0zexZ6doir+QmwxjAk0988ZqqJxW34dzEp1IkKYHOs63yDLux0T9K/+qVdAg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5165.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(110136005)(4326008)(224303003)(8936002)(26005)(450100002)(38070700005)(91956017)(76116006)(66946007)(66446008)(66556008)(5660300002)(66476007)(508600001)(33656002)(64756008)(2940100002)(316002)(7696005)(2906002)(186003)(122000001)(86362001)(6506007)(52536014)(38100700002)(55016002)(9686003)(83380400001)(71200400001)(66574015); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?xuHwJ30S5V3vG/Bl7Fn7//rwaRuG?= =?utf-8?q?nD7oeMekWMll9EsH/jjLGuraC0RANo0bzB8enCPP7OeCSB4YvyGeqhMk3b1ekxsk+?= =?utf-8?q?WriOJ3Cpwyrmg8VX+3Uw/ce8mAc7HdknQVqLZX6RFLaUhclvCkuzuT8jIM9eKgCct?= =?utf-8?q?evmMoagigQcjb3VKG5bxCyC8rgo13anzZfVbruvipsJK1AVVtywn5p56fMnlzAHd4?= =?utf-8?q?N8a/i87EDIPDAcNJaerfGJt/SZTSWdMGoumSyuH/OYJFeai4i6+Y72JYyqO+1aXow?= =?utf-8?q?WU6KtSxW2MyKr7ENSXzrr0IbHw9waJP3OSZURFh/Cv1Ut9B1w+okk2O4ETXIsMQJN?= =?utf-8?q?vyzn4FfFcA5JZnhzan1EpxEzVuZNZOyOzIPG2iypU2v2p3R24ySwkn933KXSfmz7F?= =?utf-8?q?Q3/zN4tHz5HxVGi3BDrtRA6bLwoiZddCPBI03Grt+umu5Y+lptSNIQt99B2A+iW0N?= =?utf-8?q?YtgbFiZKvn2/+MhjbKxmRCo9vWU7NwhqN900hj8SeLteOe4x/ue7Oo3DakTwhpO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?utf-8?q?QfZtiCKhxNkjh2zDqQZHS8Dosj5RSyZt/wko4cjTVeq56sOIbo0zzEeqCUuQYkLg4?= =?utf-8?q?WPnHHldO3taNEp4JyRajC5l/bH93S18BpMYjSMMxZXuiv4z+xFTaf3cA=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5165.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0605e3f1-f262-4c59-5a0b-08d9a38312e5 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Nov 2021 13:16:00.0877 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: hX/FdL15kn+DzX0XZion0MEjQGz+hX3isCtN4rQ102rdIgAgmmHPVc4nnpPSjUBY X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5373 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "dri-devel@lists.freedesktop.org" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" [AMD Official Use Only] Actually this patch does not totally fix the mismatch of lru list with mem_type as mem_type is changed in ->move() and lru list is changed after that. During this small period, another eviction could still happed and evict this mismatched BO from sMam(say, its lru list is on vram domain) to sMem. diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index c83ef42ca702..aa63ae7ddf1e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -485,7 +485,8 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, } if (old_mem->mem_type == TTM_PL_SYSTEM && (new_mem->mem_type == TTM_PL_TT || - new_mem->mem_type == AMDGPU_PL_PREEMPT)) { + new_mem->mem_type == AMDGPU_PL_PREEMPT || + new_mem->mem_type == TTM_PL_SYSTEM)) { ttm_bo_move_null(bo, new_mem); goto out; }