[patch 18/23] dynticks: i386 arch code

From: Thomas Gleixner
Date: Fri Sep 29 2006 - 20:09:44 EST


From: Ingo Molnar <mingo@xxxxxxx>

prepare i386 for dyntick: idle handler callbacks and IRQ callback.

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
----
arch/i386/kernel/nmi.c | 3 ++-
arch/i386/kernel/process.c | 27 +++++++++++++++------------
2 files changed, 17 insertions(+), 13 deletions(-)

Index: linux-2.6.18-mm2/arch/i386/kernel/nmi.c
===================================================================
--- linux-2.6.18-mm2.orig/arch/i386/kernel/nmi.c 2006-09-30 01:41:10.000000000 +0200
+++ linux-2.6.18-mm2/arch/i386/kernel/nmi.c 2006-09-30 01:41:19.000000000 +0200
@@ -20,6 +20,7 @@
#include <linux/sysdev.h>
#include <linux/sysctl.h>
#include <linux/percpu.h>
+#include <linux/kernel_stat.h>
#include <linux/dmi.h>
#include <linux/kprobes.h>

@@ -908,7 +909,7 @@ __kprobes int nmi_watchdog_tick(struct p
touched = 1;
}

- sum = per_cpu(irq_stat, cpu).apic_timer_irqs;
+ sum = per_cpu(irq_stat, cpu).apic_timer_irqs + kstat_irqs(0);

/* if the apic timer isn't firing, this cpu isn't doing much */
if (!touched && last_irq_sums[cpu] == sum) {
Index: linux-2.6.18-mm2/arch/i386/kernel/process.c
===================================================================
--- linux-2.6.18-mm2.orig/arch/i386/kernel/process.c 2006-09-30 01:41:10.000000000 +0200
+++ linux-2.6.18-mm2/arch/i386/kernel/process.c 2006-09-30 01:41:19.000000000 +0200
@@ -178,24 +178,27 @@ void cpu_idle(void)

/* endless idle loop with no priority at all */
while (1) {
- while (!need_resched()) {
- void (*idle)(void);
+ if (!hrtimer_stop_sched_tick()) {
+ while (!need_resched()) {
+ void (*idle)(void);

- if (__get_cpu_var(cpu_idle_state))
- __get_cpu_var(cpu_idle_state) = 0;
+ if (__get_cpu_var(cpu_idle_state))
+ __get_cpu_var(cpu_idle_state) = 0;

- rmb();
- idle = pm_idle;
+ rmb();
+ idle = pm_idle;

- if (!idle)
- idle = default_idle;
+ if (!idle)
+ idle = default_idle;

- if (cpu_is_offline(cpu))
- play_dead();
+ if (cpu_is_offline(cpu))
+ play_dead();

- __get_cpu_var(irq_stat).idle_timestamp = jiffies;
- idle();
+ __get_cpu_var(irq_stat).idle_timestamp = jiffies;
+ idle();
+ }
}
+ hrtimer_restart_sched_tick();
preempt_enable_no_resched();
schedule();
preempt_disable();

--

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