All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.ibm.com>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: rostedt@goodmis.org, mingo@redhat.com, peterz@infradead.org,
	josh@joshtriplett.org, mathieu.desnoyers@efficios.com,
	jiangshanlai@gmail.com, joel@joelfernandes.org,
	shaoyafang@didiglobal.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] rcu: validate arguments for rcu tracepoints
Date: Tue, 26 Mar 2019 07:32:00 -0700	[thread overview]
Message-ID: <20190326143200.GH4102@linux.ibm.com> (raw)
In-Reply-To: <1553564407-1162-4-git-send-email-laoar.shao@gmail.com>

On Tue, Mar 26, 2019 at 09:40:07AM +0800, Yafang Shao wrote:
> When CONFIG_RCU_TRACE is not set, all these tracepoints are define as
> do-nothing macro.
> We'd better make those inline functions that take proper arguments.
> 
> As RCU_TRACE() is defined as do-nothing marco as well when
> CONFIG_RCU_TRACE is not set, so we can clean it up.
> 
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>

With the naming changes suggested by Steven:

Acked-by: Paul E. McKenney <paulmck@linux.ibm.com>

This area of the code should be relatively free from conflicts, so please
feel free to take it with the tracing updates.

> ---
>  include/trace/events/rcu.h | 84 +++++++++++++++++++++++++++++-----------------
>  kernel/rcu/rcu.h           |  9 ++---
>  kernel/rcu/tree.c          |  8 ++---
>  3 files changed, 60 insertions(+), 41 deletions(-)
> 
> diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
> index f0c4d10..357e1b6 100644
> --- a/include/trace/events/rcu.h
> +++ b/include/trace/events/rcu.h
> @@ -750,36 +750,60 @@
> 
>  #else /* #ifdef CONFIG_RCU_TRACE */
> 
> -#define trace_rcu_grace_period(rcuname, gp_seq, gpevent) do { } while (0)
> -#define trace_rcu_future_grace_period(rcuname, gp_seq, gp_seq_req, \
> -				      level, grplo, grphi, event) \
> -				      do { } while (0)
> -#define trace_rcu_grace_period_init(rcuname, gp_seq, level, grplo, grphi, \
> -				    qsmask) do { } while (0)
> -#define trace_rcu_exp_grace_period(rcuname, gqseq, gpevent) \
> -	do { } while (0)
> -#define trace_rcu_exp_funnel_lock(rcuname, level, grplo, grphi, gpevent) \
> -	do { } while (0)
> -#define trace_rcu_nocb_wake(rcuname, cpu, reason) do { } while (0)
> -#define trace_rcu_preempt_task(rcuname, pid, gp_seq) do { } while (0)
> -#define trace_rcu_unlock_preempted_task(rcuname, gp_seq, pid) do { } while (0)
> -#define trace_rcu_quiescent_state_report(rcuname, gp_seq, mask, qsmask, level, \
> -					 grplo, grphi, gp_tasks) do { } \
> -	while (0)
> -#define trace_rcu_fqs(rcuname, gp_seq, cpu, qsevent) do { } while (0)
> -#define trace_rcu_dyntick(polarity, oldnesting, newnesting, dyntick) do { } while (0)
> -#define trace_rcu_callback(rcuname, rhp, qlen_lazy, qlen) do { } while (0)
> -#define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen_lazy, qlen) \
> -	do { } while (0)
> -#define trace_rcu_batch_start(rcuname, qlen_lazy, qlen, blimit) \
> -	do { } while (0)
> -#define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0)
> -#define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0)
> -#define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \
> -	do { } while (0)
> -#define trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
> -	do { } while (0)
> -#define trace_rcu_barrier(name, s, cpu, cnt, done) do { } while (0)
> +TRACE_EVENT_NONE(rcu_grace_period,
> +	TP_PROTO(const char *rcuname, unsigned long gp_seq,
> +		 const char *gpevent));
> +TRACE_EVENT_NONE(rcu_future_grace_period,
> +	TP_PROTO(const char *rcuname, unsigned long gp_seq,
> +		 unsigned long gp_seq_req, u8 level, int grplo,
> +		 int grphi, const char *gpevent));
> +TRACE_EVENT_NONE(rcu_grace_period_init,
> +	TP_PROTO(const char *rcuname, unsigned long gp_seq, u8 level,
> +		 int grplo, int grphi, unsigned long qsmask));
> +TRACE_EVENT_NONE(rcu_exp_grace_period,
> +	TP_PROTO(const char *rcuname, unsigned long gpseq,
> +		 const char *gpevent));
> +TRACE_EVENT_NONE(rcu_exp_funnel_lock,
> +	TP_PROTO(const char *rcuname, u8 level, int grplo, int grphi,
> +		 const char *gpevent));
> +TRACE_EVENT_NONE(rcu_nocb_wake,
> +	TP_PROTO(const char *rcuname, int cpu, const char *reason));
> +TRACE_EVENT_NONE(rcu_preempt_task,
> +	TP_PROTO(const char *rcuname, int pid, unsigned long gp_seq));
> +TRACE_EVENT_NONE(rcu_unlock_preempted_task,
> +	TP_PROTO(const char *rcuname, unsigned long gp_seq, int pid));
> +TRACE_EVENT_NONE(rcu_quiescent_state_report,
> +	TP_PROTO(const char *rcuname, unsigned long gp_seq,
> +		 unsigned long mask, unsigned long qsmask,
> +		 u8 level, int grplo, int grphi, int gp_tasks));
> +TRACE_EVENT_NONE(rcu_fqs,
> +	TP_PROTO(const char *rcuname, unsigned long gp_seq, int cpu,
> +		 const char *qsevent));
> +TRACE_EVENT_NONE(rcu_dyntick,
> +	TP_PROTO(const char *polarity, long oldnesting, long newnesting,
> +		 atomic_t dynticks));
> +TRACE_EVENT_NONE(rcu_callback,
> +	TP_PROTO(const char *rcuname, struct rcu_head *rhp, long qlen_lazy,
> +		 long qlen));
> +TRACE_EVENT_NONE(rcu_kfree_callback,
> +	TP_PROTO(const char *rcuname, struct rcu_head *rhp,
> +		 unsigned long offset, long qlen_lazy, long qlen));
> +TRACE_EVENT_NONE(rcu_batch_start,
> +	TP_PROTO(const char *rcuname, long qlen_lazy, long qlen, long blimit));
> +TRACE_EVENT_NONE(rcu_invoke_callback,
> +	TP_PROTO(const char *rcuname, struct rcu_head *rhp));
> +TRACE_EVENT_NONE(rcu_invoke_kfree_callback,
> +	TP_PROTO(const char *rcuname, struct rcu_head *rhp,
> +		 unsigned long offset));
> +TRACE_EVENT_NONE(rcu_batch_end,
> +	TP_PROTO(const char *rcuname, int callbacks_invoked,
> +		 char cb, char nr, char iit, char risk));
> +TRACE_EVENT_NONE(rcu_torture_read,
> +	TP_PROTO(const char *rcutorturename, struct rcu_head *rhp,
> +		 unsigned long secs, unsigned long c_old, unsigned long c));
> +TRACE_EVENT_NONE(rcu_barrier,
> +	TP_PROTO(const char *rcuname, const char *s, int cpu, int cnt,
> +		 unsigned long done));
> 
>  #endif /* #else #ifdef CONFIG_RCU_TRACE */
> 
> diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h
> index a393e24..2778e44 100644
> --- a/kernel/rcu/rcu.h
> +++ b/kernel/rcu/rcu.h
> @@ -24,11 +24,6 @@
>  #define __LINUX_RCU_H
> 
>  #include <trace/events/rcu.h>
> -#ifdef CONFIG_RCU_TRACE
> -#define RCU_TRACE(stmt) stmt
> -#else /* #ifdef CONFIG_RCU_TRACE */
> -#define RCU_TRACE(stmt)
> -#endif /* #else #ifdef CONFIG_RCU_TRACE */
> 
>  /* Offset to allow for unmatched rcu_irq_{enter,exit}(). */
>  #define DYNTICK_IRQ_NONIDLE	((LONG_MAX / 2) + 1)
> @@ -229,12 +224,12 @@ static inline bool __rcu_reclaim(const char *rn, struct rcu_head *head)
> 
>  	rcu_lock_acquire(&rcu_callback_map);
>  	if (__is_kfree_rcu_offset(offset)) {
> -		RCU_TRACE(trace_rcu_invoke_kfree_callback(rn, head, offset);)
> +		trace_rcu_invoke_kfree_callback(rn, head, offset);
>  		kfree((void *)head - offset);
>  		rcu_lock_release(&rcu_callback_map);
>  		return true;
>  	} else {
> -		RCU_TRACE(trace_rcu_invoke_callback(rn, head);)
> +		trace_rcu_invoke_callback(rn, head);
>  		f = head->func;
>  		WRITE_ONCE(head->func, (rcu_callback_t)0L);
>  		f(head);
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 9180158..d2ad39f 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -2329,14 +2329,14 @@ static void rcu_report_qs_rnp(unsigned long mask, struct rcu_node *rnp,
>   */
>  int rcutree_dying_cpu(unsigned int cpu)
>  {
> -	RCU_TRACE(bool blkd;)
> -	RCU_TRACE(struct rcu_data *rdp = this_cpu_ptr(&rcu_data);)
> -	RCU_TRACE(struct rcu_node *rnp = rdp->mynode;)
> +	bool blkd;
> +	struct rcu_data *rdp = this_cpu_ptr(&rcu_data);
> +	struct rcu_node *rnp = rdp->mynode;
> 
>  	if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
>  		return 0;
> 
> -	RCU_TRACE(blkd = !!(rnp->qsmask & rdp->grpmask);)
> +	blkd = !!(rnp->qsmask & rdp->grpmask);
>  	trace_rcu_grace_period(rcu_state.name, rnp->gp_seq,
>  			       blkd ? TPS("cpuofl") : TPS("cpuofl-bgp"));
>  	return 0;
> -- 
> 1.8.3.1
> 


  reply	other threads:[~2019-03-26 14:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-26  1:40 [PATCH 0/3] tracing: introduce TRACE_EVENT_NONE and use it Yafang Shao
2019-03-26  1:40 ` [PATCH 1/3] tracing: introduce TRACE_EVENT_NONE() Yafang Shao
2019-03-26  1:40 ` [PATCH 2/3] sched/fair: do not expose some tracepoints to user if CONFIG_SCHEDSTATS is not set Yafang Shao
2019-03-26  2:21   ` Steven Rostedt
2019-03-26  2:23     ` Yafang Shao
2019-03-26  1:40 ` [PATCH 3/3] rcu: validate arguments for rcu tracepoints Yafang Shao
2019-03-26 14:32   ` Paul E. McKenney [this message]
2019-03-26  2:17 ` [PATCH 0/3] tracing: introduce TRACE_EVENT_NONE and use it Steven Rostedt
2019-03-26  2:24   ` Yafang Shao

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=20190326143200.GH4102@linux.ibm.com \
    --to=paulmck@linux.ibm.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=laoar.shao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=shaoyafang@didiglobal.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.