From: Frederic Weisbecker <frederic@kernel.org>
To: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
Cc: "Paul E . McKenney" <paulmck@kernel.org>,
RCU <rcu@vger.kernel.org>,
Neeraj upadhyay <Neeraj.Upadhyay@amd.com>,
Boqun Feng <boqun.feng@gmail.com>,
Hillf Danton <hdanton@sina.com>,
Joel Fernandes <joel@joelfernandes.org>,
LKML <linux-kernel@vger.kernel.org>,
Oleksiy Avramchenko <oleksiy.avramchenko@sony.com>
Subject: Re: [PATCH v4 2/4] rcu: Add a trace event for synchronize_rcu_normal()
Date: Sat, 13 Jan 2024 00:20:14 +0100 [thread overview]
Message-ID: <ZaHJLmsoY8OTvQB9@localhost.localdomain> (raw)
In-Reply-To: <20240104162510.72773-3-urezki@gmail.com>
Le Thu, Jan 04, 2024 at 05:25:08PM +0100, Uladzislau Rezki (Sony) a écrit :
> Add an rcu_sr_normal() trace event. It takes three arguments
> first one is the name of RCU flavour, second one is a user id
> which triggeres synchronize_rcu_normal() and last one is an
> event.
>
> There are two traces in the synchronize_rcu_normal(). On entry,
> when a new request is registered and on exit point when request
> is completed.
>
> Please note, CONFIG_RCU_TRACE=y is required to activate traces.
>
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> ---
> include/trace/events/rcu.h | 27 +++++++++++++++++++++++++++
> kernel/rcu/tree.c | 7 ++++++-
> 2 files changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
> index 2ef9c719772a..31b3e0d3e65f 100644
> --- a/include/trace/events/rcu.h
> +++ b/include/trace/events/rcu.h
> @@ -707,6 +707,33 @@ TRACE_EVENT_RCU(rcu_invoke_kfree_bulk_callback,
> __entry->rcuname, __entry->p, __entry->nr_records)
> );
>
> +/*
> + * Tracepoint for a normal synchronize_rcu() states. The first argument
> + * is the RCU flavor, the second argument is a pointer to rcu_head the
> + * last one is an event.
> + */
> +TRACE_EVENT_RCU(rcu_sr_normal,
Can we call this "synchronize_rcu" instead? So people really know what it's
about.
Then should the need arise, we can still add "synchronize_rcu_expedited" trace
events later.
Thanks.
> +
> + TP_PROTO(const char *rcuname, struct rcu_head *rhp, const char *srevent),
> +
> + TP_ARGS(rcuname, rhp, srevent),
> +
> + TP_STRUCT__entry(
> + __field(const char *, rcuname)
> + __field(void *, rhp)
> + __field(const char *, srevent)
> + ),
> +
> + TP_fast_assign(
> + __entry->rcuname = rcuname;
> + __entry->rhp = rhp;
> + __entry->srevent = srevent;
> + ),
> +
> + TP_printk("%s rhp=0x%p event=%s",
> + __entry->rcuname, __entry->rhp, __entry->srevent)
> +);
> +
> /*
> * Tracepoint for exiting rcu_do_batch after RCU callbacks have been
> * invoked. The first argument is the name of the RCU flavor,
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index b756c40e4960..7d2ed89efcb3 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -3672,9 +3672,11 @@ static void synchronize_rcu_normal(void)
> {
> struct rcu_synchronize rs;
>
> + trace_rcu_sr_normal(rcu_state.name, &rs.head, TPS("request"));
> +
> if (!READ_ONCE(rcu_normal_wake_from_gp)) {
> wait_rcu_gp(call_rcu_hurry);
> - return;
> + goto trace_complete_out;
> }
>
> init_rcu_head_on_stack(&rs.head);
> @@ -3695,6 +3697,9 @@ static void synchronize_rcu_normal(void)
> /* Now we can wait. */
> wait_for_completion(&rs.completion);
> destroy_rcu_head_on_stack(&rs.head);
> +
> +trace_complete_out:
> + trace_rcu_sr_normal(rcu_state.name, &rs.head, TPS("complete"));
> }
>
> /**
> --
> 2.39.2
>
next prev parent reply other threads:[~2024-01-12 23:20 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-04 16:25 [PATCH v4 0/4] Reduce synchronize_rcu() latency(v4) Uladzislau Rezki (Sony)
2024-01-04 16:25 ` [PATCH v4 1/4] rcu: Reduce synchronize_rcu() latency Uladzislau Rezki (Sony)
2024-01-09 19:16 ` Kalesh Singh
2024-01-10 9:21 ` Uladzislau Rezki
2024-01-11 16:37 ` Kalesh Singh
2024-01-11 17:35 ` Uladzislau Rezki
2024-01-12 23:09 ` Frederic Weisbecker
2024-01-18 10:37 ` Uladzislau Rezki
2024-01-16 16:18 ` Paul E. McKenney
2024-01-17 12:26 ` Uladzislau Rezki
2024-01-19 15:24 ` Paul E. McKenney
2024-01-22 17:35 ` Uladzislau Rezki
2024-01-23 11:21 ` Paul E. McKenney
2024-01-04 16:25 ` [PATCH v4 2/4] rcu: Add a trace event for synchronize_rcu_normal() Uladzislau Rezki (Sony)
2024-01-12 23:20 ` Frederic Weisbecker [this message]
2024-01-15 12:14 ` Uladzislau Rezki
2024-01-04 16:25 ` [PATCH v4 3/4] rcu: Improve handling of synchronize_rcu() users Uladzislau Rezki (Sony)
2024-01-16 16:32 ` Paul E. McKenney
2024-01-04 16:25 ` [PATCH v4 4/4] rcu: Support direct wake-up " Uladzislau Rezki (Sony)
2024-01-13 9:19 ` Z qiang
2024-01-15 10:46 ` Uladzislau Rezki
2024-01-15 10:57 ` Uladzislau Rezki
2024-01-16 6:19 ` Z qiang
2024-01-27 7:07 ` [PATCH v4 0/4] Reduce synchronize_rcu() latency(v4) Paul E. McKenney
2024-01-29 16:23 ` Uladzislau Rezki
2024-01-29 19:43 ` Paul E. McKenney
2024-01-29 20:36 ` Uladzislau Rezki
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=ZaHJLmsoY8OTvQB9@localhost.localdomain \
--to=frederic@kernel.org \
--cc=Neeraj.Upadhyay@amd.com \
--cc=boqun.feng@gmail.com \
--cc=hdanton@sina.com \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleksiy.avramchenko@sony.com \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=urezki@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).