All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Righi <arighi@nvidia.com>
To: Changwoo Min <changwoo@igalia.com>
Cc: tj@kernel.org, void@manifault.com, kernel-dev@igalia.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched_ext: Add trace point to track sched_ext core events
Date: Thu, 27 Feb 2025 08:38:12 +0100	[thread overview]
Message-ID: <Z8AWZBtrGN8h76AK@gpd3> (raw)
In-Reply-To: <20250226143327.231685-1-changwoo@igalia.com>

Hi Changwoo,

On Wed, Feb 26, 2025 at 11:33:27PM +0900, Changwoo Min wrote:
> Add tracing support, which may be useful for debugging sched_ext schedulers
> that trigger a certain event.
> 
> Signed-off-by: Changwoo Min <changwoo@igalia.com>
> ---
>  include/trace/events/sched_ext.h | 21 +++++++++++++++++++++
>  kernel/sched/ext.c               |  4 ++++
>  2 files changed, 25 insertions(+)
> 
> diff --git a/include/trace/events/sched_ext.h b/include/trace/events/sched_ext.h
> index fe19da7315a9..88527b9316de 100644
> --- a/include/trace/events/sched_ext.h
> +++ b/include/trace/events/sched_ext.h
> @@ -26,6 +26,27 @@ TRACE_EVENT(sched_ext_dump,
>  	)
>  );
>  
> +TRACE_EVENT(sched_ext_add_event,
> +	    TP_PROTO(const char *name, int offset, __u64 added),
> +	    TP_ARGS(name, offset, added),
> +
> +	TP_STRUCT__entry(
> +		__string(name, name)
> +		__field(	int,		offset		)
> +		__field(	__u64,		added		)
> +	),
> +
> +	TP_fast_assign(
> +		__assign_str(name);
> +		__entry->offset		= offset;
> +		__entry->added		= added;
> +	),
> +
> +	TP_printk("name %s offset %d added %llu",
> +		  __get_str(name), __entry->offset, __entry->added
> +	)
> +);

Isn't the name enough to determine which event has been triggered? What are
the benefits of reporting also the offset within struct scx_event_stats?

Thanks,
-Andrea

> +
>  #endif /* _TRACE_SCHED_EXT_H */
>  
>  /* This part must be outside protection */
> diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> index 986b655911df..825e79863057 100644
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
> @@ -1554,6 +1554,8 @@ static DEFINE_PER_CPU(struct scx_event_stats, event_stats_cpu);
>   */
>  #define scx_add_event(name, cnt) do {						\
>  	this_cpu_add(event_stats_cpu.name, cnt);				\
> +	trace_sched_ext_add_event(#name,					\
> +				  offsetof(struct scx_event_stats, name), cnt);	\
>  } while(0)
>  
>  /**
> @@ -1565,6 +1567,8 @@ static DEFINE_PER_CPU(struct scx_event_stats, event_stats_cpu);
>   */
>  #define __scx_add_event(name, cnt) do {						\
>  	__this_cpu_add(event_stats_cpu.name, cnt);				\
> +	trace_sched_ext_add_event(#name,					\
> +				  offsetof(struct scx_event_stats, name), cnt);	\
>  } while(0)
>  
>  /**
> -- 
> 2.48.1
> 

  parent reply	other threads:[~2025-02-27  7:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 14:33 [PATCH] sched_ext: Add trace point to track sched_ext core events Changwoo Min
2025-02-26 18:51 ` Tejun Heo
2025-02-27  7:41   ` Changwoo Min
2025-02-26 19:15 ` Mukesh Kumar Chaurasiya
2025-02-27  7:38 ` Andrea Righi [this message]
2025-02-27  8:05   ` Changwoo Min
2025-02-27  8:19     ` Andrea Righi
2025-02-27 10:23       ` Changwoo Min
2025-02-27 10:55         ` Andrea Righi
2025-02-27 14:21           ` Changwoo Min

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=Z8AWZBtrGN8h76AK@gpd3 \
    --to=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=kernel-dev@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=void@manifault.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.