From: Joel Fernandes <agnel.joel@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] trace: irqsoff: Fix function tracing in preempt and preemptirqsoff tracers
Date: Sat, 12 Mar 2016 00:07:03 -0800 [thread overview]
Message-ID: <1457770023-88559-1-git-send-email-agnel.joel@gmail.com> (raw)
All functions aren't traced in critical sections where preemption is disabled
and interrupts are enabled in preempt* tracers because current behavior is to
check if interrupts are disabled and if they are not, then we don't trace these
functions. So here we do the correct checks depending on tracer type and allow
these functions to be traced.
One example is when interrupts are enabled before softirq processing, with the
patch, these functions are traced as well.
<...>-2265 1d.h1 3419us : preempt_count_sub <-irq_exit
<...>-2265 1d..1 3419us : __do_softirq <-irq_exit
<...>-2265 1d..1 3419us : msecs_to_jiffies <-__do_softirq
<...>-2265 1d..1 3420us : irqtime_account_irq <-__do_softirq
<...>-2265 1d..1 3420us : __local_bh_disable_ip <-__do_softirq
<...>-2265 1..s1 3421us : run_timer_softirq <-__do_softirq
<...>-2265 1..s1 3421us : hrtimer_run_pending <-run_timer_softirq
<...>-2265 1..s1 3421us : _raw_spin_lock_irq <-run_timer_softirq
<...>-2265 1d.s1 3422us : preempt_count_add <-_raw_spin_lock_irq
<...>-2265 1d.s2 3422us : _raw_spin_unlock_irq <-run_timer_softirq
<...>-2265 1..s2 3422us : preempt_count_sub <-_raw_spin_unlock_irq
<...>-2265 1..s1 3423us : rcu_bh_qs <-__do_softirq
<...>-2265 1d.s1 3423us : irqtime_account_irq <-__do_softirq
<...>-2265 1d.s1 3423us : __local_bh_enable <-__do_softirq
Signed-off-by: Joel Fernandes <agnel.joel@gmail.com>
---
kernel/trace/trace_irqsoff.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index e4e5658..ca8f84f 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -110,8 +110,20 @@ static int func_prolog_dec(struct trace_array *tr,
local_save_flags(*flags);
/* slight chance to get a false positive on tracing_cpu */
- if (!irqs_disabled_flags(*flags))
- return 0;
+ switch (trace_type) {
+ case (TRACER_IRQS_OFF | TRACER_PREEMPT_OFF):
+ if (!preempt_trace() && !irqs_disabled_flags(*flags))
+ return 0;
+ break;
+ case TRACER_IRQS_OFF:
+ if (!irqs_disabled_flags(*flags))
+ return 0;
+ break;
+ case TRACER_PREEMPT_OFF:
+ if (!preempt_trace())
+ return 0;
+ break;
+ }
*data = per_cpu_ptr(tr->trace_buffer.data, cpu);
disabled = atomic_inc_return(&(*data)->disabled);
--
2.5.0
next reply other threads:[~2016-03-12 8:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-12 8:07 Joel Fernandes [this message]
2016-03-12 8:13 [PATCH] trace: irqsoff: Fix function tracing in preempt and preemptirqsoff tracers Joel Fernandes
2016-03-18 15:13 ` Steven Rostedt
2016-03-18 16:44 ` Steven Rostedt
2016-03-20 1:57 ` Joel Fernandes
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=1457770023-88559-1-git-send-email-agnel.joel@gmail.com \
--to=agnel.joel@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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.