]> xenbits.xen.org Git - xenclient/xen-pq.git/commitdiff
Shuffle order of disabling/enabling APIC timer and more in Cx code path.
authorKamala Narasimhan <kamala.narasimhan@citrix.com>
Sun, 13 Sep 2009 06:57:10 +0000 (02:57 -0400)
committerKamala Narasimhan <kamala.narasimhan@citrix.com>
Sun, 13 Sep 2009 06:57:10 +0000 (02:57 -0400)
1) Remove b-m-arb disable code that shouldn't be in xen.git (Note: Pull this out once we fix xen.git)
2) Per Christian Limpach's patch/list of differences, reorg Cx code to be consistent with native linux.

master/b-m-arb-sync-with-native-linux [new file with mode: 0644]
master/series

diff --git a/master/b-m-arb-sync-with-native-linux b/master/b-m-arb-sync-with-native-linux
new file mode 100644 (file)
index 0000000..2168d23
--- /dev/null
@@ -0,0 +1,111 @@
+diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
+index 12f6d2a..e4d4384 100644
+--- a/xen/arch/x86/acpi/cpu_idle.c
++++ b/xen/arch/x86/acpi/cpu_idle.c
+@@ -184,12 +184,10 @@ static int acpi_idle_bm_check(void)
+     return bm_status;
+ }
+-#if 0
+ static struct {
+     spinlock_t lock;
+     unsigned int count;
+ } c3_cpu_status = { .lock = SPIN_LOCK_UNLOCKED };
+-#endif
+ static void acpi_processor_idle(void)
+ {
+@@ -272,6 +270,23 @@ static void acpi_processor_idle(void)
+         }
+     case ACPI_STATE_C3:
++
++         /* Test code: Remove the below code if not necessary */
++         acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1);
++
++        /*
++         * Before invoking C3, be aware that TSC/APIC timer may be
++         * stopped by H/W. Without carefully handling of TSC/APIC stop issues,
++         * deep C state can't work correctly.
++         */
++        /* preparing APIC stop */
++        lapic_timer_off();
++
++        /* Get start time (ticks) */
++        t1 = inl(pmtmr_ioport);
++        /* Trace cpu idle entry */
++        TRACE_2D(TRC_PM_IDLE_ENTRY, cx->idx, t1);
++
+         /*
+          * disable bus master
+          * bm_check implies we need ARB_DIS
+@@ -284,9 +299,9 @@ static void acpi_processor_idle(void)
+          */
+         if ( power->flags.bm_check && power->flags.bm_control )
+         {
+-#if 0
+             spin_lock(&c3_cpu_status.lock);
+-            if ( ++c3_cpu_status.count == num_online_cpus() )
++            c3_cpu_status.count++;
++            if ( c3_cpu_status.count == num_online_cpus() )
+             {
+                 /*
+                  * All CPUs are trying to go to C3
+@@ -295,7 +310,6 @@ static void acpi_processor_idle(void)
+                 acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1);
+             }
+             spin_unlock(&c3_cpu_status.lock);
+-#endif
+         }
+         else if ( !power->flags.bm_check )
+         {
+@@ -303,39 +317,26 @@ static void acpi_processor_idle(void)
+             ACPI_FLUSH_CPU_CACHE();
+         }
+-        /*
+-         * Before invoking C3, be aware that TSC/APIC timer may be 
+-         * stopped by H/W. Without carefully handling of TSC/APIC stop issues,
+-         * deep C state can't work correctly.
+-         */
+-        /* preparing APIC stop */
+-        lapic_timer_off();
+-
+-        /* Get start time (ticks) */
+-        t1 = inl(pmtmr_ioport);
+-        /* Trace cpu idle entry */
+-        TRACE_2D(TRC_PM_IDLE_ENTRY, cx->idx, t1);
+         /* Invoke C3 */
+         acpi_idle_do_entry(cx);
+-        /* Get end time (ticks) */
+-        t2 = inl(pmtmr_ioport);
+-
+-        /* recovering TSC */
+-        cstate_restore_tsc();
+-        /* Trace cpu idle exit */
+-        TRACE_2D(TRC_PM_IDLE_EXIT, cx->idx, t2);
+         if ( power->flags.bm_check && power->flags.bm_control )
+         {
+-#if 0
+             /* Enable bus master arbitration */
+             spin_lock(&c3_cpu_status.lock);
+-            if ( c3_cpu_status.count-- == num_online_cpus() )
+-                acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
++            acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
++            c3_cpu_status.count--;
+             spin_unlock(&c3_cpu_status.lock);
+-#endif
+         }
++        /* Get end time (ticks) */
++        t2 = inl(pmtmr_ioport);
++
++        /* recovering TSC */
++        cstate_restore_tsc();
++        /* Trace cpu idle exit */
++        TRACE_2D(TRC_PM_IDLE_EXIT, cx->idx, t2);
++
+         /* Re-enable interrupts */
+         local_irq_enable();
+         /* recovering APIC */
index 857055293f3db1edb68a4d082cd2e580ea066709..050a4a65cbf18cf8051e4af44b4225af52fc683e 100644 (file)
@@ -21,3 +21,4 @@ xblanker
 ugly-hack-to-fix-sata
 serial-card
 boot-second-cd
+b-m-arb-sync-with-native-linux