From patchwork Tue Nov 9 13:05:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pan, Xinhui" X-Patchwork-Id: 12610725 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 BFEACC433F5 for ; Tue, 9 Nov 2021 13:05:41 +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 9085F61152 for ; Tue, 9 Nov 2021 13:05:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9085F61152 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 DDDC16E8B2; Tue, 9 Nov 2021 13:05:39 +0000 (UTC) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2064.outbound.protection.outlook.com [40.107.101.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6624E6E8CF; Tue, 9 Nov 2021 13:05:38 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZPaWHkF7d2mdH0qI+gjjamhGppgFHPRbzSigZ3ZMg7RkWybp47tuxuKCpxGTCZ8RvKIxBKLTYLPd3RPG64zxrE4NwGT4gKtgif7AcsqENOuGFk4hYC6m1Px1JCSM82J8tZ319bZNRUhJGoCJ4UQ13Dt3vP+EHtaN5KaMjlBVNbGmApBDG4aHP5DfX+xkwByTL47o6ZQs2Y1Yo1oG4FXekyW482ZzhWwHguUc6KH+3p1spg6FDXEt0RTOK9It55xkM4UOXmtLi603yLML8CC4LWZ5hf5aIJNP1BNYFU198qB0Fv9V+9sRXye3Xn15/mH4WH82vsg4JagCFBq+1NiyMg== 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=uT/EUHDuFodKEdnafzZzCH0KLnKLr5Gzel81Pck+ysM=; b=XtPutRpxXb2hTOLjX4c6hO/gbLIOgDwoAYA0usHJVDbYv1PWbVXlWYpvINgygk0Pa+I+HPQOXY2HdHLq4kfvMW4DjYewStcUMRb7TVTgZ6qnyihOdQvjrDHtKr85x3ypbnp6WP0HHNFXc1PJ/fIt0byInxIn4P/weJgOtF8oxAEl81BrOxrQ3KIAm+9BMM2WqIPCNK8/GTuLx8lY74vXj0eBdqJ1AL3o2m+CqdAXCTqJgLAB0AmMkrj/arKsGzjmVg1iEuWwX4kGCaEy6g7Cum3NOIaqC+44hbvVoIWDCkvd/xGnRLUSPL/epQ/hlSQrFITuAD7guWXZiBlgk+gE8w== 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=uT/EUHDuFodKEdnafzZzCH0KLnKLr5Gzel81Pck+ysM=; b=Z+niKNAmraMQOOZTgWQaqo7QDJ5me9C5h11LOvWdYiJwhA2eYlhS/QyzMP6TXhoNRCjgKhIpGSGHcAMqosmSvVrATjQnaqz6w7xe9Zgtoq0V0GQvQrIMAEmJ2u8SbfLU+wQKjQdq38tVLOl2pYwxSI6GYAXDyXh6yL4TX9sC4HY= Received: from DM4PR12MB5165.namprd12.prod.outlook.com (2603:10b6:5:394::9) by DM4PR12MB5392.namprd12.prod.outlook.com (2603:10b6:5:39a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11; Tue, 9 Nov 2021 13:05:36 +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:05:36 +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+sX9Kv7Hb8AgAAAQ4eAAAO0AIAAAa9X Date: Tue, 9 Nov 2021 13:05:36 +0000 Message-ID: References: <20211109111954.41968-1-xinhui.pan@amd.com> <76d78ff7-efe4-4796-ec18-a668757f2e04@amd.com> In-Reply-To: <76d78ff7-efe4-4796-ec18-a668757f2e04@amd.com> 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:05:35.456Z; 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: 1cb415ca-a4a6-a5a2-c4bc-89f36fcfeddb 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: e25b99e8-4869-49c7-c798-08d9a3819ee9 x-ms-traffictypediagnostic: DM4PR12MB5392: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: mA0nPEVtBCdU+CD0Lc4+rh7R1oMZrvqM5kXojoqSYWZL2H1EVXI1Szh6mzM2Xn9tFPiBUgmgQlHH+vYaC598QnmaAUE/G+SO5aSCvprum0ps3AFslV4zh1EPJc3M/xrqMybKPH2cgJiOgg/ftuHAtB8vunaQirc+3O4TxmugSMcMM2ReTha6NbnYdWj5SyuefxCqo/mWrDzS1KXjJdh9eu8HYNmxXpfVVz6ZEpW0wmCsOxmetuc3IDWWtcqRnZpL41tCeJgHk49xR2gj9JbM/TOpgzgSJj8CzQtWf0GJhYNI1/mXHJp/Hp42fdwVj2jyyQH7+Yq6e/dplgfxnA/wsHS0xiJIIpSFAkAh0lkrDj39+j7EyA8hyqAF3Yy0v3JOCa63ZtNcYdD3B0OO84d+uMvnRE2NuEpkNDvaSogieuWy3iyxCcxGjEC4+VnEbsU6CWNf+31rLKEEylGad2JtRWjCnBaZZy384/RMseMj8bQwnH/2if//noSexBsEmxYcw8C2cimVY3YbfX776c1yipUAQaWEIeKAyuOXzEAWJCGzJqkqO/hwfzmxirG3yH5vZDhyyjhdV8yCXMvcnzOCu/Avea5GFDz0rnmuX/be2bdjOdvbOqVHapzu5pC/AmftTc4R6SEK5ZfDp5V+yaQwzD2C6Rkb+XKztzF8+/mc78eN+iNnoFcRU26RYxROF4xfB3IHEMs2Dmkd2pn6iXi8rw== 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)(91956017)(66476007)(66556008)(64756008)(76116006)(508600001)(83380400001)(66446008)(450100002)(26005)(66574015)(66946007)(2906002)(4326008)(33656002)(122000001)(316002)(52536014)(71200400001)(38100700002)(110136005)(186003)(55016002)(86362001)(38070700005)(7696005)(6506007)(224303003)(9686003)(5660300002)(8936002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?JATRK2qdq6Nu3zN9wZ+WassmihUe?= =?utf-8?q?jqm0JZzJSs/02Dt18MQZC7cj/x6wTFoSxamEJ8+CUKN1Np5aSlms/U4Qwh7XyFivg?= =?utf-8?q?ogW55LQw4CX6woMGB9O24rmoIK+FJ2UKYI5gVz46zWVU5uaqBB7TA41QIDe+Kx+fQ?= =?utf-8?q?ltglxTIo0qW2mkQZoWFVBUMx6GLwe1X87hBXsoB8HbIUqlYb7XIyw3O1vSOeUj9kq?= =?utf-8?q?F/dPLOdebb4D3dKE9HkgEKMg8GnxUh9s6h55rGcZ2+nMf+z3YibpKra6MSdUADNUf?= =?utf-8?q?7MPPBGPMfZbE5XWtsrT2FX8Zya5k0QUrWy3+Sl4/ZiB6h+l78VQfF7Hr/8p0ixVEA?= =?utf-8?q?FW5did6gBHNYZ6Xi6fKtOO2m4tXkE5+JtTWMCdz9YtJhLIcObnCrAQyMkN151WCCQ?= =?utf-8?q?qpZfaLJUWu6yo1uQp25mto4Fa7EHKdbhfyC3QN8tz9zOA/NEB+NtFXzbYGUpzqfcz?= =?utf-8?q?Bc9BGyUveYuBrBCFS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34uqnxpPwc5BsYdLQ6XCQAsr48xSag/1o5GOM?= =?utf-8?q?1dilmRpCucK9gFDGPyn3Yo/5+6Re4Og2oiLowZCUTh1tlMLW+yN2YWWC8Fnr1lWLU?= =?utf-8?q?yo9bZPck4uYNOX+3+fP+vF/W1NRxwRMUBtPHGjhrGY5QcZ1wFxZkiAaI=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: e25b99e8-4869-49c7-c798-08d9a3819ee9 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Nov 2021 13:05:36.0292 (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: RwcBPdt467zngPE7osGXdF/5+XDg7qQP/oy/F+VMFQOc6mcL10DRT9eccfnxdCbY X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5392 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] Yes, a stable tag is needed. vulkan guys say 5.14 hit this issue too. I think that amdgpu_bo_move() does support copy from sysMem to sysMem correctly. maybe something below is needed. otherwise, amdgpu_move_blit() is called to do the system memory copy which use a wrong address. 206 /* Map only what can't be accessed directly */ 207 if (!tmz && mem->start != AMDGPU_BO_INVALID_OFFSET) { 208 *addr = amdgpu_ttm_domain_start(adev, mem->mem_type) + 209 mm_cur->start; 210 return 0; 211 } line 208, *addr is zero. So when amdgpu_copy_buffer submit job with such addr, page fault happens. 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; }