--- /dev/null
+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 */