From patchwork Mon Oct 14 14:20:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Coster X-Patchwork-Id: 13835115 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 424F9D16276 for ; Mon, 14 Oct 2024 14:21:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B88A410E2A8; Mon, 14 Oct 2024 14:21:06 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=imgtec.com header.i=@imgtec.com header.b="wQ7OqUQ+"; dkim=pass (1024-bit key; unprotected) header.d=IMGTecCRM.onmicrosoft.com header.i=@IMGTecCRM.onmicrosoft.com header.b="HyZydt2c"; 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 D4D1D10E2A8 for ; Mon, 14 Oct 2024 14:21:05 +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 49E69Vu7004748; Mon, 14 Oct 2024 15:20:47 +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=5t7E+9JDM6vaYYUfGvEC3x+LDJR5Du51uwPF4XFdogM=; b=wQ7 OqUQ+MnYJ6p3Is+dczOGbFK1Qk/vW7BZmKYHONnqCSj8sNZFf+qJsxSUAjt1zKrZ ZMY03F0Kt9ZXxUICWh05EaQSZgXHxitI34Y4NRsmExY7zP/2h3HyqbDv5wVKongi j8lNVX8DecNLnDXLBCrAUWkiprO/cCudeMjq3GrJS3mu9D8GWhUR6nDEmd8mk8Yx C19E2+H5neff4CweZ1DbF8T05ZvhBCyzeIaltgefbhAOyPUXka8PyERAP+hqWEPH Ki4Gw0eADfsCoCQr/fwylmxjsjDjrpzVamJx+xa1eew3cDPVEWZ0tdWwrwOB/5bH FGwF1OIIbrrBDSTCn7Q== Received: from cwxp265cu009.outbound.protection.outlook.com (mail-ukwestazlp17011029.outbound.protection.outlook.com [40.93.68.29]) by mx07-00376f01.pphosted.com (PPS) with ESMTPS id 427h6w29bv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Oct 2024 15:20:45 +0100 (BST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wGQ4kGx8F+rodgg3WZfflz9KDJxQ+CkQrF1VgrRu+X40HlBpA0TSVKdT5W6U43puoDDmb7XozwZ8Tz1xrxLe6odqklDmLUYKJEF5yB4dfEgieLt021ZIyfmWqJl38wGjk06HqkCTzs14EdFfFFGviR6ynzFs6Y5BD8qVafIycl/4jp6xVDAWqAKliZwrdgBt9CsvIEN8zGTr3+sGdm7lTpyCLPlNMx9rnevDOsy3huI8K76QWIueVkBYcdZQo9/aJADyBmnESQoLtE9w/WGuYygdPk8p4vZc4FPj1fe7vwO2KcDNbICF8eRukouScjnhCo+tx48fIBw1nT2CxJtMeg== 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=5t7E+9JDM6vaYYUfGvEC3x+LDJR5Du51uwPF4XFdogM=; b=XEmR3gJ8PnrEoK0CYbVZTNOXir+0TvCgQl6+1YrXfDDg51scvvK8jZMbmVvPY99nPmSYYykrFnxlR5I/xwFK016AFnx9csXlw4C7zSu+c3apyV2jbJ8elj4O1pz9s537211dhaAMZF+ykItr3SL8JcMKZcc1JkvmCg7iVtWi+Op+U702vYj4VxwDuL6Og3ChXoXTpAlm4zJdtBTXUI+KsMBM9SN0P5uokaVSnNUs8xKdsQ8JA4szVyVXIn9wpKCv1iC41+q0SL4RRu39VNRMZDpeDUijflSCg46nh9mDTgacn3krrZBk2Kq6yHeTRQrbQOUfSQUDe/KK0S4lacMDjg== 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=5t7E+9JDM6vaYYUfGvEC3x+LDJR5Du51uwPF4XFdogM=; b=HyZydt2ch0QZzEWfL8yn4czPL7veoWpH3CRaX0XgRDXlaL25+uRWq0sDRieXLakpZ2d/dtwKn9WpidWky+eZe1j1KUHb2hiZcKISCbU7REN8SSKjv2PMpnzC39YcKqOGxza+pl56n6K19R8c46vDXvzZB3oNpw09aNE70PSqV2E= Received: from CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:e7::8) by LO0P265MB5894.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:289::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Mon, 14 Oct 2024 14:20:43 +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.8048.020; Mon, 14 Oct 2024 14:20:43 +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 v2 0/2] drm/imagination: Break an object reference loop Thread-Topic: [PATCH v2 0/2] drm/imagination: Break an object reference loop Thread-Index: AQHbHkRAIAi6pdoi70ekZqOZ7q7PKg== Date: Mon, 14 Oct 2024 14:20:43 +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_|LO0P265MB5894:EE_ x-ms-office365-filtering-correlation-id: 542fcdfc-12b4-4804-90bb-08dcec5b6358 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|376014|1800799024|38070700018; x-microsoft-antispam-message-info: =?utf-8?q?c74j5qix03p3+RlfmHjNKQm+v3T5MUC?= =?utf-8?q?3qYfP4NGm239/nHocQKzhhECVSvXyXypNdlC5DqA9GcORF3P5oZvkGPOUaVdOcIto?= =?utf-8?q?b0UZuTd3r60gRdnueNDm1+dFzxY/Y9PdClkFmVpbtoUCnCOduYaY4Fv+fcN6MF7+l?= =?utf-8?q?IhLe1aTCzDsBGv9xO6VgcxWUoZDBF9vjniwW68nbd/IORTYgV5m/gxkMNMUYPg/qD?= =?utf-8?q?DFFMmalPiTn3ON68NJHmNvMWq69+WM/zoGDO8kEbM0KmOfN7eQEHyUBEmPd8smTDB?= =?utf-8?q?6znt4EUKts9LIymTfqIdq6CUXLNV9qwlUFRtjkWePioI8P5l3JJbVaDyDDHd/pGRc?= =?utf-8?q?1/w7oOKqFHnEVpgyhcbMDCNqyq75A8xRpO2tDSKhrXbpV2vQk/Tyl/SF+KqN52qRR?= =?utf-8?q?Ijv6Z/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YUsPfWTwBTOYWAQLp7o1Le6DKlhA=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)(366016)(376014)(1800799024)(38070700018); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?OrTRKxAAjycO5+4ivBjMir1xYzul?= =?utf-8?q?E/Zqb+Q5Q87BvGCav+u9rIU1Km2Sb/whQdfACN80taBETJCEXOpylEMJ3f8Z3Hpju?= =?utf-8?q?IuDCA78iMKMBK3s1iKkfulyTsrslggAHiPkq27G5lYomdgwsVumBgHD7MQr+SSqP2?= =?utf-8?q?oMqSs7d6pgWnOxP1VWvE0At0+rgGQXygxBNxPtyxIQ6uji0b6QTi7WB8Wr9cqRRjm?= =?utf-8?q?tSJJvCZBbt2fAyngpGoWcP0UzPmduRp6ZGjIkbKXplf1EpSOqVNp3zVdUUMr1sQsL?= =?utf-8?q?wm917wrRIoFmQECJmmf+fdEWEmkoON2vQD5lZUyQJU2Mf6yjV/jc/CYSckEbdfh35?= =?utf-8?q?Eg+D67K+sqcNbAZtTUg7tj6BOqEGvl94DD9NH6wG0zW5ng/UukZf6tpxh4bnpsEof?= =?utf-8?q?vB/67XN5Cne+J/qdsgNxqItpYZkVWdGqzzai0tAtMmBntfR+KuWT4TRlIcS4LtZno?= =?utf-8?q?WH+lC2Oc5r6s4wZBcIyWxvNcFmW6TNZezeClnRc4bYRcHA9NEjUvxvEgAutxOnAnC?= =?utf-8?q?zLifD+ThXLe5+G0V8E17xnIk2TR2WC0TEa7NBSKSJ0ZwFQ08j74LiCDnKiXHt7Imv?= =?utf-8?q?yFxwRi5yhhngjOmAQrebKG5YEV1FG0NtuQsILUflM/P8TRAJ3D+ldsemZfwhjpdZU?= =?utf-8?q?3O+r1dqk8Tdp2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6s+ggwNZR4eX1cf1mlg=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: imgtec.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 542fcdfc-12b4-4804-90bb-08dcec5b6358 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Oct 2024 14:20:43.2471 (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: 9Ullg6ks3rDK9GTIMqXwKtFpiOqWA24OS6pINhWIB9nG0IwPafHwBRu916sbZuj7Ixxdr8bCjV+s4eO31RzBLg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO0P265MB5894 X-Authority-Analysis: v=2.4 cv=LbZu6Sfi c=1 sm=1 tr=0 ts=670d28bf cx=c_pps a=s6ZNmHls97cRxtl1EbDe8w==:117 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=DAUX931o1VcA:10 a=WnR_qW7rlZcA:10 a=NgoYpvdbvlAA:10 a=iqgTQx9cwIf3F_hPsnoA:9 a=QEXdDO2ut3YA:10 a=r1F_2ppSMWYV7n5Q7t4A:9 a=FfaGCDsud1wA:10 X-Proofpoint-ORIG-GUID: kPhscxk4G7Sj9hCNfxbC9bdDpzP7pCb4 X-Proofpoint-GUID: kPhscxk4G7Sj9hCNfxbC9bdDpzP7pCb4 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. --- Changes in v1 -> v2: - [PATCH 1/2] Add justification to the commit message so it stands on its own (e.g. during bisect) --- 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: c5e8e93897b7bb0a336bf3332f82f8d9f2b33f14