From nobody Tue Nov 26 08:59:37 2024 Received: from mx08-00376f01.pphosted.com (mx08-00376f01.pphosted.com [91.207.212.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5DF7200B93 for ; Fri, 18 Oct 2024 15:59:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=91.207.212.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729267187; cv=fail; b=VKcztkxU16RtNju2XsyKV3nKZ0BWs8kzZby/l3UV1H+90GuMKEePQGH/3SpLoDq/jVEmjAbvi4CQEI0R/gCbK2mRokxujsVlqHBsgVDpUD84/Ge6XdAOhNFCdo713jPd6zzuoHMk1biCQC3fwqzVZBc6QZesJ8ofTcC46weW6jY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729267187; c=relaxed/simple; bh=jqk46VXhp8ohbnSJzZHKD8t88HzEAjzjO83GQGvKQXs=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=Byhzce3ESA2fwQWgrFRzVZtg38ug51rlZGceEl9HM3SIO6FscUURlIcGF/c1jvFR9Dfo9C0soklDSFxfhAARvWEEC09mb8kUYOk4/ZfaBAGpptHDfqpaglLnBL2ZCjSE2mE++CU+GSWg5wjGftnmCmfEYFlECcysgHqw/HGhqKY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com; spf=pass smtp.mailfrom=imgtec.com; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b=Er5wgY1j; dkim=pass (1024-bit key) header.d=IMGTecCRM.onmicrosoft.com header.i=@IMGTecCRM.onmicrosoft.com header.b=D4muzv0i; arc=fail smtp.client-ip=91.207.212.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=imgtec.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b="Er5wgY1j"; dkim=pass (1024-bit key) header.d=IMGTecCRM.onmicrosoft.com header.i=@IMGTecCRM.onmicrosoft.com header.b="D4muzv0i" Received: from pps.filterd (m0168888.ppops.net [127.0.0.1]) by mx08-00376f01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49IBSmvl018297; Fri, 18 Oct 2024 16:41:39 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=dk201812; bh=BZKcoAYwqQov8ijGzTVVKFXh1 9Hql2U8WjaG+HOgDjI=; b=Er5wgY1jKZ8XRAe/Nx+FPA+B5c5NSHkXU1QL/rWKp Qup1B8ux0ldGCkvhDytKmJ/wfhfhwDC/31LWMaSN42Qs1cSK6lgDwzFi6ArpLLLT N8IEn7QAqB18ZrAclrxnz6kI5tWrpuCW8+Vtk9Da97yTG5vWwl+cYhZsg5Vl7i+N o7qoycgHaYLopO8ZUT2xbmHAwIAuheQgmsVbm2fUmdhWMwBg6qJRaj+iuNWlhk/t FpGeN6TcjF5cKYCVgYukLuhMgBav00xY+wusGQQ9x5H2SYvSNDibIT2EvWPHJmWW 631UnpudrQPtO8omndsV7BcjIliglN1UzwtsPVmknGpgQ== Received: from cwxp265cu008.outbound.protection.outlook.com (mail-ukwestazlp17010003.outbound.protection.outlook.com [40.93.68.3]) by mx08-00376f01.pphosted.com (PPS) with ESMTPS id 42a3ac2nwm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 18 Oct 2024 16:41:38 +0100 (BST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=d2fj0pUwQRAXVAu6IUM/8MM2sr33/52J35XVXJZXeg7etEU26dK2HDz/zF+RgUglLgYsX24r0ahHzyaw5KKJQaIYE3ShKuOH7/Rjop5dBT2kysSLt7A9Ya1dCkEPkVwCrWjjetf/IcfmijjNVMEBg2lNzWgAfaVP4T2cBFMUk9lfz1PdDE2CeB0omJTJNxhwpONrz8On53t7hxvZx7KvBBuGGW9byhme0baIRtKJ8Xf2d1RffS/Z6SRrdOS5IzVyBN8pdw+4EP2xpigcSxY7/vzyiIezpadL2+mezS/yPCItLwN2YhFSheQr3q5ghrb3py2E8v+BuXL+vC7eW/T2dg== 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=BZKcoAYwqQov8ijGzTVVKFXh19Hql2U8WjaG+HOgDjI=; b=J0WjVGUWeKAUN+ilT6/xt5/mmz41Hr9hpIGnrU+b2lm2QyjddWVZonw9cMP0V1hGDQMTBeZTzezaHLSyB3geRrYWTlQL05mOVCKdXdwUiNNnrMjPyuAc2ZwJjCeuBscbWDxFZ6eYZyeLKcUEyiZvvzbOrxYjE4ZAWBC8Kase30Qr2v9KuIe31qcCmiKdSvpbfMZRmFE9Dt5bUNrLovYOvJ/EMvXUb/7f/76d7KLgXeeA3JFBcofFSJnIzwWsAJwH17NkPEWKdaHZETa5fFQM9J3ih2lMFLVrqPm7qTcYllOofoLf7TlVJzxl+A3+d/WgkKLD7CJL6cOKRuLH7hf4Zg== 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=BZKcoAYwqQov8ijGzTVVKFXh19Hql2U8WjaG+HOgDjI=; b=D4muzv0iEl/ctaN1KgXxMT7yUgdvxQWJwK52k/xg9H+yxQy3X7ilCge5MGLwwfbASvBmS4RWFoIBu++a8kNfcbxMsIw7iWn6kUJntHQ8yQex6MsStSlUn/F4K8uPvSeICx0763N0WdXflgY9lQ4hrtjy16n/xK04GAsL8+vgNKw= Received: from CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:e7::8) by CWLP265MB2259.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:6b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Fri, 18 Oct 2024 15:41:36 +0000 Received: from CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM ([fe80::8e9d:6b2f:9881:1e15]) by CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM ([fe80::8e9d:6b2f:9881:1e15%6]) with mapi id 15.20.8069.020; Fri, 18 Oct 2024 15:41:36 +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 v3 1/2] drm/imagination: Add a per-file PVR context list Thread-Topic: [PATCH v3 1/2] drm/imagination: Add a per-file PVR context list Thread-Index: AQHbIXQ3By0tkWHfnE+2c5pxM7UKeQ== Date: Fri, 18 Oct 2024 15:41:36 +0000 Message-ID: References: In-Reply-To: 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_|CWLP265MB2259:EE_ x-ms-office365-filtering-correlation-id: 4a5b3e7f-0f72-4954-3b17-08dcef8b5995 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|366016|376014|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?YVlIbjFuOVlXNzFuYnpXM3JyNVpFT2xaRWR4NU1JZk5qajVrQ1c4R3hBYjRR?= =?utf-8?B?NUNBMUFVTWsybW1ONnZlTmpHZGhRQytHdTNVRUtIR3ZDNlNUWi81NVlmUnNt?= =?utf-8?B?ZldMc1MwL3M2R0YvUVpQczV6ODlFd3E2RXlsTlQrdUhxUkZXSStIeDMwWjdn?= =?utf-8?B?ZGJvUWcvQ2o4aXNTbEVPbUN5VHcxdEtWMFlreWJJbkt6ZkFwN1dwNklVOHl5?= =?utf-8?B?NzdjM09yOTlieHJrUDh0eHRHZ3VBZVN3blRBRWRXUXJXc3ZpbmlLWGpSamt5?= =?utf-8?B?TXJoQVNsMTBKdWNLZ3Rvb3E4ZkZQK1pMVmdGdmNFQ1RYeEIzQks2ZEwzTXUz?= =?utf-8?B?dVpCTkNFMUY2aE03NWJwMHd1NzZPSkNhVEVxc0hDYUtma25GcCt6RVRDSzAr?= =?utf-8?B?S3FOMXZhNFY4aUlKaXplVmxFNlIvSGVkeFgzQkhVMk9aV2JycEttRTFJYU9l?= =?utf-8?B?Q0lWc0dzNTA1Y3ZuUWhuRGh6WHBDU2x4QWhST3lMMGNoUlBtZmtjMEh0d3B0?= =?utf-8?B?Q1gwcTEwcENLNkttOU9Ycisxb0MwOVVzNHZ0UUhPa05NZ3A3cSs0djJhc01h?= =?utf-8?B?VUtnNFN2Mmp0cCtXc21XYlFkK2UyV0MyZ3RGdDJSZzkyVW1LcHlLMEQ0K2V4?= =?utf-8?B?U3BCZVdOZm1yZCt5QTd6U09sbitPb3ArWTY0UmlzVCt2bFBBTVRPaGp0cmNP?= =?utf-8?B?VE9BNThGdDFHYng4SjB4aEhUcFNQYUNURXd5RVBLRmRVNGhrN0NIWTF2WFJ0?= =?utf-8?B?R1d1bFVTQUFrNUExYVgvZUM1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WdqcVhiOTNEeDQrY2t6Z3F5c2djMDhNV01UMlNaMFhiQldXRDE1Ui9v?= =?utf-8?B?VUJDRVBqSDF3bWpEVnBxc0dqdVFQa08vR3daZkdpVW51d2NNT2ZMeS93MUdU?= =?utf-8?B?YzY2U0lYeFltaFRzQzMzU0pha3ovWWl0aU80aThhdHA2OS9EY0p6YWpKZ1hp?= =?utf-8?Q?k6olX1sIY3FQ3?= 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)(1800799024)(366016)(376014)(38070700018);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?cHQvT1FIUElVRjJUK0daOGRhbzhpWFlMQmlZb0RhRGxTU1NmNVB2UU5sOG5C?= =?utf-8?B?RkY0cXg1cER4QVBRYU5SOFordkUyWmVDWFZUZnhQdTJQVGZmVlY0aEFZNHhP?= =?utf-8?B?L3QycjZSQ0JObG9za3p3eXg3QVQycC9mUlpsNmxYWUNIMSsvMWx2b09PbXhQ?= =?utf-8?B?dnJkSCttdlR6a0MyN1lOSmNHaW1yNzJpM1dvUFh2SVNjNUVIc1RFSCtKU3Bs?= =?utf-8?B?TmhFWGhoVWJMZjgyNjRTaWRrdkNiQllPRUQ5Q0JzTkwwZ2djRVovY21sQitQ?= =?utf-8?B?bE1KUU50b1MrNGVsRS9nQW4wdWhEczd5dkN0d3VtaGQ4MWdldnJQZGxJZWVY?= =?utf-8?B?WDdWWWNkZG4vUmE1UTJiY1dNV1kvWEJmalBoL3pCUDQ4SmNSYzlwWUFNeTFi?= =?utf-8?B?N3NURnBYTStxUU5HNlc5TVhXUWkvVHdWODBKZnZST0Z3MExqTk1EVkVXNTZM?= =?utf-8?B?VStET3owYm5yZkFxcnphbDl3Sm1UckJNbW9oMDI2cUw1RHho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Ndm12dnV5UTdFZGJMMWYrTnJjRUdpbmxu?= =?utf-8?B?NVJqSHdjanoxRDJMcEQrVWt3NmxGbW9lQ2E4a0RhcytqWENjZURYZmFMdmNt?= =?utf-8?B?K0t4bTlZcVJSK2tJUzBZK3draXVsZjJLQWR0NWxDK3ZZVlVYR1lWeGFwOXhs?= =?utf-8?B?cGZYeWNLeWlSSFpNS2liZUZIM2toUktiWUdjazhHdDBDQ1lpeEYwM1lwYUFG?= =?utf-8?B?djNJM0hYdTFTSE5aR3JKcUJIUkNPbW1Xb3BrcW5LT0k4MGZobW5sRXN2cnh3?= =?utf-8?B?cEIzNWJwTDV4aDBqMXZZZ2ZDS2RCdkpQN1Z5WVBPOStOS1gxaDRxM2NyWjBh?= =?utf-8?B?YkovNFRnVkhSNVFaRTRLZTlBalhuV1NncjhSbWVOaWVLeHhTdXYrSFdXRmg4?= =?utf-8?B?dVFaT0JFa1BDelAvYlBJTHpnWWpLNGZHcTR4T21DcnMxSTZrMWtqdmNuZXk5?= =?utf-8?B?blE5akg2eWd3ZUI5NFlEb0dHZEZEcHNneEJENTZZSXoyK2FRR0hSVnptVGsr?= =?utf-8?B?dm9OanZGa1AyUnBwMTZlRWwrMXJMV3FrM2k2UTFkSXljT0NsQWQwVFNaQnRM?= =?utf-8?B?RDdubXRZRkIveXlBL2Z3UGpIRzc0VWZJR1FVcVQ1OTJlSU1ScHpUWW9yRWZI?= =?utf-8?B?cG5TMHVjZUtPQlJPakxPQk44blYwKzlFdmVXeFZjdFVmVTRpb0pDM3ZsNlBh?= =?utf-8?B?Qy9makVJNXpqL0FLOGVaVStLTU1uTHVWWnV3K0p0KzFub29GNEZlcjJkbXRR?= =?utf-8?B?Q2c9PQ==?= Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------ERztox0j2OvV0xh509bM4USL" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: 4a5b3e7f-0f72-4954-3b17-08dcef8b5995 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2024 15:41:36.1641 (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: VOK57d2WcCabwPD4onX3hJlJjOJFZmXJwh8fG5t6ymbIe8S+VkCo1aGuTFnOeHGm90EiV2XCl6zsl/neVRDJ/Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CWLP265MB2259 X-Authority-Analysis: v=2.4 cv=AcbjHGXG c=1 sm=1 tr=0 ts=671281b3 cx=c_pps a=Du42DVBbjaS4S3NNO6dabQ==:117 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=DAUX931o1VcA:10 a=WnR_qW7rlZcA:10 a=NgoYpvdbvlAA:10 a=r_1tXGB3AAAA:8 a=VwQbUJbxAAAA:8 a=ve1ODSZ0aD4dUIyBzsEA:9 a=QEXdDO2ut3YA:10 a=8WOXGegX6ja1v6kmIbUA:9 a=FfaGCDsud1wA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-ORIG-GUID: ciBiJjBNHKyQ5E9F18mak3vZ0RkbKmas X-Proofpoint-GUID: ciBiJjBNHKyQ5E9F18mak3vZ0RkbKmas --------------ERztox0j2OvV0xh509bM4USL Content-Type: multipart/mixed; boundary="------------b09EQw9QuDR00NrhfWJ3Rzkm"; protected-headers="v1" 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 Message-ID: Subject: [PATCH v3 1/2] drm/imagination: Add a per-file PVR context list References: In-Reply-To: --------------b09EQw9QuDR00NrhfWJ3Rzkm Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable From: Brendan King This adds a linked list of VM contexts which is needed for the next patch= to be able to correctly track VM contexts for destruction on file close. It is only safe for VM contexts to be removed from the list and destroyed= when not in interrupt context. Signed-off-by: Brendan King Signed-off-by: Matt Coster Reviewed-by: Frank Binns Cc: stable@vger.kernel.org --- Changes in v1 -> v2: - Add justification to the commit message so it stands on its own (e.g. during bisect) Changes in v2 -> v3: - Add Frank's Rb [1] - Add Cc: stable tag [1]: https://lore.kernel.org/dri-devel/1a206b08485a1ebea0aeff5306c0f5b6eb= 7c315d.camel@imgtec.com/ --- drivers/gpu/drm/imagination/pvr_context.c | 14 ++++++++++++++ drivers/gpu/drm/imagination/pvr_context.h | 3 +++ drivers/gpu/drm/imagination/pvr_device.h | 10 ++++++++++ drivers/gpu/drm/imagination/pvr_drv.c | 3 +++ 4 files changed, 30 insertions(+) diff --git a/drivers/gpu/drm/imagination/pvr_context.c b/drivers/gpu/drm/= imagination/pvr_context.c index eded5e955cc0..255c93582734 100644 --- a/drivers/gpu/drm/imagination/pvr_context.c +++ b/drivers/gpu/drm/imagination/pvr_context.c @@ -17,10 +17,14 @@ =20 #include #include + +#include #include #include +#include #include #include +#include #include #include #include @@ -354,6 +358,10 @@ int pvr_context_create(struct pvr_file *pvr_file, st= ruct drm_pvr_ioctl_create_co return err; } =20 + spin_lock(&pvr_dev->ctx_list_lock); + list_add_tail(&ctx->file_link, &pvr_file->contexts); + spin_unlock(&pvr_dev->ctx_list_lock); + return 0; =20 err_destroy_fw_obj: @@ -380,6 +388,11 @@ pvr_context_release(struct kref *ref_count) container_of(ref_count, struct pvr_context, ref_count); struct pvr_device *pvr_dev =3D ctx->pvr_dev; =20 + WARN_ON(in_interrupt()); + spin_lock(&pvr_dev->ctx_list_lock); + list_del(&ctx->file_link); + spin_unlock(&pvr_dev->ctx_list_lock); + xa_erase(&pvr_dev->ctx_ids, ctx->ctx_id); pvr_context_destroy_queues(ctx); pvr_fw_object_destroy(ctx->fw_obj); @@ -451,6 +464,7 @@ void pvr_destroy_contexts_for_file(struct pvr_file *p= vr_file) void pvr_context_device_init(struct pvr_device *pvr_dev) { xa_init_flags(&pvr_dev->ctx_ids, XA_FLAGS_ALLOC1); + spin_lock_init(&pvr_dev->ctx_list_lock); } =20 /** diff --git a/drivers/gpu/drm/imagination/pvr_context.h b/drivers/gpu/drm/= imagination/pvr_context.h index 0c7b97dfa6ba..a5b0a82a54a1 100644 --- a/drivers/gpu/drm/imagination/pvr_context.h +++ b/drivers/gpu/drm/imagination/pvr_context.h @@ -85,6 +85,9 @@ struct pvr_context { /** @compute: Transfer queue. */ struct pvr_queue *transfer; } queues; + + /** @file_link: pvr_file PVR context list link. */ + struct list_head file_link; }; =20 static __always_inline struct pvr_queue * diff --git a/drivers/gpu/drm/imagination/pvr_device.h b/drivers/gpu/drm/i= magination/pvr_device.h index b574e23d484b..6d0dfacb677b 100644 --- a/drivers/gpu/drm/imagination/pvr_device.h +++ b/drivers/gpu/drm/imagination/pvr_device.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -293,6 +294,12 @@ struct pvr_device { =20 /** @sched_wq: Workqueue for schedulers. */ struct workqueue_struct *sched_wq; + + /** + * @ctx_list_lock: Lock to be held when accessing the context list in + * struct pvr_file. + */ + spinlock_t ctx_list_lock; }; =20 /** @@ -344,6 +351,9 @@ struct pvr_file { * This array is used to allocate handles returned to userspace. */ struct xarray vm_ctx_handles; + + /** @contexts: PVR context list. */ + struct list_head contexts; }; =20 /** diff --git a/drivers/gpu/drm/imagination/pvr_drv.c b/drivers/gpu/drm/imag= ination/pvr_drv.c index 1a0cb7aa9cea..fb17196e05f4 100644 --- a/drivers/gpu/drm/imagination/pvr_drv.c +++ b/drivers/gpu/drm/imagination/pvr_drv.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -1326,6 +1327,8 @@ pvr_drm_driver_open(struct drm_device *drm_dev, str= uct drm_file *file) */ pvr_file->pvr_dev =3D pvr_dev; =20 + INIT_LIST_HEAD(&pvr_file->contexts); + xa_init_flags(&pvr_file->ctx_handles, XA_FLAGS_ALLOC1); xa_init_flags(&pvr_file->free_list_handles, XA_FLAGS_ALLOC1); xa_init_flags(&pvr_file->hwrt_handles, XA_FLAGS_ALLOC1); --=20 2.47.0 --------------b09EQw9QuDR00NrhfWJ3Rzkm-- --------------ERztox0j2OvV0xh509bM4USL Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature.asc" -----BEGIN PGP SIGNATURE----- wnsEABYIACMWIQS4qDmoJvwmKhjY+nN5vBnz2d5qsAUCZxKBrwUDAAAAAAAKCRB5vBnz2d5qsPLr AP98K26I8opLnhDYzQ+fb8rKiyE4BjweURmGG2yh1/jXtwD+KJiEOYSBN0j5+mDj+xigzxS6/R6r b46XVL8xjAmiuwY= =yNI3 -----END PGP SIGNATURE----- --------------ERztox0j2OvV0xh509bM4USL-- From nobody Tue Nov 26 08:59:37 2024 Received: from mx08-00376f01.pphosted.com (mx08-00376f01.pphosted.com [91.207.212.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5DA518E762 for ; Fri, 18 Oct 2024 15:59:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=91.207.212.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729267187; cv=fail; b=TqIhIpZNkS+q58dejV3jtqhDJnhI0hXosXbDmtSFCA6+uAjtzkqxQNoQ6Zi1fuNiuosJLwZb31UqDKifxVtHsrqjr+oqvobqWFlxbbP873aRNbzN6Ip6MerNia1r+fSWn+A2ridHCpagd7YF05qsQiWRPnjkYazXy5yApufYLWs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729267187; c=relaxed/simple; bh=z6AqJcaAefyV1tPL2WZJtnKcFsff++OIpWit7uKF+bA=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=ZpXEa9P8s4cTSBBAG5ZEf9C3D6xDm3IrSfTeG1gcm2tlgso1gJMJdFs9ePY8GbWplYWMDxOA4BxM7snM3s3N3rCdOo95XPAcT2DKRJcHpyxonLPFQvqYhVA8ZHne/UDtIr3NUEl2gx5tM3NLfoSZkuUNizMOnTo2dDjAKWXqfEc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com; spf=pass smtp.mailfrom=imgtec.com; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b=jZTjkjtu; dkim=pass (1024-bit key) header.d=IMGTecCRM.onmicrosoft.com header.i=@IMGTecCRM.onmicrosoft.com header.b=prSYL7Pv; arc=fail smtp.client-ip=91.207.212.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=imgtec.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b="jZTjkjtu"; dkim=pass (1024-bit key) header.d=IMGTecCRM.onmicrosoft.com header.i=@IMGTecCRM.onmicrosoft.com header.b="prSYL7Pv" Received: from pps.filterd (m0168888.ppops.net [127.0.0.1]) by mx08-00376f01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49ICP2Fx008181; Fri, 18 Oct 2024 16:41:42 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=dk201812; bh=qHHwH7bI/YMEclJZwyZP4/j8V tKd3sP5jx62wQm9xJU=; b=jZTjkjtuEDzdjkOUjWntofDlAjiH7xQoUf0CdbZZa ki0BF1VRmJ845LxBwdVEHsG5pGACeENlojtjZlSacPI3Vx40qjhsJ3A92EY/geGf hBPkx0u6ZZygq3XiyYtfWNHAn/RdQS9DceS/SVNdt0Ky3o2YFcqH6YO5vhuVN0g+ 7GtKDVQG1bBxorzlGePDXR4CZo5VxxZRquYye09xNS+NHLBnGAGc+zwDueVBM3xA ua+xkaeh9q9ie8LF0ozdlqj4WwNDO6gmKrYwTTPNa9aYCNBwGGixuYOtG6LWBNo+ G8PhKiHRu9zC7yrGvqS0g8sA6FFxNYLSnRAvPGgwRHlkQ== Received: from cwxp265cu008.outbound.protection.outlook.com (mail-ukwestazlp17010004.outbound.protection.outlook.com [40.93.68.4]) by mx08-00376f01.pphosted.com (PPS) with ESMTPS id 42a3ac2nwq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 18 Oct 2024 16:41:41 +0100 (BST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=t6BdCNbEem42cYPg5/b89wczlVWEIl4p1GFDWt0uvBXZdSLvboLyC283mNPnjVjD1YlqRvjDoajDcpVgfymFNyNfSKOkDhLn5j4pCcFdNROSQcgEhwlGrQOluL4vNEfoX4nt5u0hTU3To4BLQnvWRsoeJAPn30nVBThFBBmvVFJx3oahEeMzWOg3D5s8lIOLWRdGNb31wt7xQVl0F5p04euzU9hqcFjmEW/Vw0jjWROs/F2mKSs9EqOk7KvDY4XIS/GxOUDNKCR2QOmlWCAYc0GCGqi5Pn5FMBx5tlvdglg+6cTeDjN/Cs+Fvsdck3aOwq8431I+lvZR2hVvTXcqPQ== 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=qHHwH7bI/YMEclJZwyZP4/j8VtKd3sP5jx62wQm9xJU=; b=kYrcFXXUYXWIyRH4m7c0oPGvwSI/70KgHzvoN7F/704R4VBgKTi2FCHZEWCX45MPW/8n4am/cMPmaEGu7hZzoq6qoI616OQ5jDArV9bjeqX5mJdrYY1NtoF6DYbQSyoW9eElpk6ltl8n1D12Seakp7n8P7nlE9IId+dJyrfAh6uvgkDLaxwgmJdRmw9+Ir6oV6yysPndAIav3lC3b6kxVQlDHPvF3QMDN6yx8CO+s3qUnOk7+WAP/yE5F0QyePXOzsRVspr5wxu8+V6fuYzfIPDgyP5oChD59VNB8xAKECKBBUD1akp76VbWqmO5hiqgnQV98P1WtY3J8uOUY+X1oA== 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=qHHwH7bI/YMEclJZwyZP4/j8VtKd3sP5jx62wQm9xJU=; b=prSYL7Pv8KaGwGUMZMxhbQnuYEdQq+Vony4lkuMald+Ao/MrAGw7lSCVu06WuIWIgBKevScUz7bMQNh+KQrvC+nmaWU0hRMoOq/Coy3e7uY3SUzCHKWjYR4TmMgZtzsbqUtw3ek+vIbGZUwwc25UQQ+mqZnlPw8+xbb9JEXCbzA= Received: from CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:e7::8) by CWLP265MB2259.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:6b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Fri, 18 Oct 2024 15:41:40 +0000 Received: from CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM ([fe80::8e9d:6b2f:9881:1e15]) by CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM ([fe80::8e9d:6b2f:9881:1e15%6]) with mapi id 15.20.8069.020; Fri, 18 Oct 2024 15:41:40 +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 v3 2/2] drm/imagination: Break an object reference loop Thread-Topic: [PATCH v3 2/2] drm/imagination: Break an object reference loop Thread-Index: AQHbIXQ5O6skwcFhHUq9t8DEiam/vw== Date: Fri, 18 Oct 2024 15:41:40 +0000 Message-ID: <8a25924f-1bb7-4d9a-a346-58e871dfb1d1@imgtec.com> References: In-Reply-To: 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_|CWLP265MB2259:EE_ x-ms-office365-filtering-correlation-id: 6ea76559-c70e-4b1c-8ee1-08dcef8b5be4 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|366016|376014|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?ODVLbWd2TDZGSVlPRGJLcU1KVWJhVnh1RXJIZ3QzeU5zL2Uvd3RpRGVQb0JC?= =?utf-8?B?WG1IeHMzcFFFQzk2U29NKy9YWVlQcXFpNXlsSXl1SGNxTFZUODBqT2FEVkho?= =?utf-8?B?RCtPVWJiT3JHWGU1VU5BaUE1K3hDaDRURUZ4OTA4QlVJR2NwYng2L1J6VVc0?= =?utf-8?B?RzlpREZnQTZIT2ovbDRUTTRERGxxN1FtcTBCZ3UvM3h0WGlhYXl0a1VpTnJO?= =?utf-8?B?RGhFTENUWjgrV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utf-8?B?MTc2WWxRVEZ4NkpzTUZ5N3dwK1g1cHJyS01EMWlLNG5Ic2ZRV0hqcXZMdWJL?= =?utf-8?B?K1VIR1VsYUV0UENQYi9HRGs2SytFV0ZDYi9PeHFkRVYrNlFscnAyWXBhdXFZ?= =?utf-8?B?aHhpK1ZnSWQ4NGlCUlNrOGZpdXcxdmhJYmVMeFNSQVpKaEkvbWVySEozUWE2?= =?utf-8?B?NHN6WWpDQlJrL3Axd0c5TVp6ZDJydk5MOHVvOXltUjk1K1BzVTJKdXcxbTZT?= =?utf-8?B?dUpiRGVaVEh0VHhzNEc3UlhmdW5ndFU2alQ3RDAzR0R6azJtQlUrd0V3N0VO?= =?utf-8?B?RjNVU0ltTm95aUZMRTErYXlQS2JmYWd2bUkzekFqaVFQUDkxZnhVY0NlV1dq?= =?utf-8?B?KzhWcEgyMmVKNC94WXFjM2prVzk4ZEdMd0hQY3NWZlRjZW9QKzZESjFqeldR?= =?utf-8?B?SC9MNkRyQ01xbjE2b3MzMHFaNTBPNHRVcUVwWC9xd3NkbkxSRGlJa3RneDRZ?= =?utf-8?B?b1k1dU0xYkw2akdHSFZZQkhyU3JJSGgycXdUV0NhMi9hTmIzdFY0aWdydVFh?= =?utf-8?B?bkN0emtGc05ITVA3NktpSGVROGtsZjlBMktnOEhndXJlTk5UWkptelJ2OGRk?= =?utf-8?B?UEdPcnhwRnA1Y1lYOUhXWi96bXlEOU5UNmJHS0V3b2Z5K09zS2p2bk1GVXFl?= =?utf-8?B?K2psb3pXcXNTTXVoUGhzT0xlMklTVEJrdEdQcG9TNkorQkFWMm9kU0N2L2ZW?= =?utf-8?Q?rZzOMBeRYjLql?= 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)(1800799024)(366016)(376014)(38070700018);DIR:OUT;SFP:1102; x-ms-exchange-antispam-mess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?Szk5ZUkxZGhwZElhek5XYjVGaG0wZ0tQQ0dDemk1WkVBdWpQSnJjZTMxZjhv?= =?utf-8?B?S1F2YklHWldjaXFaWmxzT3RnYWtvMjVFbjRxejNGOUJSSkFhTW5iSmdGcmhO?= =?utf-8?B?S3VFMnN2VmVaclFzTDM0UENYUUdiTkxIZlJraWI2d2kyVDl1K3QweUFmTmVn?= =?utf-8?B?TWRRd2V0YlVxS3F6NzhuVGcvQ1ArWExLQVI2djlDY244UTNYenpXdkdlQ0pW?= =?utf-8?B?a2tlc0h0UzBFc2ZONUc0MDVCNzF6T1BFWHJ1a3E0cmRnQjRVUndoUGx1MjZ0?= =?utf-8?B?dWwza3VtS1V6aUVtSWRGZ0kvd2J6Zlc5ZDNxUy9pQ2V5ckZwZi9hNDhRQjE4?= =?utf-8?B?Y0FnSzFVQ1hJRk5ZZkkzbStqZndRQnJualFFQkoxOTR6QjJGYlhHYU1sbGc3?= =?utf-8?B?OVE9PQ==?= Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------AtQ3sTLoooRJQrBV76rYfuP3" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: 6ea76559-c70e-4b1c-8ee1-08dcef8b5be4 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2024 15:41:40.0837 (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: YK09arh/dBhVX0VFfeGQpqQYa41vv+tHMz1W66ZfhuYDQuv7URdp1xd6tK256UwlY7WeDngQLCJKFEOPQL5W0w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CWLP265MB2259 X-Authority-Analysis: v=2.4 cv=AcbjHGXG c=1 sm=1 tr=0 ts=671281b6 cx=c_pps a=tbUAc5YXJZE2aXMCunvlBA==:117 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=DAUX931o1VcA:10 a=WnR_qW7rlZcA:10 a=NgoYpvdbvlAA:10 a=r_1tXGB3AAAA:8 a=VwQbUJbxAAAA:8 a=2vpGiOW3mguWqdhXNEEA:9 a=QEXdDO2ut3YA:10 a=FQAv6l16WG0gR8wUSMMA:9 a=FfaGCDsud1wA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-ORIG-GUID: oXZFUJlsOVUzBZYpeOXfONpDufMa_C5d X-Proofpoint-GUID: oXZFUJlsOVUzBZYpeOXfONpDufMa_C5d --------------AtQ3sTLoooRJQrBV76rYfuP3 Content-Type: multipart/mixed; boundary="------------4Ex0tgkJ9HdK0AfC9K0JG9FX"; protected-headers="v1" 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 Message-ID: <8a25924f-1bb7-4d9a-a346-58e871dfb1d1@imgtec.com> Subject: [PATCH v3 2/2] drm/imagination: Break an object reference loop References: In-Reply-To: --------------4Ex0tgkJ9HdK0AfC9K0JG9FX Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable From: Brendan King 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 =E2=80=9Cscheduled=E2=80=9D fence PVR driver =E2=80=9Cdone=E2=80=9D 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. Signed-off-by: Brendan King Signed-off-by: Matt Coster Reviewed-by: Frank Binns Cc: stable@vger.kernel.org --- Changes in v1 -> v2: - None Changes in v2 -> v3: - Add Frank's Rb [1] - Add Cc: stable tag [1]: https://lore.kernel.org/dri-devel/b75e658cc5ce9ac24df2c31c1a6fd798a5= f3a87f.camel@imgtec.com/ --- drivers/gpu/drm/imagination/pvr_context.c | 19 +++++++++++++++++++ drivers/gpu/drm/imagination/pvr_context.h | 18 ++++++++++++++++++ drivers/gpu/drm/imagination/pvr_vm.c | 22 ++++++++++++++++++---- drivers/gpu/drm/imagination/pvr_vm.h | 1 + 4 files changed, 56 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_context.c b/drivers/gpu/drm/= imagination/pvr_context.c index 255c93582734..4cb3494c0bb2 100644 --- a/drivers/gpu/drm/imagination/pvr_context.c +++ b/drivers/gpu/drm/imagination/pvr_context.c @@ -450,11 +450,30 @@ pvr_context_destroy(struct pvr_file *pvr_file, u32 = handle) */ void pvr_destroy_contexts_for_file(struct pvr_file *pvr_file) { + struct pvr_device *pvr_dev =3D pvr_file->pvr_dev; struct pvr_context *ctx; unsigned long handle; =20 xa_for_each(&pvr_file->ctx_handles, handle, ctx) pvr_context_destroy(pvr_file, handle); + + spin_lock(&pvr_dev->ctx_list_lock); + ctx =3D list_first_entry(&pvr_file->contexts, struct pvr_context, file_= link); + + while (!list_entry_is_head(ctx, &pvr_file->contexts, file_link)) { + list_del_init(&ctx->file_link); + + if (pvr_context_get_if_referenced(ctx)) { + spin_unlock(&pvr_dev->ctx_list_lock); + + pvr_vm_unmap_all(ctx->vm_ctx); + + pvr_context_put(ctx); + spin_lock(&pvr_dev->ctx_list_lock); + } + ctx =3D list_first_entry(&pvr_file->contexts, struct pvr_context, file= _link); + } + spin_unlock(&pvr_dev->ctx_list_lock); } =20 /** diff --git a/drivers/gpu/drm/imagination/pvr_context.h b/drivers/gpu/drm/= imagination/pvr_context.h index a5b0a82a54a1..07afa179cdf4 100644 --- a/drivers/gpu/drm/imagination/pvr_context.h +++ b/drivers/gpu/drm/imagination/pvr_context.h @@ -126,6 +126,24 @@ pvr_context_get(struct pvr_context *ctx) return ctx; } =20 +/** + * pvr_context_get_if_referenced() - Take an additional reference on a s= till + * referenced context. + * @ctx: Context pointer. + * + * Call pvr_context_put() to release. + * + * Returns: + * * True on success, or + * * false if no context pointer passed, or the context wasn't still + * * referenced. + */ +static __always_inline bool +pvr_context_get_if_referenced(struct pvr_context *ctx) +{ + return ctx !=3D NULL && kref_get_unless_zero(&ctx->ref_count) !=3D 0; +} + /** * pvr_context_lookup() - Lookup context pointer from handle and file. * @pvr_file: Pointer to pvr_file structure. diff --git a/drivers/gpu/drm/imagination/pvr_vm.c b/drivers/gpu/drm/imagi= nation/pvr_vm.c index 97c0f772ed65..7bd6ba4c6e8a 100644 --- a/drivers/gpu/drm/imagination/pvr_vm.c +++ b/drivers/gpu/drm/imagination/pvr_vm.c @@ -14,6 +14,7 @@ #include #include =20 +#include #include #include #include @@ -597,12 +598,26 @@ pvr_vm_create_context(struct pvr_device *pvr_dev, b= ool is_userspace_context) } =20 /** - * pvr_vm_context_release() - Teardown a VM context. - * @ref_count: Pointer to reference counter of the VM context. + * pvr_vm_unmap_all() - Unmap all mappings associated with a VM context.= + * @vm_ctx: Target VM context. * * This function ensures that no mappings are left dangling by unmapping= them * all in order of ascending device-virtual address. */ +void +pvr_vm_unmap_all(struct pvr_vm_context *vm_ctx) +{ + WARN_ON(pvr_vm_unmap(vm_ctx, vm_ctx->gpuvm_mgr.mm_start, + vm_ctx->gpuvm_mgr.mm_range)); +} + +/** + * pvr_vm_context_release() - Teardown a VM context. + * @ref_count: Pointer to reference counter of the VM context. + * + * This function also ensures that no mappings are left dangling by call= ing + * pvr_vm_unmap_all. + */ static void pvr_vm_context_release(struct kref *ref_count) { @@ -612,8 +627,7 @@ pvr_vm_context_release(struct kref *ref_count) if (vm_ctx->fw_mem_ctx_obj) pvr_fw_object_destroy(vm_ctx->fw_mem_ctx_obj); =20 - WARN_ON(pvr_vm_unmap(vm_ctx, vm_ctx->gpuvm_mgr.mm_start, - vm_ctx->gpuvm_mgr.mm_range)); + pvr_vm_unmap_all(vm_ctx); =20 pvr_mmu_context_destroy(vm_ctx->mmu_ctx); drm_gem_private_object_fini(&vm_ctx->dummy_gem); diff --git a/drivers/gpu/drm/imagination/pvr_vm.h b/drivers/gpu/drm/imagi= nation/pvr_vm.h index f2a6463f2b05..79406243617c 100644 --- a/drivers/gpu/drm/imagination/pvr_vm.h +++ b/drivers/gpu/drm/imagination/pvr_vm.h @@ -39,6 +39,7 @@ int pvr_vm_map(struct pvr_vm_context *vm_ctx, struct pvr_gem_object *pvr_obj, u64 pvr_obj_offset, u64 device_addr, u64 size); int pvr_vm_unmap(struct pvr_vm_context *vm_ctx, u64 device_addr, u64 siz= e); +void pvr_vm_unmap_all(struct pvr_vm_context *vm_ctx); =20 dma_addr_t pvr_vm_get_page_table_root_addr(struct pvr_vm_context *vm_ctx= ); struct dma_resv *pvr_vm_get_dma_resv(struct pvr_vm_context *vm_ctx); --=20 2.47.0 --------------4Ex0tgkJ9HdK0AfC9K0JG9FX-- --------------AtQ3sTLoooRJQrBV76rYfuP3 Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature.asc" -----BEGIN PGP SIGNATURE----- wnsEABYIACMWIQS4qDmoJvwmKhjY+nN5vBnz2d5qsAUCZxKBswUDAAAAAAAKCRB5vBnz2d5qsIE6 AP93dvlO/G/K1kOPz+isg4v/U8tjScJCPLNpDATkZz1axQD/ZrVEkiKukUUVQykSU14jlMPz/cgJ K+JmSBa2iMzeTAE= =Ikxd -----END PGP SIGNATURE----- --------------AtQ3sTLoooRJQrBV76rYfuP3--