From nobody Fri Dec 19 04:03:49 2025 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 1F19839301B for ; Wed, 17 Dec 2025 14:30:22 +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=1765981825; cv=pass; b=HFXX6t2fDbjYr1+w15nzXhKN9Gyf1r7OI2GXqTsDYzJgxRQlvAtWqZDekf4xf/UJZrdnq3RMA2+goeYhrzsZU5wjsUjrG8C2gIF5hjevxQm0tV+RAFM+QaWmFAXvImjIhwUatEtnFdWuM6LPpPR84BkXzbaCaZ/EbP4kjkmR10Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765981825; c=relaxed/simple; bh=AYjyM3dIBGHKRG6cxc8HSQ2XMYuKPKbEu5ANHmBuV2c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XGqVJ5pec4vhahN9sUlc7Cv4QpSSIiL2nQJiEWwC0gwnP1G/p/dI3pOHHX/no1zg6vVozROyoNvBF2LCBf+3/OMnOAcf5u/pD/H5vHGa18sSURVxg+HCUXNSKcQ3tNqy+jz6ehLUNopjGF4DcWOc3bXsOqiLrqjktjb//pjQQ9g= 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=ausi6xOG; 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="ausi6xOG" ARC-Seal: i=1; a=rsa-sha256; t=1765981806; cv=none; d=zohomail.com; s=zohoarc; b=SvIojbs6st5znMXViTnei+JH6K3tYfroXR0/3/ZBE+ahbs4W+UFCMRCum+HDONZ3spw39xZvu51NIfvwDEhPXW6fAUvtuNkqIiNgts+ibYMGna5iBIZkQrcW1FDYgTV0L/2z4iiRmdGjCmSAA0UKMihZkn5502nsSHkkg0MeAbw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765981806; 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=loq07D1mkSWL4qXJm2L3GeV4pBmAabcjQO2c0yX94eI=; b=VIajU1P9MukFdENyig3nxHbllr+0ihqXecQT/el57lneufP3ropJINBOmoxN0ZFH0sCXMKBfjECpQkcNgHE/o0hibmPA4UoNk0m6YMz5buJN7cmAOW6oAZpqtvn5+PQS23f3hl+OdJHrlM4I/gGNK/60onpnuJFas22ciGXzpuc= 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=1765981806; 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=loq07D1mkSWL4qXJm2L3GeV4pBmAabcjQO2c0yX94eI=; b=ausi6xOGWp40+/PnLlpD7Ib2yRJ9uKjgnvmUvKaF1h7dMGUjENNTBEgS7XjByrMH b0sR6XC7ED0HrVRODr+erFuwV+7UkKWmk931kGkyWstrseyssASZ/cBZR1YT8o8zY/j nGSih7Z1AAmFbXYlP+K78G+o/rRuh2kzPVCAdzoA= Received: by mx.zohomail.com with SMTPS id 1765981805279190.28543644885497; Wed, 17 Dec 2025 06:30:05 -0800 (PST) From: Nicolas Frattaroli Date: Wed, 17 Dec 2025 15:29:40 +0100 Subject: [PATCH v4 3/3] 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: <20251217-panthor-tracepoints-v4-3-916186cb8d03@collabora.com> References: <20251217-panthor-tracepoints-v4-0-916186cb8d03@collabora.com> In-Reply-To: <20251217-panthor-tracepoints-v4-0-916186cb8d03@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 --- 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 a64ec8756bed..513ed42f7b41 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; + + 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)) { + 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