softirq: reorder trace_softirqs_on to prevent lockdep splat
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v7 1/6 softirq: reorder trace_softirqs_on to prevent lockdep splat
I'm able to reproduce a lockdep splat with config options:CONFIG_PROVE_LOCKING=y,CONFIG_DEBUG_LOCK_ALLOC=y and CONFIG_PREEMPTIRQ_EVENTS=y
$ echo 1 > /d/tracing/events/preemptirq/preempt_enable/enable --- kernel/softirq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
kernel/softirq.c +5 -1
@@ -139,9 +139,13 @@ static void __local_bh_enable(unsigned int cnt) {lockdep_assert_irqs_disabled (); +if (preempt_count () == cnt) +trace_preempt_on (CALLER_ADDR0 ,get_lock_parent_ip ()); +if (softirq_count () == (cnt &SOFTIRQ_MASK ))trace_softirqs_on (_RET_IP_); -preempt_count_sub (cnt); + +__preempt_count_sub (cnt); }/*
Signature · 1 line
2.17.0.441.gb46fe60e1d-goog
This patch submission got completely screwed up, sorry, please ignore. I'll repost soon. There's something messed up with my SMTP server too.
Quoted 32 lines · Joel Fernandes (Google)
I'm able to reproduce a lockdep splat with config options:
CONFIG_PROVE_LOCKING=y,CONFIG_DEBUG_LOCK_ALLOC=yandCONFIG_PREEMPTIRQ_EVENTS=y$ echo 1 > /d/tracing/events/preemptirq/preempt_enable/enable --- kernel/softirq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)kernel/softirq.c +5
-1@@ -139,9 +139,13 @@ static void __local_bh_enable(unsigned int cnt) {lockdep_assert_irqs_disabled (); +if (preempt_count () == cnt) +trace_preempt_on (CALLER_ADDR0 ,get_lock_parent_ip ()); +if (softirq_count () == (cnt &SOFTIRQ_MASK ))trace_softirqs_on (_RET_IP_); -preempt_count_sub (cnt); + +__preempt_count_sub (cnt); }/* Signature · 1 line
2.17.0.441.gb46fe60e1d-goog
PATCH v7 2/6 srcu: Add notrace variants of srcu_read_{lock,unlock}
In reply to a message not in the archiveFrom: Paul McKenney <[email protected]>
This is needed for a future tracepoint patch that uses srcu, and to make sure it doesn't call into lockdep.
tracepoint code already calls notrace variants for rcu_read_lock_sched so this patch does the same for srcu which will be used in a later patch. Keeps it consistent with rcu-sched.
[Joel: Added commit message]
--- include/linux/srcu.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
include/linux/srcu.h +17 -0
@@ -161,6 +161,16 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)return retval; } +/* Used by tracing, cannot be traced and cannot invoke lockdep. */ +static inline notrace int +srcu_read_lock_notrace (struct srcu_struct *sp)__acquires (sp) +{ +int retval; + + retval =__srcu_read_lock (sp); +return retval; +} +/** * srcu_read_unlock - unregister a old reader from an SRCU-protected structure. * @sp: srcu_struct in which to unregister the old reader.
@@ -175,6 +185,13 @@ static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)__srcu_read_unlock (sp, idx); } +/* Used by tracing, cannot be traced and cannot call lockdep. */ +static inline notrace void +srcu_read_unlock_notrace (struct srcu_struct *sp,int idx)__releases (sp) +{ +__srcu_read_unlock (sp, idx); +} +/** * smp_mb__after_srcu_read_unlock - ensure full ordering after srcu_read_unlock *
Signature · 1 line
2.17.0.441.gb46fe60e1d-goog
Re: [PATCH v7 2/6] srcu: Add notrace variants of srcu_read_{lock,unlock}
Something is majorly messed up with my SMTP server. Only half of the patches in this series were sent out and the ones that did go out were random.
I keeping getting this as replies for the one's that didn't go out:
https://support.google.com/mail/answer/6596?visit_id=1-636620224226493206-2884214369&rd=1
And its intermittent too.. I am going to spend a bit of time to figure out why it happened so it doesn't happen again. Sorry about the noise.
Sigh,
- Joel
include/linux/srcu.h static inline int srcu_read_lock(struct srcu_struct
Quoted 39 lines · Joel Fernandes (Google)
From: Paul McKenney <[email protected]>
This is needed for a future tracepoint patch that uses srcu, and to make sure it doesn't call into lockdep.
tracepoint code already calls notrace variants for
rcu_read_lock_schedso this patch does the same for srcu which will be used in a later patch. Keeps it consistent with rcu-sched.[Joel: Added commit message]
Cc Steven Rostedt <[email protected]>Cc Peter Zilstra <[email protected]>Cc Ingo Molnar <[email protected]>Cc Mathieu Desnoyers <[email protected]>Cc Tom Zanussi <[email protected]>Cc Namhyung Kim <[email protected]>Cc Thomas Glexiner <[email protected]>Cc Boqun Feng <[email protected]>Cc Paul McKenney <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Randy Dunlap <[email protected]>Cc Masami Hiramatsu <[email protected]>Cc Fenguang Wu <[email protected]>Cc Baohong Liu <[email protected]>Cc Vedang Patel <[email protected]>Reviewed-by Steven Rostedt (VMware) <[email protected]>Signed-off-by Paul McKenney <[email protected]>Signed-off-by Joel Fernandes (Google) <[email protected]>--- include/linux/srcu.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)include/linux/srcu.h +0
-0@@ -161,6 +161,16 @@ static inline int srcu_read_lock(struct srcu_struct
*sp) __acquires(sp)
Quoted 5 lines
include/linux/srcu.h +2
-0return retval; } +/* Used by tracing, cannot be traced and cannot invoke lockdep. */ +static inline notrace int
include/linux/srcu.h static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
Quoted 10 lines
include/linux/srcu.h +8
-0+srcu_read_lock_notrace(struct srcu_struct *sp) __acquires(sp) +{ +int retval; + + retval =__srcu_read_lock (sp); +return retval; +} +/** * srcu_read_unlock - unregister a old reader from an SRCU-protected
structure.
include/linux/srcu.h static inline void srcu_read_unlock(struct
Quoted 2 lines
include/linux/srcu.h +0
-0* @sp: srcu_struct in which to unregister the old reader. @@ -175,6 +185,13 @@ static inline void srcu_read_unlock(struct
srcu_struct *sp, int idx)
include/linux/srcu.h static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
Quoted 12 lines
include/linux/srcu.h +7
-0__srcu_read_unlock (sp, idx); } +/* Used by tracing, cannot be traced and cannot call lockdep. */ +static inline notrace void +srcu_read_unlock_notrace (struct srcu_struct *sp,int idx)__releases (sp) +{ +__srcu_read_unlock (sp, idx); +} +/** * smp_mb__after_srcu_read_unlock - ensure full ordering after
srcu_read_unlock
Quoted 3 lines
include/linux/srcu.h +0
-1* --2.17.0.441.gb46fe60e1d-goog
PATCH v7 4/6 trace/irqsoff: Split reset into separate functions
In reply to a message not in the archiveSplit reset functions into seperate functions in preparation of future patches that need to do tracer specific reset.
--- kernel/trace/trace_irqsoff.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
kernel/trace/trace_irqsoff.c +19 -3
@@ -634,7 +634,7 @@ static int __irqsoff_tracer_init(struct trace_array *tr)return 0 ; } -static void irqsoff_tracer_reset (struct trace_array *tr) +static void __irqsoff_tracer_reset (struct trace_array *tr) {int lat_flag = save_flags &TRACE_ITER_LATENCY_FMT ;int overwrite_flag = save_flags &TRACE_ITER_OVERWRITE ;
@@ -665,6 +665,12 @@ static int irqsoff_tracer_init(struct trace_array *tr)return __irqsoff_tracer_init (tr); } + +static void irqsoff_tracer_reset (struct trace_array *tr) +{ +__irqsoff_tracer_reset (tr); +} +static struct tracer irqsoff_tracer__read_mostly = { .name ="irqsoff" ,
@@ -697,11 +703,16 @@ static int preemptoff_tracer_init(struct trace_array *tr)return __irqsoff_tracer_init (tr); } +static void preemptoff_tracer_reset (struct trace_array *tr) +{ +__irqsoff_tracer_reset (tr); +} +static struct tracer preemptoff_tracer__read_mostly = { .name ="preemptoff" , .init = preemptoff_tracer_init, - .reset = irqsoff_tracer_reset, + .reset = preemptoff_tracer_reset, .start = irqsoff_tracer_start, .stop = irqsoff_tracer_stop, .print_max = true,
@@ -731,11 +742,16 @@ static int preemptirqsoff_tracer_init(struct trace_array *tr)return __irqsoff_tracer_init (tr); } +static void preemptirqsoff_tracer_reset (struct trace_array *tr) +{ +__irqsoff_tracer_reset (tr); +} +static struct tracer preemptirqsoff_tracer__read_mostly = { .name ="preemptirqsoff" , .init = preemptirqsoff_tracer_init, - .reset = irqsoff_tracer_reset, + .reset = preemptirqsoff_tracer_reset, .start = irqsoff_tracer_start, .stop = irqsoff_tracer_stop, .print_max = true,
Signature · 1 line
2.17.0.441.gb46fe60e1d-goog