KVM: PPC: Move Shadow MSR calculation to function
[safe/jmp/linux-2.6] / arch / powerpc / kernel / idle.c
index a9e9cbd..049dda6 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/smp.h>
 #include <linux/cpu.h>
 #include <linux/sysctl.h>
+#include <linux/tick.h>
 
 #include <asm/system.h>
 #include <asm/processor.h>
 #include <asm/smp.h>
 
 #ifdef CONFIG_HOTPLUG_CPU
-/* this is used for software suspend, and that shuts down
- * CPUs even while the system is still booting... */
-#define cpu_should_die()       (cpu_is_offline(smp_processor_id()) && \
-                                  (system_state == SYSTEM_RUNNING     \
-                                || system_state == SYSTEM_BOOTING))
+#define cpu_should_die()       cpu_is_offline(smp_processor_id())
 #else
 #define cpu_should_die()       0
 #endif
@@ -59,6 +56,7 @@ void cpu_idle(void)
 
        set_thread_flag(TIF_POLLING_NRFLAG);
        while (1) {
+               tick_nohz_stop_sched_tick(1);
                while (!need_resched() && !cpu_should_die()) {
                        ppc64_runlatch_off();
 
@@ -71,10 +69,15 @@ void cpu_idle(void)
                                smp_mb();
                                local_irq_disable();
 
+                               /* Don't trace irqs off for idle */
+                               stop_critical_timings();
+
                                /* check again after disabling irqs */
                                if (!need_resched() && !cpu_should_die())
                                        ppc_md.power_save();
 
+                               start_critical_timings();
+
                                local_irq_enable();
                                set_thread_flag(TIF_POLLING_NRFLAG);
 
@@ -90,6 +93,7 @@ void cpu_idle(void)
 
                HMT_medium();
                ppc64_runlatch_on();
+               tick_nohz_restart_sched_tick();
                if (cpu_should_die())
                        cpu_die();
                preempt_enable_no_resched();
@@ -106,20 +110,18 @@ int powersave_nap;
  */
 static ctl_table powersave_nap_ctl_table[]={
        {
-               .ctl_name       = KERN_PPC_POWERSAVE_NAP,
                .procname       = "powersave-nap",
                .data           = &powersave_nap,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = proc_dointvec,
        },
        {}
 };
 static ctl_table powersave_nap_sysctl_root[] = {
        {
-               .ctl_name       = CTL_KERN,
                .procname       = "kernel",
-               .mode           = 0755,
+               .mode           = 0555,
                .child          = powersave_nap_ctl_table,
        },
        {}