From patchwork Wed Sep 11 15:42:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Coster X-Patchwork-Id: 13800853 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3FAFDEE0213 for ; Wed, 11 Sep 2024 15:42:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 090E910E0AB; Wed, 11 Sep 2024 15:42:25 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=imgtec.com header.i=@imgtec.com header.b="vUGRq5o7"; dkim=pass (1024-bit key; unprotected) header.d=IMGTecCRM.onmicrosoft.com header.i=@IMGTecCRM.onmicrosoft.com header.b="YbH8/Xn8"; dkim-atps=neutral Received: from mx07-00376f01.pphosted.com (mx07-00376f01.pphosted.com [185.132.180.163]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4DF5710E0AB for ; Wed, 11 Sep 2024 15:42:23 +0000 (UTC) Received: from pps.filterd (m0168889.ppops.net [127.0.0.1]) by mx07-00376f01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48BFS125012979; Wed, 11 Sep 2024 16:42:07 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h=cc :content-type:date:from:message-id:mime-version:subject:to; s= dk201812; bh=G3TuO6/Dgep6K7+N3dydb/lL9+mHEQpsqLDss0nKBzk=; b=vUG Rq5o7YAaIemzx2uRLcu8wEPEZqRfm4YQlLMGtJC4v+IgTPppVc3xgVxh0TQQKuRF pRSIioelAY0OjMD+TuBteaMuTlLcxdK/O4yZqkFO+B+RF/xb1dM78itTyyV7w7yK IjhcY5kDQOHuQQXIdUbhZz10vGo7KUBCqBf/g96xjBaAUhfh9xyasmpjJNnJTxV9 5XqZoFUUoxSgiwK98mBB+IgGmIvZ0YKGMuiddehiwRKC0xWeyXyDA6lMwtqIfhlK Vb+HqZac9eST/lIitvdPROP8ozoOPrsZFJ3N/YOopqWGYz5s6O9mG8Y9sufNOmOw XhUyuMIpJqXWuz6/0pA== Received: from hhmail04.hh.imgtec.org ([217.156.249.195]) by mx07-00376f01.pphosted.com (PPS) with ESMTPS id 41gewwbcb4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 11 Sep 2024 16:42:06 +0100 (BST) Received: from HHMAIL04.hh.imgtec.org (10.100.10.119) by HHMAIL04.hh.imgtec.org (10.100.10.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Wed, 11 Sep 2024 16:42:05 +0100 Received: from CWXP265CU008.outbound.protection.outlook.com (40.93.68.4) by email.imgtec.com (10.100.10.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37 via Frontend Transport; Wed, 11 Sep 2024 16:42:05 +0100 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UY4sPPIrRRW199Fc9yuUvUVGzgkeqYUrUA2trDD6SxyAq4nnhD+QiBqOOM+qEcVsz7z8qRQ0dT6BxFNQ/q7yntEaJm386X0OHrfnGANfd8lNG8Bosg8LNAAV73kvzEA7z39423PBI4RnWcI+KlYtUpfVoGnVrH7vTvLjxzu/+GypCrLQE0Itnr1THwRQoYEWOL8YorCHhCluerlvtVv4rICUh5PwUjnowrXc6dNX/8FJ59XV2S1E49cViGllcpU53tqHECcnn7PaMamXjCcPDJJfk9/sE/196IxXxQKRJTu0Jh25hEWIgn1pICj5zXbVc1DDlXp1sD8KQYasOHNv0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=G3TuO6/Dgep6K7+N3dydb/lL9+mHEQpsqLDss0nKBzk=; b=mvXsarhqGVVOuPbuJ4lY6krtmvdqBipSQlgpvwo9cEln3/965trV3XmFp5r1kTclUG5uYjp/Us77x5HoyIsOu4bREQ2d1RAly7f+WVNj4yhtBa5kn7wP0OryMWZPzES0hKqtbs2XOcHcJ1NgmQyQiuMdzlqk8PwvL4SN0qxkuCSc32ZmH4OXgRco3HqCN/Z7pjHIiZiBqUKSNCAV9QrKMVOLedNx2e9aDiGyX/0DlJWSkuUs6irUcUbBIDmstCvAl2mnHOuPTViMUtKvOAbsOGgVcU+TiQBrAPHm+1zN3fuxh5Kze5LUpNE3RMv09Rh07TJCHZ/38OeFFn5iaohdHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=imgtec.com; dmarc=pass action=none header.from=imgtec.com; dkim=pass header.d=imgtec.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=IMGTecCRM.onmicrosoft.com; s=selector2-IMGTecCRM-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G3TuO6/Dgep6K7+N3dydb/lL9+mHEQpsqLDss0nKBzk=; b=YbH8/Xn8BMuS3pneIpidcSu2Mn+OlqDGlwrw0Lzu5WXegQfEy/hQO0RJsSpqQo8bYbNYSfLTfH4HoHiLPLs+Zfu+/zWf087cr9LYnR6eY5u1ygdKGshDd6ZYRgBi5ugmnl0sVdwi2IFJVJO3Gzy+S2DvxQ8MbXVN2zfnW/icXkQ= Received: from CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:e7::8) by LO3P265MB2329.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:10b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.26; Wed, 11 Sep 2024 15:42:01 +0000 Received: from CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM ([fe80::8e9d:6b2f:9881:1e15]) by CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM ([fe80::8e9d:6b2f:9881:1e15%3]) with mapi id 15.20.7962.016; Wed, 11 Sep 2024 15:42:01 +0000 From: Matt Coster To: "dri-devel@lists.freedesktop.org" CC: Brendan King , Frank Binns , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , "linux-kernel@vger.kernel.org" Subject: [PATCH 0/2] drm/imagination: Break an object reference loop Thread-Topic: [PATCH 0/2] drm/imagination: Break an object reference loop Thread-Index: AQHbBGElIsILCkyVDEG0AQHI7HqI2A== Date: Wed, 11 Sep 2024 15:42:01 +0000 Message-ID: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CWXP265MB3397:EE_|LO3P265MB2329:EE_ x-ms-office365-filtering-correlation-id: dea2386d-20e3-4b72-75ae-08dcd2784798 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|1800799024|366016|38070700018; x-microsoft-antispam-message-info: =?utf-8?q?r+XwIvQDvpa4ci8iDQpp1nrdNBDEJG7?= =?utf-8?q?AGCKsDVfgyzisuc6FlHF53SmIKR9U1CA+v8kj91mcvyPB+8Rsn2sTPJ2l+YH9sX3Q?= =?utf-8?q?uzNR9gUKnTQ/v0GxH58pnJeiY6VgP70CQgXFjiZi67x0U+EFa8MO4y/V0tNLbcVJU?= =?utf-8?q?OoqMh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b3ZAfhpX+76R1IA4krdlKTAfrZD9PMlK6PoE0up+Y7uteba6kwW?= =?utf-8?q?qas7W983IUsxw5z7Kma0E56u7p/wXhuOSh50KDFzuELFjNCXg7goRRQLR5IY2qoLD?= =?utf-8?q?KlACQzEG4Y1PCyDI6fjUfAR3dexftnTBmGAY/dqFXuB4maAfnMLfRz/3w/htaU4yt?= =?utf-8?q?9HsY7bhhLvWaz/GC657LwByLe/jPUumGzfIuTghdtnRXRucug8HSDNR4KUPsEFNmZ?= =?utf-8?q?bXBLRzvJa1rNVvvas0q3k1s+7aEtn+k5s5/ebTrm8nJYX867qqjK9lx/L4BHIGRME?= =?utf-8?q?PvrqeTy2h6V1HnIJtAOgQo4OvINlIVO16A=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016)(38070700018); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?hMl2HSmMMxMa2i/6N3eTn+zQ+jPW?= =?utf-8?q?Md4Pa259vIXLOksJBQ/4JRG2w72tBS2kYDoaMoOpMR7Ftgp1ObFQOfArShdMSOKhz?= =?utf-8?q?Qf4TW7UMrwSS0iI9TVAqHR5ZvC/BrUeMPjByozTJpZAihLLPSnJuTNldQ1CxLlBib?= =?utf-8?q?XhxE0TD8s2ki7G1cFN9F5QrG4acl/UqMgSMonFFEHH8jx9qQqMAOaqYUHQPSHAgGc?= =?utf-8?q?gpJi+IfhDRyOvpsiDT9l+xvyy2xZQaRJMo0gura7JKUGryx/mEAsSfQivH/Nwf3UA?= =?utf-8?q?oO03mPcCLAieiVpM58wICqXIQLr8t8w+lWz8RCU7J5TYDu2tGoyTbAzPj0q+3Kung?= =?utf-8?q?FEvE4YrO04xJCQBj/zzy80rcrXTHb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7Zc1+ZrBAmgynicI9qW+XOt?= =?utf-8?q?pR0eL6AjP8Wai91HqE4IZT1eq5vNdRfMaM+ghCAKtZNMtTEPWXMwx2H+0Tt8PjjMt?= =?utf-8?q?qUcyKsJPOeSW0n6Wle9S1gUy1hU987ycGTPBJ4jGCTmdfR51RIASSUhl1LCUuLQp+?= =?utf-8?q?jNjcxJZhjLcWvZnFNXbuZRCBr3m5MwJoAy4OUFcQ6wt5uebvTKXOWerYvZ3Zm9uDP?= =?utf-8?q?EjgjC5LZE7NSO7mrpGIGQgicgerfgET2nvCmxQW8pXtVoHdTT6DNQOg0dvHmQE66K?= =?utf-8?q?wIZQ2wqWUhHFzanuivPP0Dbdtf5t0UoxZw=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: dea2386d-20e3-4b72-75ae-08dcd2784798 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Sep 2024 15:42:01.8614 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0d5fd8bb-e8c2-4e0a-8dd5-2c264f7140fe X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: OUxCs/pIKKSeUR9rdw9G9XGB2Ps9QRrZyHt0TVEyG/t8260vtfd6H7CKztq3xGw/pot35UJXZGhNyH9TimEOgA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO3P265MB2329 X-OriginatorOrg: imgtec.com X-EXCLAIMER-MD-CONFIG: 15a78312-3e47-46eb-9010-2e54d84a9631 X-Authority-Analysis: v=2.4 cv=V7Ev0vni c=1 sm=1 tr=0 ts=66e1ba4f cx=c_pps a=6IdplsTJodF3+aqeaEJcqA==:117 a=6IdplsTJodF3+aqeaEJcqA==:17 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=EaEq8P2WXUwA:10 a=WnR_qW7rlZcA:10 a=NgoYpvdbvlAA:10 a=iqgTQx9cwIf3F_hPsnoA:9 a=QEXdDO2ut3YA:10 a=tLyVP-_u6bd0JCgZz4kA:9 a=FfaGCDsud1wA:10 X-Proofpoint-ORIG-GUID: ajyFtsl_RsJdI38Yu5204Xwk2vIY2FkN X-Proofpoint-GUID: ajyFtsl_RsJdI38Yu5204Xwk2vIY2FkN 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When remaining resources are being cleaned up on driver close, outstanding VM mappings may result in resources being leaked, due to an object reference loop, as shown below, with each object (or set of objects) referencing the object below it: PVR GEM Object GPU scheduler "finished" fence GPU scheduler "scheduled" fence PVR driver "done" fence PVR Context PVR VM Context PVR VM Mappings PVR GEM Object The reference that the PVR VM Context has on the VM mappings is a soft one, in the sense that the freeing of outstanding VM mappings is done as part of VM context destruction; no reference counts are involved, as is the case for all the other references in the loop. To break the reference loop during cleanup, free the outstanding VM mappings before destroying the PVR Context associated with the VM context. This is facilitated by tracking the live contexts associated with each list, implemented in a separate patch to make the main patch cleaner and easier to grok. Brendan King (2): drm/imagination: Add a per-file PVR context list drm/imagination: Break an object reference loop drivers/gpu/drm/imagination/pvr_context.c | 33 +++++++++++++++++++++++ drivers/gpu/drm/imagination/pvr_context.h | 21 +++++++++++++++ drivers/gpu/drm/imagination/pvr_device.h | 10 +++++++ drivers/gpu/drm/imagination/pvr_drv.c | 3 +++ drivers/gpu/drm/imagination/pvr_vm.c | 22 ++++++++++++--- drivers/gpu/drm/imagination/pvr_vm.h | 1 + 6 files changed, 86 insertions(+), 4 deletions(-) base-commit: 45c690aea8ee5b7d012cd593bd288540a4bfdbf0