[patch] Real-Time Preemption, -RT-2.6.10-rc2-mm3-V0.7.31-19

From: Ingo Molnar
Date: Wed Dec 01 2004 - 11:23:13 EST



* Ingo Molnar <mingo@xxxxxxx> wrote:

> ok, this could be ACPI CPU-sleep related. Could you disable all ACPI
> options in your .config (as a workaround), and re-check whether the
> xruns still occur?

i think i found the bug - it's an upstream ACPI bug. Does the patch
below (or the -31-19 kernel, which i've just uploaded) fix the xruns?

the upstream ACPI bug is this: we check need_resched() _before_
disabling preemption. This opens up the following scenario:

swapper: !need_resched()
[IRQ context]
wakes up a task
marks idle task as need-resched

swapper: acpi_processor_idle(); // sleeps until next irq

instant 1msec latency introduced...

normally default_idle() is safe because it re-checks need_resched with
interrupts disabled before it truly halts the CPU. But
acpi_processor_idle() doesnt seem to be doing this! Your trace clearly
shows a missed preemption due to ACPI. I'm wondering why no-one has
triggered this before, it's a really bad bug that should be fixed in
2.6.10.

Ingo

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>

--- linux/drivers/acpi/processor.c.orig
+++ linux/drivers/acpi/processor.c
@@ -370,6 +370,15 @@ acpi_processor_idle (void)
*/
local_irq_disable();

+ /*
+ * Check whether we truly need to go idle, or should
+ * reschedule:
+ */
+ if (unlikely(need_resched())) {
+ local_irq_enable();
+ return;
+ }
+
cx = &(pr->power.states[pr->power.state]);

/*
-
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/