From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (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 3351C244664 for ; Thu, 4 Dec 2025 09:27:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764840468; cv=none; b=QxqaWsPkDECwtT/+CdGvpU+p2dCK3zYsEwubQW1gg7V7m9la5WyQwvq5+V/NbGVFTmwGOuE22+8MLoKe0vUOYTKRBe4ZUB+t6HJnoPpeBisyK0H8mdAuXt1/tQqbV4ZWyRVTtafyjao7aAjxv5AweKqUTFgV560GEyIeo9YstaA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764840468; c=relaxed/simple; bh=M3CVS+ybq4Y3joyowvD+mgdxiHTzEh4dpu+fxM2+0As=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=IoV2I6KJJN4Y2adtdCopdM9kIXWo3WC/tmsxypCkmFoJf+SZw75ZVXvRJ+wp+gv+BzCpzB3X9upEgHktZ/TeUvJ6pTjEjxE9xRMQ6/oaHBrFU4eY6B48QsaXlp53raccs1Nhv/29V4aTXYjvQr4pSrhq84ie8yiWmj6t3e/1xJk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=nrAOdMet; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="nrAOdMet" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=XLnP7djkkJPtZ/I0IdDwGxartFWzs2okdYnXPrpFjts=; b=nrAOdMetj8Xl4grYL1doShScDj mvDxCwihCwAVZQpdbYxyRXR+Rlce+4GXj387Im5VJ/qAqGHcdZdqsd8GDwMXp99Nz4DPQjEXkhGgn KYI1lMo/iCf4LBDWYRUoeNBkh3pdMJZ0EAYpFzD2/NKTWfMJdEeCAPIT4iryhZy3jfPN9Fa+TY6p3 FVXxstxst235z1aFH1L5pxe8AVrVMX9pb4EnMBolmPeAyTI8E+1zHsg+OMvWNqOiKz6so5i9RY0tv iCSN5Xe8G8TqRt1OoJr0yssEl8XgaUe1bjXfFL5xoh9VJNE/q/hUAg58eSXwbD9E4/G28OlGR9yFw FVGt56mw==; Received: from [90.240.106.137] (helo=[192.168.0.101]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1vR5cT-008bIB-7F; Thu, 04 Dec 2025 10:27:25 +0100 Message-ID: <4e59c6f8-bc9b-4fd5-9b0f-511cce760ac2@igalia.com> Date: Thu, 4 Dec 2025 09:27:24 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drm/panthor: fix for dma-fence safe access rules To: Chia-I Wu , Boris Brezillon , Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Grant Likely , Heiko Stuebner , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20251204015034.841235-1-olvaffe@gmail.com> Content-Language: en-GB From: Tvrtko Ursulin In-Reply-To: <20251204015034.841235-1-olvaffe@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 04/12/2025 01:50, Chia-I Wu wrote: > Commit 506aa8b02a8d6 ("dma-fence: Add safe access helpers and document > the rules") details the dma-fence safe access rules. The most common > culprit is that drm_sched_fence_get_timeline_name may race with > group_free_queue. > > Fixes: d2624d90a0b77 ("drm/panthor: assign unique names to queues") > Signed-off-by: Chia-I Wu > --- > drivers/gpu/drm/panthor/panthor_sched.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c > index 33b9ef537e359..a8b1347e4da71 100644 > --- a/drivers/gpu/drm/panthor/panthor_sched.c > +++ b/drivers/gpu/drm/panthor/panthor_sched.c > @@ -23,6 +23,7 @@ > #include > #include > #include > +#include > > #include "panthor_devfreq.h" > #include "panthor_device.h" > @@ -923,6 +924,9 @@ static void group_release_work(struct work_struct *work) > release_work); > u32 i; > > + /* dma-fences may still be accessing group->queues under rcu lock. */ > + synchronize_rcu(); > + > for (i = 0; i < group->queue_count; i++) > group_free_queue(group, group->queues[i]); > This handles the shared queue->fence_ctx.lock as well (which is also unsafe until Christian lands the inline lock, etc patch series) so it looks good to me as well. Just to mention an alternative could be to simply switch release_work to INIT_RCU_WORK/queue_rcu_work, but I am not sure if that has an advantage. Regards, Tvrtko