From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F2AD392C25 for ; Fri, 31 Jul 2026 08:03:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785485039; cv=none; b=fcbZl66r4bri970yIHPF4EGPrcv7MahNtVB4DJ8ZULyP9y+RO03MpeUotdSXqRF31VdufxjMvijkaGtglDB5R0fikK5oS56iH+TDjH0o+2FA0yOqWLP6pPlhIX4iqOL5OPpAqVQxdKMx+BnZ8Xk9Twu5PrC287vZvkONSylnDJQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785485039; c=relaxed/simple; bh=9LdX6Nm67lXUyl4q3SLgatLosZbxqQtQKhJxaZEsWLk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=RS1ZyvmBcvLWIsiacBItdZr+xjGHinqvPfo8pc4u4iEWxP/cH38+fjYTG228KnFeqEIlR+OrsYo+kO/QI8QP7ClVXaprS07a73+tVEML01ODNGVBCJlVeGYFLxtDntjnLYKOuSgpE2De8EEmCD5t6c8VpTOl43M4u29V9biwsfg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=ag/GvXDV; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="ag/GvXDV" 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 58E3C22C7; Fri, 31 Jul 2026 01:03:53 -0700 (PDT) Received: from [10.57.87.104] (unknown [10.57.87.104]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9FA443F86F; Fri, 31 Jul 2026 01:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1785485037; bh=9LdX6Nm67lXUyl4q3SLgatLosZbxqQtQKhJxaZEsWLk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ag/GvXDVyHye6G78FxGeZSttVsUGbfJdVkLB7m+aemJ5gXei9MSJ61Nt8DVtrCKFD 4vCo24/2nE30/+nGDiyA56OKTcwg9ArSgHC9hjOHKu18/DohIGYO0vb7A07BFrs5r2 XQ5Th65wWKrISij0RmW5t60Qzp53gUO4+xaFIKmI= Message-ID: Date: Fri, 31 Jul 2026 09:03:50 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 3/3] drm/panthor: Add tracepoints for cache flushing To: Nicolas Frattaroli , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak , Boris Brezillon , 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 References: <20260730-panthor-cache-flush-fix-v2-0-28790478bfff@collabora.com> <20260730-panthor-cache-flush-fix-v2-3-28790478bfff@collabora.com> From: Steven Price Content-Language: en-GB In-Reply-To: <20260730-panthor-cache-flush-fix-v2-3-28790478bfff@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 30/07/2026 12:45, Nicolas Frattaroli wrote: > Add two new event tracepoints: gpu_cache_flush_start to be emitted after > acquiring the flush mutex and reqs spinlock, and gpu_cache_flush_end to > be emitted when leaving the function. > > This allows debugging the duration a flush takes irrespective of initial > function entry lock contention by subtracting the start tracepoint's > timestamp from the end tracepoint timestamp, and additionally contains > information such as which caches were flushed. > > Signed-off-by: Nicolas Frattaroli Reviewed-by: Steven Price Thanks, Steve > --- > drivers/gpu/drm/panthor/panthor_gpu.c | 3 ++ > drivers/gpu/drm/panthor/panthor_trace.h | 49 +++++++++++++++++++++++++++++++++ > 2 files changed, 52 insertions(+) > > diff --git a/drivers/gpu/drm/panthor/panthor_gpu.c b/drivers/gpu/drm/panthor/panthor_gpu.c > index f015bde80abf..a25955ad668b 100644 > --- a/drivers/gpu/drm/panthor/panthor_gpu.c > +++ b/drivers/gpu/drm/panthor/panthor_gpu.c > @@ -336,6 +336,7 @@ int panthor_gpu_flush_caches(struct panthor_device *ptdev, > guard(mutex)(&ptdev->gpu->cache_flush_lock); > > spin_lock(&ptdev->gpu->reqs_lock); > + trace_gpu_cache_flush_start(ptdev->base.dev, l2, lsc, other); > if (!(ptdev->gpu->pending_reqs & GPU_IRQ_CLEAN_CACHES_COMPLETED)) { > ptdev->gpu->pending_reqs |= GPU_IRQ_CLEAN_CACHES_COMPLETED; > gpu_write(gpu->iomem, GPU_CMD, GPU_FLUSH_CACHES(l2, lsc, other)); > @@ -345,6 +346,7 @@ int panthor_gpu_flush_caches(struct panthor_device *ptdev, > > if (ret) { > spin_unlock(&ptdev->gpu->reqs_lock); > + trace_gpu_cache_flush_end(ptdev->base.dev, l2, lsc, other); > return ret; > } > > @@ -358,6 +360,7 @@ int panthor_gpu_flush_caches(struct panthor_device *ptdev, > ptdev->gpu->pending_reqs &= ~GPU_IRQ_CLEAN_CACHES_COMPLETED; > } > spin_unlock(&ptdev->gpu->reqs_lock); > + trace_gpu_cache_flush_end(ptdev->base.dev, l2, lsc, other); > > if (ret) { > panthor_device_schedule_reset(ptdev); > diff --git a/drivers/gpu/drm/panthor/panthor_trace.h b/drivers/gpu/drm/panthor/panthor_trace.h > index 6ffeb4fe6599..6951b95b1de7 100644 > --- a/drivers/gpu/drm/panthor/panthor_trace.h > +++ b/drivers/gpu/drm/panthor/panthor_trace.h > @@ -76,6 +76,55 @@ TRACE_EVENT(gpu_job_irq, > __entry->events, __entry->duration_ns) > ); > > +DECLARE_EVENT_CLASS(gpu_cache_flush_template, > + TP_PROTO(const struct device *dev, u32 l2, u32 lsc, u32 other), > + TP_ARGS(dev, l2, lsc, other), > + TP_STRUCT__entry( > + __string(dev_name, dev_name(dev)) > + __field(u32, l2) > + __field(u32, lsc) > + __field(u32, other) > + ), > + TP_fast_assign( > + __assign_str(dev_name); > + __entry->l2 = l2; > + __entry->lsc = lsc; > + __entry->other = other; > + ), > + TP_printk("%s: l2=0x%x lsc=0x%x other=0x%x", __get_str(dev_name), > + __entry->l2, __entry->lsc, __entry->other) > +); > + > +/** > + * gpu_cache_flush_start - called after cache flush locks taken, before flush > + * @dev: pointer to the &struct device, for printing the device name > + * @l2: "l2" flush flags > + * @lsc: "lsc" flush flags > + * @other: "other" flush flags > + * > + * Fires after any initial lock contention around the locks needed for flushing > + * caches, but before the actual cache flush is requested. > + */ > +DEFINE_EVENT(gpu_cache_flush_template, gpu_cache_flush_start, > + TP_PROTO(const struct device *dev, u32 l2, u32 lsc, u32 other), > + TP_ARGS(dev, l2, lsc, other) > +); > + > +/** > + * gpu_cache_flush_end - called after cache flush > + * @dev: pointer to the &struct device, for printing the device name > + * @l2: "l2" flush flags > + * @lsc: "lsc" flush flags > + * @other: "other" flush flags > + * > + * Fires after either the cache flush is complete, or has failed. Can be used > + * together with gpu_cache_flush_start to get how long the flush has taken. > + */ > +DEFINE_EVENT(gpu_cache_flush_template, gpu_cache_flush_end, > + TP_PROTO(const struct device *dev, u32 l2, u32 lsc, u32 other), > + TP_ARGS(dev, l2, lsc, other) > +); > + > #endif /* __PANTHOR_TRACE_H__ */ > > #undef TRACE_INCLUDE_PATH >