All of lore.kernel.org
 help / color / mirror / Atom feed
* preemptirqsoff tracer
@ 2017-04-04  8:27 Joel Fernandes
  2017-04-04 13:27 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Fernandes @ 2017-04-04  8:27 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-rt-users

Hi Steven,

Just looking at code of the preemptirqsoff tracer, I wonder if it is
really working as expected.

With the tracer enabled, start_critical_timing will be called only if
_both_ preemption and IRQs are turned off. Instead shouldn't this be
an OR condition (either preemption or IRQs are turned off)?

>From the example in ftrace.txt documentation:
    local_irq_disable();
    call_function_with_irqs_off();
    preempt_disable();
    call_function_with_irqs_and_preemption_off();
    local_irq_enable();
    call_function_with_preemption_off();
    preempt_enable();

Looks to me like the preemptirqsoff tracer will starting tracing from
preempt_disable and end at the preempt_enable. Instead, shouldn't we
be tracing starting from the local_irq_disable and end at the
preempt_enable?

Regards,
Joel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: preemptirqsoff tracer
  2017-04-04  8:27 preemptirqsoff tracer Joel Fernandes
@ 2017-04-04 13:27 ` Steven Rostedt
  2017-04-04 15:04   ` Joel Fernandes
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2017-04-04 13:27 UTC (permalink / raw)
  To: Joel Fernandes; +Cc: linux-rt-users

On Tue, 4 Apr 2017 01:27:25 -0700
Joel Fernandes <joelaf@google.com> wrote:

> Hi Steven,
> 
> Just looking at code of the preemptirqsoff tracer, I wonder if it is
> really working as expected.
> 
> With the tracer enabled, start_critical_timing will be called only if
> _both_ preemption and IRQs are turned off. Instead shouldn't this be
> an OR condition (either preemption or IRQs are turned off)?

What code are you looking at. From what I have:

void start_critical_timings(void)
{
	if (preempt_trace() || irq_trace())
		start_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
}

There's an OR statement.

-- Steve

> 
> >From the example in ftrace.txt documentation:  
>     local_irq_disable();
>     call_function_with_irqs_off();
>     preempt_disable();
>     call_function_with_irqs_and_preemption_off();
>     local_irq_enable();
>     call_function_with_preemption_off();
>     preempt_enable();
> 
> Looks to me like the preemptirqsoff tracer will starting tracing from
> preempt_disable and end at the preempt_enable. Instead, shouldn't we
> be tracing starting from the local_irq_disable and end at the
> preempt_enable?
> 
> Regards,
> Joel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: preemptirqsoff tracer
  2017-04-04 13:27 ` Steven Rostedt
@ 2017-04-04 15:04   ` Joel Fernandes
  0 siblings, 0 replies; 3+ messages in thread
From: Joel Fernandes @ 2017-04-04 15:04 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-rt-users

On Tue, Apr 4, 2017 at 6:27 AM, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Tue, 4 Apr 2017 01:27:25 -0700
> Joel Fernandes <joelaf@google.com> wrote:
>
>> Hi Steven,
>>
>> Just looking at code of the preemptirqsoff tracer, I wonder if it is
>> really working as expected.
>>
>> With the tracer enabled, start_critical_timing will be called only if
>> _both_ preemption and IRQs are turned off. Instead shouldn't this be
>> an OR condition (either preemption or IRQs are turned off)?
>
> What code are you looking at. From what I have:

Mainline.

>
> void start_critical_timings(void)
> {
>         if (preempt_trace() || irq_trace())
>                 start_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
> }

This is called from the idle path though.

>
> There's an OR statement.

Actually in trace_preempt_off, its an AND condition but the
irq_trace() is negated so it works correctly (too many double
negatives so I missed that, sorry!).

if (preempt_trace() && !irq_trace) ...

and likewise in trace_hardirqs_on, its:

if (!preempt_trace() && irq_trace())

So its all good :-)
Regards,
Joel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-04 15:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04  8:27 preemptirqsoff tracer Joel Fernandes
2017-04-04 13:27 ` Steven Rostedt
2017-04-04 15:04   ` Joel Fernandes

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.