All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Aakash Deep Sarkar <aakash.deep.sarkar@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <jeevaka.badrappan@intel.com>,
	<carlos.santa@intel.com>, <matthew.brost@intel.com>
Subject: Re: [PATCH v2 3/8] [ANDROID]: Add a trace point for GPU work period
Date: Fri, 22 Aug 2025 15:57:05 -0400	[thread overview]
Message-ID: <aKjLkUPXJnNJOmJ-@intel.com> (raw)
In-Reply-To: <20250822085932.2221054-4-aakash.deep.sarkar@intel.com>

On Fri, Aug 22, 2025 at 08:59:25AM +0000, Aakash Deep Sarkar wrote:
> The GPU work period event is required to have the following format:
> 
> Defines the structure of the kernel tracepoint:
> /sys/kernel/tracing/events/power/gpu_work_period

It is okay to add traces in the driver, but in a xe_ namespace.
For using such a bold name like this we need to add this infrastructure
in the drm level.

Please move this to drm level and include dri-devel in the proposal.

> 
> A value that uniquely identifies the GPU within the system.
>   uint32_t gpu_id;
> 
> The UID of the application (i.e. persistent, unique ID of the Android
> app) that submitted work to the GPU.
>   uint32_t uid;
> 
> The start time of the period in nanoseconds. The clock must be
> CLOCK_MONOTONIC_RAW, as returned by the ktime_get_raw_ns(void) function.
>   uint64_t start_time_ns;
> 
> The end time of the period in nanoseconds. The clock must be
> CLOCK_MONOTONIC_RAW, as returned by the ktime_get_raw_ns(void) function.
>   uint64_t end_time_ns;
> 
> The amount of time the GPU was running GPU work for |uid| during the
> period, in nanoseconds, without double-counting parallel GPU work for the
> same |uid|. For example, this might include the amount of time the GPU
> spent performing shader work (vertex work, fragment work, etc.) for
> |uid|.
>   uint64_t total_active_duration_ns;
> 
> Signed-off-by: Aakash Deep Sarkar <aakash.deep.sarkar@intel.com>
> ---
>  .../drm/xe/xe_power_gpu_work_period_trace.h   | 61 +++++++++++++++++++
>  1 file changed, 61 insertions(+)
>  create mode 100644 drivers/gpu/drm/xe/xe_power_gpu_work_period_trace.h
> 
> diff --git a/drivers/gpu/drm/xe/xe_power_gpu_work_period_trace.h b/drivers/gpu/drm/xe/xe_power_gpu_work_period_trace.h
> new file mode 100644
> index 000000000000..2de05f1b64f3
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_power_gpu_work_period_trace.h
> @@ -0,0 +1,61 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2024 Intel Corporation
> + */
> +
> +#ifndef _TRACE_POWER_GPU_WORK_PERIOD_INTEL
> +#define _TRACE_POWER_GPU_WORK_PERIOD_INTEL
> +#endif
> +
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM power
> +#undef TRACE_INCLUDE_FILE
> +#define TRACE_INCLUDE_FILE xe_power_gpu_work_period_trace
> +#undef TRACE_INCLUDE_PATH
> +#define TRACE_INCLUDE_PATH .
> +
> +#if !defined(_TRACE_POWER_GPU_WORK_PERIOD_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_POWER_GPU_WORK_PERIOD_H
> +
> +#include <linux/tracepoint.h>
> +
> +TRACE_EVENT(gpu_work_period,
> +
> +	TP_PROTO(
> +		u32 gpu_id,
> +		u32 uid,
> +		u64 start_time_ns,
> +		u64 end_time_ns,
> +		u64 total_active_duration_ns
> +	),
> +
> +	TP_ARGS(gpu_id, uid, start_time_ns, end_time_ns, total_active_duration_ns),
> +
> +	TP_STRUCT__entry(
> +		__field(u32, gpu_id)
> +		__field(u32, uid)
> +		__field(u64, start_time_ns)
> +		__field(u64, end_time_ns)
> +		__field(u64, total_active_duration_ns)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->gpu_id = gpu_id;
> +		__entry->uid = uid;
> +		__entry->start_time_ns = start_time_ns;
> +		__entry->end_time_ns = end_time_ns;
> +		__entry->total_active_duration_ns = total_active_duration_ns;
> +	),
> +
> +	TP_printk("gpu_id=%u uid=%u start_time_ns=%llu end_time_ns=%llu total_active_duration_ns=%llu",
> +		__entry->gpu_id,
> +		__entry->uid,
> +		__entry->start_time_ns,
> +		__entry->end_time_ns,
> +		__entry->total_active_duration_ns)
> +);
> +
> +#endif /* _TRACE_POWER_GPU_WORK_PERIOD_H */
> +
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>
> -- 
> 2.49.0
> 

  reply	other threads:[~2025-08-22 19:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-22  8:59 [PATCH v2 0/8] [ANDROID]: Add GPU work period support for Xe driver Aakash Deep Sarkar
2025-08-22  8:59 ` [PATCH v2 1/8] [ANDROID]: Add a new xe_user structure Aakash Deep Sarkar
2025-08-22 15:48   ` Rodrigo Vivi
2025-08-22 17:01     ` Matthew Brost
2025-08-22 20:09       ` Rodrigo Vivi
2025-08-23  1:57         ` Dixit, Ashutosh
2025-08-22  8:59 ` [PATCH v2 2/8] [ANDROID]: Add xe_gt_clock_interval_to_ns function Aakash Deep Sarkar
2025-08-22  8:59 ` [PATCH v2 3/8] [ANDROID]: Add a trace point for GPU work period Aakash Deep Sarkar
2025-08-22 19:57   ` Rodrigo Vivi [this message]
2025-08-22  8:59 ` [PATCH v2 4/8] [ANDROID]: Modify xe_exec_queue_update_run_ticks Aakash Deep Sarkar
2025-08-22  8:59 ` [PATCH v2 5/8] [ANDROID]: Handle xe_user creation and removal Aakash Deep Sarkar
2025-08-22  8:59 ` [PATCH v2 6/8] [ANDROID]: Implement xe_work_period_worker Aakash Deep Sarkar
2025-08-22 11:00   ` Matthew Auld
2025-08-22 16:58     ` Matthew Brost
2025-08-22  8:59 ` [PATCH v2 7/8] [ANDROID]: Add a Kconfig option for GPU work period Aakash Deep Sarkar
2025-08-22  8:59 ` [PATCH v2 8/8] [ANDROID]: Handle xe_work_period destruction Aakash Deep Sarkar
2025-08-22  9:39 ` ✗ CI.checkpatch: warning for : Add GPU work period support for Xe driver Patchwork
2025-08-22  9:40 ` ✓ CI.KUnit: success " Patchwork
2025-08-22 10:44 ` ✓ Xe.CI.BAT: " Patchwork
2025-08-23  3:50 ` ✗ Xe.CI.Full: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aKjLkUPXJnNJOmJ-@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=aakash.deep.sarkar@intel.com \
    --cc=carlos.santa@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jeevaka.badrappan@intel.com \
    --cc=matthew.brost@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.