Skip to content

Commit 2053937

Browse files
committed
rcu: Add a trace event for synchronize_rcu_normal()
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. Reviewed-by: Paul E. McKenney <[email protected]> Signed-off-by: Uladzislau Rezki (Sony) <[email protected]>
1 parent 988f569 commit 2053937

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

include/trace/events/rcu.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,33 @@ TRACE_EVENT_RCU(rcu_invoke_kfree_bulk_callback,
707707
__entry->rcuname, __entry->p, __entry->nr_records)
708708
);
709709

710+
/*
711+
* Tracepoint for a normal synchronize_rcu() states. The first argument
712+
* is the RCU flavor, the second argument is a pointer to rcu_head the
713+
* last one is an event.
714+
*/
715+
TRACE_EVENT_RCU(rcu_sr_normal,
716+
717+
TP_PROTO(const char *rcuname, struct rcu_head *rhp, const char *srevent),
718+
719+
TP_ARGS(rcuname, rhp, srevent),
720+
721+
TP_STRUCT__entry(
722+
__field(const char *, rcuname)
723+
__field(void *, rhp)
724+
__field(const char *, srevent)
725+
),
726+
727+
TP_fast_assign(
728+
__entry->rcuname = rcuname;
729+
__entry->rhp = rhp;
730+
__entry->srevent = srevent;
731+
),
732+
733+
TP_printk("%s rhp=0x%p event=%s",
734+
__entry->rcuname, __entry->rhp, __entry->srevent)
735+
);
736+
710737
/*
711738
* Tracepoint for exiting rcu_do_batch after RCU callbacks have been
712739
* invoked. The first argument is the name of the RCU flavor,

kernel/rcu/tree.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3863,9 +3863,11 @@ static void synchronize_rcu_normal(void)
38633863
{
38643864
struct rcu_synchronize rs;
38653865

3866+
trace_rcu_sr_normal(rcu_state.name, &rs.head, TPS("request"));
3867+
38663868
if (!READ_ONCE(rcu_normal_wake_from_gp)) {
38673869
wait_rcu_gp(call_rcu_hurry);
3868-
return;
3870+
goto trace_complete_out;
38693871
}
38703872

38713873
init_rcu_head_on_stack(&rs.head);
@@ -3886,6 +3888,9 @@ static void synchronize_rcu_normal(void)
38863888
/* Now we can wait. */
38873889
wait_for_completion(&rs.completion);
38883890
destroy_rcu_head_on_stack(&rs.head);
3891+
3892+
trace_complete_out:
3893+
trace_rcu_sr_normal(rcu_state.name, &rs.head, TPS("complete"));
38893894
}
38903895

38913896
/**

0 commit comments

Comments
 (0)