Re: v2.6.21-rt2

From: Ingo Molnar
Date: Wed May 16 2007 - 17:33:28 EST



* Daniel Walker <dwalker@xxxxxxxxxx> wrote:

> > > http://lkml.org/lkml/2007/5/3/368
> >
> > hm - trace_hardirqs_on() should never be called with irqs on -
> > lockdep could break for example. Could you try to fix the call site
> > instead?
>
> If that's the case why check if they're enabled inside
> trace_hardirqs_on() ? If that check fails you still still get the
> warning in my original release ..

yeah, indeed you are right - it checks the soft flag. But even then, the
better fix is to check for hardirqs-off first and not to flip around the
preempt count check in irqs_off_preempt_count() - i.e. something like
the patch below. Does this solve the warning you've triggered with
irqsoff-tracing enabled?

Ingo

Index: linux-rt.q/kernel/latency_trace.c
===================================================================
--- linux-rt.q.orig/kernel/latency_trace.c
+++ linux-rt.q/kernel/latency_trace.c
@@ -1963,7 +1963,7 @@ void notrace trace_hardirqs_on(void)

local_save_flags(flags);

- if (!irqs_off_preempt_count() && irqs_disabled_flags(flags))
+ if (irqs_disabled_flags(flags) && !irqs_off_preempt_count())
__stop_critical_timing(CALLER_ADDR0, 0 /* CALLER_ADDR1 */);
}

@@ -1975,7 +1975,7 @@ void notrace trace_hardirqs_off(void)

local_save_flags(flags);

- if (!irqs_off_preempt_count() && irqs_disabled_flags(flags))
+ if (irqs_disabled_flags(flags) && !irqs_off_preempt_count())
__start_critical_timing(CALLER_ADDR0, 0 /* CALLER_ADDR1 */,
INTERRUPT_LATENCY);
}
@@ -1989,7 +1989,7 @@ void notrace trace_hardirqs_on_caller(un

local_save_flags(flags);

- if (!irqs_off_preempt_count() && irqs_disabled_flags(flags))
+ if (irqs_disabled_flags(flags) && !irqs_off_preempt_count())
__stop_critical_timing(caller_addr, 0 /* CALLER_ADDR1 */);
}

@@ -1999,7 +1999,7 @@ void notrace trace_hardirqs_off_caller(u

local_save_flags(flags);

- if (!irqs_off_preempt_count() && irqs_disabled_flags(flags))
+ if (irqs_disabled_flags(flags) && !irqs_off_preempt_count())
__start_critical_timing(caller_addr, 0 /* CALLER_ADDR1 */,
INTERRUPT_LATENCY);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/