From mboxrd@z Thu Jan 1 00:00:00 1970 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 D934BEFCD9A for ; Mon, 9 Mar 2026 11:06:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3DC7F10E086; Mon, 9 Mar 2026 11:06:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b="jfrhgwta"; dkim-atps=neutral Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0040510E086 for ; Mon, 9 Mar 2026 11:06:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1773054383; cv=none; d=zohomail.com; s=zohoarc; b=lXlFZ72cU/aRrW7LmGG2yZhMpNSKRWPFDBAp/YW/sl2beW4nSzjMSjyWSjQGsY7uqaJxieaMesW4fF4xHNQv5h7AhzCk8QlqpVdYXtrBvdi2vYZQIc5AQa4hi+Sa5WeQKvdxTg0kfJSGjN6PcLjJ1Bl/cC9+9jMW261BBMGmPA8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773054383; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=Eeh1cdanEOmabAhjNHIikIbw+iJiDdwokc8wn9IroaA=; b=Z6yENlgfFrq9d0OH8dQ4NtqlCghNQTEEF7vgjcPSQtA50pVmnlI1WoDS3v7ea+7V8Aryb/I05Ez43dk7DNkAXlll31EIIGVyXB5YKp3P2id5WavcZVnPC18Tbwb+tTYj6L0c8PAyu1TidCf/E/ifwOS1T5t2Mb/3hdJ9h1RmExY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=nicolas.frattaroli@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773054383; s=zohomail; d=collabora.com; i=nicolas.frattaroli@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=Eeh1cdanEOmabAhjNHIikIbw+iJiDdwokc8wn9IroaA=; b=jfrhgwtaOOKydRqVglr7/VBdiUN/vHsOfBw9M+zI8l0WZGfbG5AH04cDzVySGL9x 7LlxmaRf0vBSZBivYYzVxsWu2VvtPLXlvxvaFcsJ3lYpkSHM+kPSPLmN+RC/aLpzPSb BJHtC2RCyKqaBHmkSnHEVE+25iEnOr3DrLUohrfM= Received: by mx.zohomail.com with SMTPS id 1773054381923386.3573260661302; Mon, 9 Mar 2026 04:06:21 -0700 (PDT) From: Nicolas Frattaroli To: Boris Brezillon , Steven Price , Liviu Dudau , =?UTF-8?B?QWRyacOhbg==?= Larumbe , Boris Brezillon Cc: dri-devel@lists.freedesktop.org, kernel@collabora.com, Tvrtko Ursulin , Philipp Stanner , Christian =?UTF-8?B?S8O2bmln?= Subject: Re: [PATCH] drm/panthor: Fix the "done_fence is initialized" detection logic Date: Mon, 09 Mar 2026 12:06:17 +0100 Message-ID: <5084502.31r3eYUQgx@workhorse> In-Reply-To: <20260309103053.211415-1-boris.brezillon@collabora.com> References: <20260309103053.211415-1-boris.brezillon@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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" On Monday, 9 March 2026 11:30:53 Central European Standard Time Boris Brezi= llon wrote: > After commit 541c8f2468b9 ("dma-buf: detach fence ops on signal v3"), > dma_fence::ops =3D=3D NULL can't be used to check if the fence is initial= ized > or not. We could turn this into an "is_signaled() || ops =3D=3D NULL" tes= t, > but that's fragile, since it's still subject to dma_fence internal > changes. So let's have the "is_initialized" state encoded directly in > the pointer through the lowest bit which is guaranteed to be unused > because of the dma_fence alignment constraint. >=20 > Cc: Nicolas Frattaroli > Cc: Tvrtko Ursulin > Cc: Philipp Stanner > Cc: Christian K=C3=B6nig > Reported-by: Steven Price > Reported-by: Nicolas Frattaroli > Fixes: 541c8f2468b9 ("dma-buf: detach fence ops on signal v3") > Signed-off-by: Boris Brezillon > --- > drivers/gpu/drm/panthor/panthor_sched.c | 69 ++++++++++++++++++------- > 1 file changed, 50 insertions(+), 19 deletions(-) Tested-by: Nicolas Frattaroli This fixes a refcount underflow for me when I do something that spams a bunch of fatal exceptions and then terminate the userspace application that produces them.