From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 779F034040D for ; Tue, 11 Aug 2026 14:37:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786459065; cv=none; b=UWn+58pX/2e2stj4w9JiDw0gT39Ov3P6DQwFoapyTbOGQZroaZntbsyA5v0scd3/lO9CM8nj/5behMWEZuXI0xqLmffmPz/URIPq1A8zcllbvBQNE513UNhtlJg9sEtgDzyUalsWpBTKxS76uwtF3a07pHf85mWCXj59/hJMXFw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786459065; c=relaxed/simple; bh=NsiQxklS/RIFFjMSGwD+1R2BbXPDRF8gNiD0vyxfKqo=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jq0grSMgoyWwOcVTTOnApFwY9nF6DEtevRpoTs7pHSwiqeLPDMZj4B/bBZNjRQHWytRfRRsAahcoHAGo/s2I6BAlQJx/SI4W5Sz3cfXB2GjCYUWAqE+Vpp49CpOJ5q8q+Aap5jmyksZRbLumU8aOzBl3vUexiGFug/MJROOxVXk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=TzGKT6wV; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="TzGKT6wV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1786459062; bh=NsiQxklS/RIFFjMSGwD+1R2BbXPDRF8gNiD0vyxfKqo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=TzGKT6wVtRQMjXpDZqof2AaKFGghPdI43B2BhH61Z3ZH0ifhKDzX2obTxMH6Lmp57 yYIdyY6qad9k2+hm4DV88RWGyHVHRZo5XKCCJiKVSQDElTQlFqdWAreQwBSud4oFUT AGXlJdQt94lK9zUiLVkQN0aH+aYXhC5qWeMt6IHHL3Ad2kcCjEBFduKzjpGJmkWO4O 7VXJmi1yas+aKdRq4wsaYoVvTTcDrpVaD0wOLlhRQUL29XhS/Ms74E34PWx7fr1+xH ld9X+TMd9ZHXTiHYCYD67gMrQtBrhCCYGC3i64CWvT34GQTNa+NdXbmB4nW5Kv4fsX DZ2r/Fk+AbGXQ== Received: from fedora-21.home (unknown [100.64.0.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange secp256r1 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by bali.collaboradmins.com (Postfix) with ESMTPSA id 19ACC17E0667; Tue, 11 Aug 2026 16:37:42 +0200 (CEST) Date: Tue, 11 Aug 2026 16:37:37 +0200 From: Boris Brezillon To: Nicolas Frattaroli Cc: Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Grant Likely , Heiko Stuebner , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, kernel@collabora.com Subject: Re: [PATCH v3 3/3] drm/panthor: Take reqs_lock in soft_reset for clearing pending_reqs Message-ID: <20260811163737.4b1ca522@fedora-21.home> In-Reply-To: <20260811-panthor-cache-flush-fix-v3-3-47d2c1bb1dab@collabora.com> References: <20260811-panthor-cache-flush-fix-v3-0-47d2c1bb1dab@collabora.com> <20260811-panthor-cache-flush-fix-v3-3-47d2c1bb1dab@collabora.com> Organization: Collabora X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 11 Aug 2026 16:08:33 +0200 Nicolas Frattaroli wrote: > panthor_gpu_soft_reset() sets pending_reqs to 0 without taking the > requisite reqs_lock. > > Fix this by taking the lock for the duration of the modification. > > Fixes: 5cd894e258c4 ("drm/panthor: Add the GPU logical block") > Signed-off-by: Nicolas Frattaroli > --- > drivers/gpu/drm/panthor/panthor_gpu.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/panthor/panthor_gpu.c b/drivers/gpu/drm/panthor/panthor_gpu.c > index cb5319d1c5de..12e7e29b35b5 100644 > --- a/drivers/gpu/drm/panthor/panthor_gpu.c > +++ b/drivers/gpu/drm/panthor/panthor_gpu.c > @@ -405,7 +405,10 @@ int panthor_gpu_soft_reset(struct panthor_device *ptdev) > return -ETIMEDOUT; > } > > - ptdev->gpu->pending_reqs = 0; > + scoped_guard(spinlock, &ptdev->gpu->reqs_lock) { > + ptdev->gpu->pending_reqs = 0; > + } In practice, this happens when nothing else interacts with the GPU (IRQs have been suspended, and any access to the HW should be filtered out/delayed until the reset is effective), but I agree it's safer and more consistent to have this assigned done under the reqs_lock. Reviewed-by: Boris Brezillon