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 30CC7C4167B for ; Thu, 7 Dec 2023 10:24:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5662D10E197; Thu, 7 Dec 2023 10:24:03 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 1513C10E197 for ; Thu, 7 Dec 2023 10:24:01 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A486B12FC; Thu, 7 Dec 2023 02:24:46 -0800 (PST) Received: from [10.1.30.42] (e122027.cambridge.arm.com [10.1.30.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 54D863F762; Thu, 7 Dec 2023 02:23:57 -0800 (PST) Message-ID: <1b957ca4-71cf-42fd-ac81-1920592b952d@arm.com> Date: Thu, 7 Dec 2023 10:23:55 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 03/14] drm/panthor: Add the device logical block To: Boris Brezillon References: <20231204173313.2098733-1-boris.brezillon@collabora.com> <20231204173313.2098733-4-boris.brezillon@collabora.com> <4d813208-39fe-4387-8415-4b0c17df42a4@arm.com> <20231207091243.7ce56a6e@collabora.com> <20231207095635.435d3e77@collabora.com> Content-Language: en-GB From: Steven Price In-Reply-To: <20231207095635.435d3e77@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: , Cc: Nicolas Boichat , kernel@collabora.com, Daniel Stone , Neil Armstrong , Liviu Dudau , dri-devel@lists.freedesktop.org, Matt Coster , =?UTF-8?B?Q2zDqW1lbnQgUMOpcm9u?= , Donald Robson , Grant Likely , "Marty E . Plummer" , Robin Murphy , Faith Ekstrand Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 07/12/2023 08:56, Boris Brezillon wrote: > On Thu, 7 Dec 2023 09:12:43 +0100 > Boris Brezillon wrote: > >> On Wed, 6 Dec 2023 16:55:42 +0000 >> Steven Price wrote: >> >>> On 04/12/2023 17:32, Boris Brezillon wrote: >>>> The panthor driver is designed in a modular way, where each logical >>>> block is dealing with a specific HW-block or software feature. In order >>>> for those blocks to communicate with each other, we need a central >>>> panthor_device collecting all the blocks, and exposing some common >>>> features, like interrupt handling, power management, reset, ... >>>> >>>> This what this panthor_device logical block is about. >>>> >>>> v3: >>>> - Add acks for the MIT+GPL2 relicensing >>>> - Fix 32-bit support >>>> - Shorten the sections protected by panthor_device::pm::mmio_lock to fix >>>> lock ordering issues. >>>> - Rename panthor_device::pm::lock into panthor_device::pm::mmio_lock to >>>> better reflect what this lock is protecting >>>> - Use dev_err_probe() >>>> - Make sure we call drm_dev_exit() when something fails half-way in >>>> panthor_device_reset_work() >>>> - Replace CSF_GPU_LATEST_FLUSH_ID_DEFAULT with a constant '1' and a >>>> comment to explain. Also remove setting the dummy flush ID on suspend. >>>> - Remove drm_WARN_ON() in panthor_exception_name() >>>> - Check pirq->suspended in panthor_xxx_irq_raw_handler() >>>> >>>> Signed-off-by: Boris Brezillon >>>> Signed-off-by: Steven Price >>>> Acked-by: Steven Price # MIT+GPL2 relicensing,Arm >>>> Acked-by: Grant Likely # MIT+GPL2 relicensing,Linaro >>>> Acked-by: Boris Brezillon # MIT+GPL2 relicensing,Collabora >>> >>> We still have the "FIXME: this is racy" >> >> Yeah, I still didn't find a proper solution for that. > > This [1] should fix the race condition in the unplug path. > > [1]https://gitlab.freedesktop.org/panfrost/linux/-/commit/b79b28069e524ae7fea22a9a158b870eab2d5f9a Looks like it should do the job. I'm surprised that we're the only ones to face this though. Looking at the new imagination driver it appears there's a similar problem: pvr_device_lost() uses a boolean 'lost' to track multiple calls but that boolean isn't protected by any specific lock (AFAICT). Indeed pvr_device_lost() calls drm_dev_unplug() while in a drm_dev_enter() critical section (see pvr_mmu_flush_exec()). If I'm not mistaken that's the same problem we discussed and isn't allowed? drm_dev_unplug() will synchronise on the SRCU that drm_dev_enter() is holding. +CC: Frank, Donald, Matt from Imagination. Steve