From nobody Tue Sep 29 04:39:33 2026 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (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 602B645A285 for ; Wed, 12 Aug 2026 14:08:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786543699; cv=pass; b=Y4ftUI5J97hxJy83D1iu2RRIp3Yj6pSHZTvSm6iosIJ570a/CMjjQOLRpUbMhIKZvfNtdAdRBiunftqYRo1ygiWIRSoHnvHzrYwHDblx/9+ZpnwjQDkmmz1NyKAFgtfL8TdXLNp+xCDkobBXlHSmKC+1NU8wvmQkRJsstuvpJQw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786543699; c=relaxed/simple; bh=rdWMIoZhLQBX2qNdm9LG+8j6Mh2YNYotGmPPfapV500=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i7OOpLo7ADWu658Kv2ItUV8at04AsbYMEhGsWwP/h5a900/V2/wQQ87pLWqcLt2VqIeZELxqg/M4fGQxSHno8nNYH/UVdWGpHGVcm/tUyxZKbhHcRbfaf2vGQZsj/685B+P3BIhSajHLCF1CGhF8EdksCK+7oUx7q+6Sjqkzyiw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b=WR1pPQD1; arc=pass smtp.client-ip=136.143.188.112 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 (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b="WR1pPQD1" ARC-Seal: i=1; a=rsa-sha256; t=1786543665; cv=none; d=zohomail.com; s=zohoarc; b=mVuLC0Y1n+VHUgIJe7Ew7Him+6dSZDYpxEIhyulZxQnIUm9IMasPbJyZMdtrVpTaBO7XcVfoHcEuQSzSjQ+iCccAwTzDP5UvniRLLqK1NsYzEHM41bx6K1vYomAHEvUwFFKmSQZX3ub1a4teeWX+p1bNkIq3xsmseKpZRppA7oI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786543665; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=I6vWnS1wTCIKEgK1Y1hzrODYhhOal746YWUq+5WuGqI=; b=YlasFehSX8uLWbdL23GZvDW3ypd5d2TANhzghlRGvgGDkCFA4GIzXhevObKV1SahdqLw7G/z91FrhPki7DX3OAs7SLwP5Cd9GSEUWC9T/EBEsxeNvkqZ81ny7154axw+tKZ9wZsd+efPcw1Cmqhk8trwWGynp/tjP2FCv45J+GA= 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=1786543665; s=zohomail; d=collabora.com; i=nicolas.frattaroli@collabora.com; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=I6vWnS1wTCIKEgK1Y1hzrODYhhOal746YWUq+5WuGqI=; b=WR1pPQD1jUs1gjNa+CgU8+1b9XuEGNoi4eLXFhjoKq4PbLpy2//MQliqBQvOEGU7 GY+qrwXL3OWlJT6tl5kvRwHOVGkrLlbYtPkhs22NVtADmExHOgMygOSelka0XuDmT1Y I1SBXaOjtgNTwzlQeM3dbf22gmqwLPLt8DlR13Ys= Received: by mx.zohomail.com with SMTPS id 1786543662895618.0778032572175; Wed, 12 Aug 2026 07:07:42 -0700 (PDT) From: Nicolas Frattaroli Date: Wed, 12 Aug 2026 16:07:18 +0200 Subject: [PATCH v4 1/3] drm/panthor: Add tracepoint for cache flushing 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260812-panthor-cache-flush-fix-v4-1-751e32901898@collabora.com> References: <20260812-panthor-cache-flush-fix-v4-0-751e32901898@collabora.com> In-Reply-To: <20260812-panthor-cache-flush-fix-v4-0-751e32901898@collabora.com> To: Boris Brezillon , Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Grant Likely , Heiko Stuebner Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, kernel@collabora.com, Nicolas Frattaroli X-Mailer: b4 0.15.2 Add a new event tracepoint: gpu_cache_flush to be emitted after a GPU cache flush completes, with duration and return status arguments. This allows debugging the duration a flush takes irrespective of initial function entry lock contention, and communicates information about whether the flush timed out or errored out in other ways, and which caches were flushed. Signed-off-by: Nicolas Frattaroli Reviewed-by: Boris Brezillon Reviewed-by: Liviu Dudau Reviewed-by: Steven Price --- drivers/gpu/drm/panthor/panthor_gpu.c | 26 +++++++++++++++++++++- drivers/gpu/drm/panthor/panthor_trace.h | 38 +++++++++++++++++++++++++++++= ++++ 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panthor/panthor_gpu.c b/drivers/gpu/drm/pantho= r/panthor_gpu.c index c013d6bf9a59..7088371c6d64 100644 --- a/drivers/gpu/drm/panthor/panthor_gpu.c +++ b/drivers/gpu/drm/panthor/panthor_gpu.c @@ -317,6 +317,21 @@ int panthor_gpu_l2_power_on(struct panthor_device *ptd= ev) return panthor_gpu_power_on(ptdev, L2, 1, 20000); } =20 +static inline void panthor_gpu_emit_flush_caches_tp(struct panthor_device = *ptdev, + u64 start, u32 l2, u32 lsc, + u32 other, int ret) +{ + u32 duration; + + if (!tracepoint_enabled(gpu_cache_flush) || !start) + return; + + if (check_sub_overflow(ktime_get_ns(), start, &duration)) + duration =3D U32_MAX; + + trace_gpu_cache_flush(ptdev->base.dev, l2, lsc, other, duration, ret); +} + /** * panthor_gpu_flush_caches() - Flush caches * @ptdev: Device. @@ -331,12 +346,17 @@ int panthor_gpu_flush_caches(struct panthor_device *p= tdev, { struct panthor_gpu *gpu =3D ptdev->gpu; unsigned long flags; + u64 start =3D 0; int ret =3D 0; =20 /* Serialize cache flush operations. */ guard(mutex)(&ptdev->gpu->cache_flush_lock); =20 spin_lock_irqsave(&ptdev->gpu->reqs_lock, flags); + + if (tracepoint_enabled(gpu_cache_flush)) + start =3D ktime_get_ns(); + if (!(ptdev->gpu->pending_reqs & GPU_IRQ_CLEAN_CACHES_COMPLETED)) { ptdev->gpu->pending_reqs |=3D GPU_IRQ_CLEAN_CACHES_COMPLETED; gpu_write(gpu->iomem, GPU_CMD, GPU_FLUSH_CACHES(l2, lsc, other)); @@ -345,8 +365,10 @@ int panthor_gpu_flush_caches(struct panthor_device *pt= dev, } spin_unlock_irqrestore(&ptdev->gpu->reqs_lock, flags); =20 - if (ret) + if (ret) { + panthor_gpu_emit_flush_caches_tp(ptdev, start, l2, lsc, other, ret); return ret; + } =20 if (!wait_event_timeout(ptdev->gpu->reqs_acked, !(ptdev->gpu->pending_reqs & GPU_IRQ_CLEAN_CACHES_COMPLETED), @@ -360,6 +382,8 @@ int panthor_gpu_flush_caches(struct panthor_device *ptd= ev, spin_unlock_irqrestore(&ptdev->gpu->reqs_lock, flags); } =20 + panthor_gpu_emit_flush_caches_tp(ptdev, start, l2, lsc, other, ret); + if (ret) { panthor_device_schedule_reset(ptdev); drm_err(&ptdev->base, "Flush caches timeout"); diff --git a/drivers/gpu/drm/panthor/panthor_trace.h b/drivers/gpu/drm/pant= hor/panthor_trace.h index 6ffeb4fe6599..bd8652549ab4 100644 --- a/drivers/gpu/drm/panthor/panthor_trace.h +++ b/drivers/gpu/drm/panthor/panthor_trace.h @@ -76,6 +76,44 @@ TRACE_EVENT(gpu_job_irq, __entry->events, __entry->duration_ns) ); =20 +/** + * gpu_cache_flush - emitted after cache flush completes + * @dev: pointer to the &struct device, for printing the device name + * @l2: "l2" flush flags + * @lsc: "lsc" flush flags + * @other: "other" flush flags + * @duration_ns: how long the cache flush operation took, in nanoseconds + * @ret: return status, 0 =3D=3D success, negative errno on error + * + * Begins measuring after any initial lock contention around the locks nee= ded + * for flushing caches, but before the actual cache flush is requested. St= ops + * measuring and is emitted after flush operation is over. + */ +TRACE_EVENT(gpu_cache_flush, + TP_PROTO(const struct device *dev, u32 l2, u32 lsc, u32 other, + u32 duration_ns, int ret), + TP_ARGS(dev, l2, lsc, other, duration_ns, ret), + TP_STRUCT__entry( + __string(dev_name, dev_name(dev)) + __field(u32, l2) + __field(u32, lsc) + __field(u32, other) + __field(u32, duration_ns) + __field(int, ret) + ), + TP_fast_assign( + __assign_str(dev_name); + __entry->l2 =3D l2; + __entry->lsc =3D lsc; + __entry->other =3D other; + __entry->duration_ns =3D duration_ns; + __entry->ret =3D ret; + ), + TP_printk("%s: l2=3D0x%x lsc=3D0x%x other=3D0x%x duration_ns=3D%u ret= =3D%d", + __get_str(dev_name), __entry->l2, __entry->lsc, + __entry->other, __entry->duration_ns, __entry->ret) +); + #endif /* __PANTHOR_TRACE_H__ */ =20 #undef TRACE_INCLUDE_PATH --=20 2.55.0 From nobody Tue Sep 29 04:39:33 2026 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (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 DA55845A2A1 for ; Wed, 12 Aug 2026 14:08:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786543700; cv=pass; b=Qnrpgz6OfROCt4rIiqmpFo/Psm43qLPadXIrBRQtw4XCnLu3rNA+hJ6y1IiTbRdIARj+0lxet0X2t5G19vyxNvmUd9yOZaSkUM5X25jdKZwA0EcF/SQGWfHnkyM/VDKqGWH2UzyeohhhEk6RAk6houFXD+TuExYvRS7O/9GEDh4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786543700; c=relaxed/simple; bh=4/EX8QRi1oSnyyACescSDX5l2PBNVtnXCbq1C5ZUHew=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CD106+9zG/IBWARdRMhjo6ntNC2A+l2E7e0I4jOe41tH8r+U4ZM/f7QY8of4ninGr5TIoMICkKbisVGOrBFFwA8bBSYPqc6osjfFEepm1mlqe6LWOpaP1f/JJ/uDXx1S/FV6DbU/ttYqYQ+z85RBoUCrvBsyr9EHVmjM2MxlC8A= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b=UCd6c/hc; arc=pass smtp.client-ip=136.143.188.112 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 (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b="UCd6c/hc" ARC-Seal: i=1; a=rsa-sha256; t=1786543668; cv=none; d=zohomail.com; s=zohoarc; b=MAlBNkGUpZ2y2UwmGLeI/nYmFJ2gAvY6ty+TjWRv179utJX2qhtMjdIceXtX8wpdW3uXlEtmkc/bhQJkcb1GePL5Kpjmi3uvOWcVlQ7ssZXeOdDNCfzkty0RxujUxzkPMU9HPPy6+I6UXEvjBPNJZsLDgz9/CX53TarggNVkkO8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786543668; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=4fITRmWPwYliTA04mteOIgcZ9Rsn8HY/JqMqrf0JF8w=; b=ceJHCPtzdaSQqeHHwoqV1T4ozeYz0sllYsuQC3aPOjzUYXD1upDAHcwwK+21MAlfQ39YScs7zu8ViHQx1YN1SxjZsuJbfQqiQa8Tbh+jqUZ24KQKqXj49P7QJaVL0kC/RlKdXnmh+qP6+yJ5mWLSosE4uLPSv5A1+5h9n/apIdQ= 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=1786543668; s=zohomail; d=collabora.com; i=nicolas.frattaroli@collabora.com; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=4fITRmWPwYliTA04mteOIgcZ9Rsn8HY/JqMqrf0JF8w=; b=UCd6c/hc79kPU/F2ZHLR9gE6oinAQ0QFdyis8jBL4R8U/+7oegLkJjz95KE3+YPG GMJS6iY6DFQrA9a1egX9UYfGNXqrAstH+EHiCSdZnmCw9QA1QWtRxxsmA5bAxFBdPDI 5IIhnBcDgvJEitjFAVxQSToBh5YEHpiOwSxgmIis= Received: by mx.zohomail.com with SMTPS id 1786543665869804.8658229040461; Wed, 12 Aug 2026 07:07:45 -0700 (PDT) From: Nicolas Frattaroli Date: Wed, 12 Aug 2026 16:07:19 +0200 Subject: [PATCH v4 2/3] drm/panthor: Revisit reqs_lock handling in flush/reset paths 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260812-panthor-cache-flush-fix-v4-2-751e32901898@collabora.com> References: <20260812-panthor-cache-flush-fix-v4-0-751e32901898@collabora.com> In-Reply-To: <20260812-panthor-cache-flush-fix-v4-0-751e32901898@collabora.com> To: Boris Brezillon , Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Grant Likely , Heiko Stuebner Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, kernel@collabora.com, Nicolas Frattaroli X-Mailer: b4 0.15.2 panthor_gpu_flush_caches() and panthor_gpu_soft_reset() acquire their reqs_lock spinlock with the IRQ-disabling variants of the spinlocking functions. This isn't necessary, as the lock is never taken from an atomic context, as Panthor uses threaded interrupt handlers. The result of this overly strict locking is that IRQs may be disabled more frequently and for longer than they should be, resulting in increased system latency. Switch the locking to use non-IRQ-disabling scoped_guard statements for locking. The wait_event_timeout read of pending_reqs outside of the spinlock is fine as wait_event_timeout is a memory barrier according to the Linux Memory Model. Fixes: 5cd894e258c4 ("drm/panthor: Add the GPU logical block") Reviewed-by: Boris Brezillon Signed-off-by: Nicolas Frattaroli Reviewed-by: Liviu Dudau Reviewed-by: Steven Price --- drivers/gpu/drm/panthor/panthor_gpu.c | 72 ++++++++++++++++---------------= ---- 1 file changed, 33 insertions(+), 39 deletions(-) diff --git a/drivers/gpu/drm/panthor/panthor_gpu.c b/drivers/gpu/drm/pantho= r/panthor_gpu.c index 7088371c6d64..55e33f145b40 100644 --- a/drivers/gpu/drm/panthor/panthor_gpu.c +++ b/drivers/gpu/drm/panthor/panthor_gpu.c @@ -345,41 +345,36 @@ int panthor_gpu_flush_caches(struct panthor_device *p= tdev, u32 l2, u32 lsc, u32 other) { struct panthor_gpu *gpu =3D ptdev->gpu; - unsigned long flags; u64 start =3D 0; int ret =3D 0; =20 /* Serialize cache flush operations. */ guard(mutex)(&ptdev->gpu->cache_flush_lock); =20 - spin_lock_irqsave(&ptdev->gpu->reqs_lock, flags); - - if (tracepoint_enabled(gpu_cache_flush)) - start =3D ktime_get_ns(); - - if (!(ptdev->gpu->pending_reqs & GPU_IRQ_CLEAN_CACHES_COMPLETED)) { - ptdev->gpu->pending_reqs |=3D GPU_IRQ_CLEAN_CACHES_COMPLETED; - gpu_write(gpu->iomem, GPU_CMD, GPU_FLUSH_CACHES(l2, lsc, other)); - } else { - ret =3D -EIO; - } - spin_unlock_irqrestore(&ptdev->gpu->reqs_lock, flags); - - if (ret) { - panthor_gpu_emit_flush_caches_tp(ptdev, start, l2, lsc, other, ret); - return ret; + scoped_guard(spinlock, &ptdev->gpu->reqs_lock) { + if (tracepoint_enabled(gpu_cache_flush)) + start =3D ktime_get_ns(); + + if (!(ptdev->gpu->pending_reqs & GPU_IRQ_CLEAN_CACHES_COMPLETED)) { + ptdev->gpu->pending_reqs |=3D GPU_IRQ_CLEAN_CACHES_COMPLETED; + gpu_write(gpu->iomem, GPU_CMD, GPU_FLUSH_CACHES(l2, lsc, other)); + } else { + panthor_gpu_emit_flush_caches_tp(ptdev, start, l2, lsc, + other, -EIO); + return -EIO; + } } =20 if (!wait_event_timeout(ptdev->gpu->reqs_acked, !(ptdev->gpu->pending_reqs & GPU_IRQ_CLEAN_CACHES_COMPLETED), msecs_to_jiffies(100))) { - spin_lock_irqsave(&ptdev->gpu->reqs_lock, flags); - if ((ptdev->gpu->pending_reqs & GPU_IRQ_CLEAN_CACHES_COMPLETED) !=3D 0 && - !(gpu_read(gpu->irq.iomem, INT_RAWSTAT) & GPU_IRQ_CLEAN_CACHES_COMPL= ETED)) - ret =3D -ETIMEDOUT; - else - ptdev->gpu->pending_reqs &=3D ~GPU_IRQ_CLEAN_CACHES_COMPLETED; - spin_unlock_irqrestore(&ptdev->gpu->reqs_lock, flags); + scoped_guard(spinlock, &ptdev->gpu->reqs_lock) { + if ((ptdev->gpu->pending_reqs & GPU_IRQ_CLEAN_CACHES_COMPLETED) !=3D 0 = && + !(gpu_read(gpu->irq.iomem, INT_RAWSTAT) & GPU_IRQ_CLEAN_CACHES_COMPLETE= D)) + ret =3D -ETIMEDOUT; + else + ptdev->gpu->pending_reqs &=3D ~GPU_IRQ_CLEAN_CACHES_COMPLETED; + } } =20 panthor_gpu_emit_flush_caches_tp(ptdev, start, l2, lsc, other, ret); @@ -402,27 +397,26 @@ int panthor_gpu_soft_reset(struct panthor_device *ptd= ev) { struct panthor_gpu *gpu =3D ptdev->gpu; bool timedout =3D false; - unsigned long flags; =20 - spin_lock_irqsave(&ptdev->gpu->reqs_lock, flags); - if (!drm_WARN_ON(&ptdev->base, - ptdev->gpu->pending_reqs & GPU_IRQ_RESET_COMPLETED)) { - ptdev->gpu->pending_reqs |=3D GPU_IRQ_RESET_COMPLETED; - gpu_write(gpu->irq.iomem, INT_CLEAR, GPU_IRQ_RESET_COMPLETED); - gpu_write(gpu->iomem, GPU_CMD, GPU_SOFT_RESET); + scoped_guard(spinlock, &ptdev->gpu->reqs_lock) { + if (!drm_WARN_ON(&ptdev->base, + ptdev->gpu->pending_reqs & GPU_IRQ_RESET_COMPLETED)) { + ptdev->gpu->pending_reqs |=3D GPU_IRQ_RESET_COMPLETED; + gpu_write(gpu->irq.iomem, INT_CLEAR, GPU_IRQ_RESET_COMPLETED); + gpu_write(gpu->iomem, GPU_CMD, GPU_SOFT_RESET); + } } - spin_unlock_irqrestore(&ptdev->gpu->reqs_lock, flags); =20 if (!wait_event_timeout(ptdev->gpu->reqs_acked, !(ptdev->gpu->pending_reqs & GPU_IRQ_RESET_COMPLETED), msecs_to_jiffies(100))) { - spin_lock_irqsave(&ptdev->gpu->reqs_lock, flags); - if ((ptdev->gpu->pending_reqs & GPU_IRQ_RESET_COMPLETED) !=3D 0 && - !(gpu_read(gpu->irq.iomem, INT_RAWSTAT) & GPU_IRQ_RESET_COMPLETED)) - timedout =3D true; - else - ptdev->gpu->pending_reqs &=3D ~GPU_IRQ_RESET_COMPLETED; - spin_unlock_irqrestore(&ptdev->gpu->reqs_lock, flags); + scoped_guard(spinlock, &ptdev->gpu->reqs_lock) { + if ((ptdev->gpu->pending_reqs & GPU_IRQ_RESET_COMPLETED) !=3D 0 && + !(gpu_read(gpu->irq.iomem, INT_RAWSTAT) & GPU_IRQ_RESET_COMPLETED)) + timedout =3D true; + else + ptdev->gpu->pending_reqs &=3D ~GPU_IRQ_RESET_COMPLETED; + } } =20 if (timedout) { --=20 2.55.0 From nobody Tue Sep 29 04:39:33 2026 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (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 4228045D1A8 for ; Wed, 12 Aug 2026 14:08:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786543705; cv=pass; b=YExJmbY3qrIA/9cSccKVfZC4p0BXdoErZauLkDUqkDKwql4Q05cuvcLy4iYa4EbVwq3BcfG4cIisIuWb9tcj0TY+CA6xeySzIjI79gLKRdFlHtAMh+a3Ia7ddpiNhk3i9E1FkKOKwG9B0hPG8tqkGYMV1cNeNFkJNbCODI6pC+Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786543705; c=relaxed/simple; bh=L3MFXfKSkj6rU7DPU/e8dvH4Rh3jxJLto4mmUM9sOac=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FfZ2B8U8+LILRJ7sBenztmwbWeIPiU0SipBQ814lNi0cSUPb9utC9vQ5eOu06pxDTl69WaZQ4Xjupc3vmsj60L5ta18epkZqprQkd06/JDoPyyeDOuhc/V0SCYtObRIwDA6dN3U+JuhgCDTwRA+7Z9IgzdxUHctr4ncwjsfbJB8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b=G4AM3erP; arc=pass smtp.client-ip=136.143.188.112 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 (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b="G4AM3erP" ARC-Seal: i=1; a=rsa-sha256; t=1786543671; cv=none; d=zohomail.com; s=zohoarc; b=T/dWqFDuZGZm5sYp54t5Ak4f7QFB7Sw51d7BH7189IElWksZcWTUDuCRTpQYLDM8hQvjLx04q447ISMxsL/n+eN5G3nL/v2U76iCOzT0zJ1gHQuu9iwlLtp3sqXZRO01oS25oE1VK2xfXOFAn15bOS5eaGl0nfortwbeMsIk9AI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786543671; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=xCfOeZu/Y9broWEs5rnkuR+d/pmW7LGYmqy2RRCYI90=; b=mVOhzevx/qcXMIZwwILL+FeQS0ma4/dOqvwrxMfUs3X3mUUXEH3DN3ISt8ZDJfCL9r+/8hyvweaL8bZJfFi1jvtDWwiofzzAuvhXGNyznbcc0oQ8cjTbjKZEoALJKJfuUHzah9FUwyFC9sye1S+TfoXh/oUSgjR9xZ0dLotDExE= 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=1786543671; s=zohomail; d=collabora.com; i=nicolas.frattaroli@collabora.com; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=xCfOeZu/Y9broWEs5rnkuR+d/pmW7LGYmqy2RRCYI90=; b=G4AM3erPo8RXG7BtFllSDYhM1rmC71rWScMX/rjt7H8db7ty6FqkEee+HPOVsnci ANuQk7UsturSs3lCIdTWvOpDVnL6iDSIySGLwrTcqH6vDLhalhutqVskjWMT9aI+iWo KPdZyLRBMnbbBfpRwmzhCtjku2IVCUkoQuPN+26c= Received: by mx.zohomail.com with SMTPS id 1786543669037639.2757185019814; Wed, 12 Aug 2026 07:07:49 -0700 (PDT) From: Nicolas Frattaroli Date: Wed, 12 Aug 2026 16:07:20 +0200 Subject: [PATCH v4 3/3] drm/panthor: Take reqs_lock in soft_reset for clearing pending_reqs 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260812-panthor-cache-flush-fix-v4-3-751e32901898@collabora.com> References: <20260812-panthor-cache-flush-fix-v4-0-751e32901898@collabora.com> In-Reply-To: <20260812-panthor-cache-flush-fix-v4-0-751e32901898@collabora.com> To: Boris Brezillon , Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Grant Likely , Heiko Stuebner Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, kernel@collabora.com, Nicolas Frattaroli X-Mailer: b4 0.15.2 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") Reviewed-by: Boris Brezillon Signed-off-by: Nicolas Frattaroli Reviewed-by: Liviu Dudau Reviewed-by: Steven Price --- 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/pantho= r/panthor_gpu.c index 55e33f145b40..fb2702e1e0a2 100644 --- a/drivers/gpu/drm/panthor/panthor_gpu.c +++ b/drivers/gpu/drm/panthor/panthor_gpu.c @@ -424,7 +424,10 @@ int panthor_gpu_soft_reset(struct panthor_device *ptde= v) return -ETIMEDOUT; } =20 - ptdev->gpu->pending_reqs =3D 0; + scoped_guard(spinlock, &ptdev->gpu->reqs_lock) { + ptdev->gpu->pending_reqs =3D 0; + } + return 0; } =20 --=20 2.55.0