# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 93507316d0a08aa566ceb1752f2b565ee1c384ad
# Parent  d7c010b63893b231e44f66ad658fa544cfae821f
[XEN][POWERPC] Switch to using power_save over idle_loop for blocking

It is debatable which is better, but usinf power_save makes more sense
to me.  By defining XENPPC_USE_IDLE in setup.c you can switch back and
forth to your hearts content.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/xen/setup.c |   39 +++++++++++++++++++++++--------------
 1 files changed, 25 insertions(+), 14 deletions(-)

diff -r d7c010b63893 -r 93507316d0a0 arch/powerpc/platforms/xen/setup.c
--- a/arch/powerpc/platforms/xen/setup.c        Mon Aug 28 14:51:29 2006 -0400
+++ b/arch/powerpc/platforms/xen/setup.c        Mon Aug 28 15:10:14 2006 -0400
@@ -1,5 +1,6 @@
 
 #define DEBUG
+#undef XENPPC_USE_IDLE
 
 #include <linux/module.h>
 #include <linux/rwsem.h>
@@ -157,30 +158,37 @@ static u64 jiffies_to_ns(unsigned long j
        return j * (1000000000UL / HZ);
 }
 
+static void xen_power_save(void)
+{
+       /* SCHEDOP_yield could immediately return. Instead, we
+        * want to idle in the Xen idle domain, so use
+        * SCHEDOP_block with a one-shot timer. */
+       /* XXX do tickless stuff here. See
+        * linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c */
+       u64 now_ns = tb_to_ns(get_tb());
+       u64 offset_ns = jiffies_to_ns(1);
+       int rc;
+
+       rc = HYPERVISOR_set_timer_op(now_ns + offset_ns);
+       BUG_ON(rc != 0);
+
+       HYPERVISOR_sched_op(SCHEDOP_block, NULL);
+}
+
+#ifdef XENPPC_USE_IDLE
 static void xen_idle(void)
 {
        while (1) {
                local_irq_disable();
                if (!need_resched()) {
-                       /* SCHEDOP_yield could immediately return. Instead, we
-                        * want to idle in the Xen idle domain, so use
-                        * SCHEDOP_block with a one-shot timer. */
-                       /* XXX do tickless stuff here. See
-                        * linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c */
-                       u64 now_ns = tb_to_ns(get_tb());
-                       u64 offset_ns = jiffies_to_ns(1);
-                       int rc;
-
-                       rc = HYPERVISOR_set_timer_op(now_ns + offset_ns);
-                       BUG_ON(rc != 0);
-
-                       HYPERVISOR_sched_op(SCHEDOP_block, NULL);
+                       xen_power_save();
                }
                local_irq_enable();
 
                schedule();
        }
 }
+#endif
 
 #ifdef CONFIG_SMP
 
@@ -297,8 +305,11 @@ define_machine(xen) {
        .get_rtc_time           = 0,
        .calibrate_decr         = generic_calibrate_decr,
        .progress               = xen_progress,
+#ifdef XENPPC_USE_IDLE
        .idle_loop              = xen_idle,
-       .power_save             = xen_idle,     
+#else
+       .power_save             = xen_power_save,
+#endif
 #ifdef CONFIG_KEXEC
        .machine_kexec          = xen_machine_kexec,
        .machine_kexec_prepare  = xen_machine_kexec_prepare,

_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel

Reply via email to