From nobody Sat Feb 7 08:55:10 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 66EAD2253FC for ; Fri, 16 Jan 2026 12:58: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=1768568300; cv=pass; b=Nl0/YTEgxtyIGM4i366SIIJ9HWHcrM9gcmdg33ypvUGdrK3Mrukka4XUzhQJXLkqcs59woHtHOofkGAwxCGGhUHV0icdDbfmcnrRkOFOC5Ler4cwyPlVDR+xBH8IHWoj3q2BEec0ydliKN6WXzxUEXwFvsLXimHvE1RP78rDoW0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768568300; c=relaxed/simple; bh=q4qkNnUFazDF0XHRbjs1ZgqEP6DWavtfHdBjDlJ+5ec=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RFAJHvYzv9fsArWB4mKm56fZU+En0w/upuSAJmLyNO8ZST5oeqeH7Leq2CgmhgQczTx9N9m6Vozgr8koRlzZ760xr0m+yqZoaniQbOK838GcryZ1IfbvxKKf78cSXNXkL6YWeteh9bznkt3FFzmc7PlIXNXWOKF3g5K6sUPlvTU= 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=dSToYjId; 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="dSToYjId" ARC-Seal: i=1; a=rsa-sha256; t=1768568284; cv=none; d=zohomail.com; s=zohoarc; b=l+/jugo6DIhIBnLDwyaWNlpTPCgyiVhryI5qp5umTkRO4SPnq8mnL+vLE+GsWb1qo3Mpl+MkiNAGoM2bAeI2nx4MctO2IhBrhLUC7X+vRWxCKtd6Yq854m5w9DGLLnIYuhEV0qHuHoI8h7739p3TTjhwAbzCN2k1ozGqX+PZRTU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768568284; 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=19nv2PZgHaBu1531IdjRSZZ3SQBGh0yLoB263HOVEbI=; b=jroRXfpUDS9SjGfObS3WM2zKGG0m5A/UTL1NQweErKp8nnpSt4OeomcnYLuYdpIKOpCJxdfLb9U1lwN+eXD44sD3KBctDm5MJLREuf1oORC3kcRYqvdoJKsraExWmJDph9KEkWmVNYdIK0szwRdApdli8cgLY1jC6og+G3pxa58= 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=1768568284; 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:References:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=19nv2PZgHaBu1531IdjRSZZ3SQBGh0yLoB263HOVEbI=; b=dSToYjIdd0cYX31FkJqy5gm9U9NZZpXT9GzXXO4+M2l0inQVT9dpr2np9SSV0I7S HJpiFbhm/wVj4SUL6NbUeCGoCQHPRxk5k2Ytd/xaPLnpaoDaZu7T3GZP7CXzsxOB84C NeWKOthz8/EH+Ues7H85spPfyra2l4ZVmGY/XxU4= Received: by mx.zohomail.com with SMTPS id 1768568283857153.72395643692175; Fri, 16 Jan 2026 04:58:03 -0800 (PST) From: Nicolas Frattaroli Date: Fri, 16 Jan 2026 13:57:33 +0100 Subject: [PATCH v10 4/4] drm/panthor: Add gpu_job_irq tracepoint 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: <20260116-panthor-tracepoints-v10-4-d925986e3d1b@collabora.com> References: <20260116-panthor-tracepoints-v10-0-d925986e3d1b@collabora.com> In-Reply-To: <20260116-panthor-tracepoints-v10-0-d925986e3d1b@collabora.com> To: Boris Brezillon , Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chia-I Wu , Karunika Choo Cc: kernel@collabora.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Nicolas Frattaroli X-Mailer: b4 0.14.3 Mali's CSF firmware triggers the job IRQ whenever there's new firmware events for processing. While this can be a global event (BIT(31) of the status register), it's usually an event relating to a command stream group (the other bit indices). Panthor throws these events onto a workqueue for processing outside the IRQ handler. It's therefore useful to have an instrumented tracepoint that goes beyond the generic IRQ tracepoint for this specific case, as it can be augmented with additional data, namely the events bit mask. This can then be used to debug problems relating to GPU jobs events not being processed quickly enough. The duration_ns field can be used to work backwards from when the tracepoint fires (at the end of the IRQ handler) to figure out when the interrupt itself landed, providing not just information on how long the work queueing took, but also when the actual interrupt itself arrived. With this information in hand, the IRQ handler itself being slow can be excluded as a possible source of problems, and attention can be directed to the workqueue processing instead. Signed-off-by: Nicolas Frattaroli Reviewed-by: Boris Brezillon Reviewed-by: Steven Price --- drivers/gpu/drm/panthor/panthor_fw.c | 13 +++++++++++++ drivers/gpu/drm/panthor/panthor_trace.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor= /panthor_fw.c index 0e46625f7621..5a904ca64525 100644 --- a/drivers/gpu/drm/panthor/panthor_fw.c +++ b/drivers/gpu/drm/panthor/panthor_fw.c @@ -26,6 +26,7 @@ #include "panthor_mmu.h" #include "panthor_regs.h" #include "panthor_sched.h" +#include "panthor_trace.h" =20 #define CSF_FW_NAME "mali_csffw.bin" =20 @@ -1060,6 +1061,12 @@ static void panthor_fw_init_global_iface(struct pant= hor_device *ptdev) =20 static void panthor_job_irq_handler(struct panthor_device *ptdev, u32 stat= us) { + u32 duration; + u64 start =3D 0; + + if (tracepoint_enabled(gpu_job_irq)) + start =3D ktime_get_ns(); + gpu_write(ptdev, JOB_INT_CLEAR, status); =20 if (!ptdev->fw->booted && (status & JOB_INT_GLOBAL_IF)) @@ -1072,6 +1079,12 @@ static void panthor_job_irq_handler(struct panthor_d= evice *ptdev, u32 status) return; =20 panthor_sched_report_fw_events(ptdev, status); + + if (tracepoint_enabled(gpu_job_irq) && start) { + if (check_sub_overflow(ktime_get_ns(), start, &duration)) + duration =3D U32_MAX; + trace_gpu_job_irq(ptdev->base.dev, status, duration); + } } PANTHOR_IRQ_HANDLER(job, JOB, panthor_job_irq_handler); =20 diff --git a/drivers/gpu/drm/panthor/panthor_trace.h b/drivers/gpu/drm/pant= hor/panthor_trace.h index 5bd420894745..6ffeb4fe6599 100644 --- a/drivers/gpu/drm/panthor/panthor_trace.h +++ b/drivers/gpu/drm/panthor/panthor_trace.h @@ -48,6 +48,34 @@ TRACE_EVENT_FN(gpu_power_status, panthor_hw_power_status_register, panthor_hw_power_status_unregister ); =20 +/** + * gpu_job_irq - called after a job interrupt from firmware completes + * @dev: pointer to the &struct device, for printing the device name + * @events: bitmask of BIT(CSG id) | BIT(31) for a global event + * @duration_ns: Nanoseconds between job IRQ handler entry and exit + * + * The panthor_job_irq_handler() function instrumented by this tracepoint = exits + * once it has queued the firmware interrupts for processing, not when the + * firmware interrupts are fully processed. This tracepoint allows for deb= ugging + * issues with delays in the workqueue's processing of events. + */ +TRACE_EVENT(gpu_job_irq, + TP_PROTO(const struct device *dev, u32 events, u32 duration_ns), + TP_ARGS(dev, events, duration_ns), + TP_STRUCT__entry( + __string(dev_name, dev_name(dev)) + __field(u32, events) + __field(u32, duration_ns) + ), + TP_fast_assign( + __assign_str(dev_name); + __entry->events =3D events; + __entry->duration_ns =3D duration_ns; + ), + TP_printk("%s: events=3D0x%x duration_ns=3D%d", __get_str(dev_name), + __entry->events, __entry->duration_ns) +); + #endif /* __PANTHOR_TRACE_H__ */ =20 #undef TRACE_INCLUDE_PATH --=20 2.52.0