From 41d5992842c55280ac849d715140dd61e3e4b8bc Mon Sep 17 00:00:00 2001 From: Lingutla Chandrasekhar Date: Tue, 8 May 2018 15:25:06 +0530 Subject: [PATCH] trace: irqsoff: fix irqs disabled tracking Current tracking for irqs disabled is between calls of hardirqs_on to hardirqs_off, it should be reverse. fix the issue by correcting the tracking. Change-Id: I84bbe7fb906a04cfa5f779fa111e2aef9844969a Signed-off-by: Lingutla Chandrasekhar --- kernel/trace/trace_irqsoff.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c index dff44f617e9b..1482e835c563 100644 --- a/kernel/trace/trace_irqsoff.c +++ b/kernel/trace/trace_irqsoff.c @@ -491,14 +491,11 @@ static inline void tracer_hardirqs_on(void) #ifdef CONFIG_PREEMPTIRQ_EVENTS struct irqsoff_store *is = &per_cpu(the_irqsoff, raw_smp_processor_id()); + u64 delta = sched_clock() - is->ts; - if (!is->ts) { - is->ts = sched_clock(); - is->caddr[0] = CALLER_ADDR0; - is->caddr[1] = CALLER_ADDR1; - is->caddr[2] = CALLER_ADDR2; - is->caddr[3] = CALLER_ADDR3; - } + if (delta > sysctl_irqsoff_tracing_threshold_ns) + trace_irqs_disable(delta, is->caddr[0], is->caddr[1], + is->caddr[2], is->caddr[3]); #endif /* CONFIG_PREEMPTIRQ_EVENTS */ if (!preempt_trace() && irq_trace()) @@ -510,15 +507,12 @@ static inline void tracer_hardirqs_off(void) #ifdef CONFIG_PREEMPTIRQ_EVENTS struct irqsoff_store *is = &per_cpu(the_irqsoff, raw_smp_processor_id()); - u64 delta = 0; - if (is->ts) { - delta = sched_clock() - is->ts; - is->ts = 0; - } - if (delta > sysctl_irqsoff_tracing_threshold_ns) - trace_irqs_disable(delta, is->caddr[0], is->caddr[1], - is->caddr[2], is->caddr[3]); + is->ts = sched_clock(); + is->caddr[0] = CALLER_ADDR0; + is->caddr[1] = CALLER_ADDR1; + is->caddr[2] = CALLER_ADDR2; + is->caddr[3] = CALLER_ADDR3; #endif /* CONFIG_PREEMPTIRQ_EVENTS */ if (!preempt_trace() && irq_trace())