public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH for 2.6.18] [2/8] x86_64: On Intel systems when CPU has C3 don't use TSC
@ 2006-07-29 19:42 Andi Kleen
  2006-08-01 13:04 ` Sergio Monteiro Basto
  0 siblings, 1 reply; 7+ messages in thread
From: Andi Kleen @ 2006-07-29 19:42 UTC (permalink / raw)
  To: torvalds; +Cc: discuss, linux-kernel


On Intel systems generally the TSC stops in C3 or deeper, 
so don't use it there. Follows similar logic on i386.

This should fix problems on Meroms.

Signed-off-by: Andi Kleen <ak@suse.de>

---
 arch/x86_64/kernel/time.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

Index: linux-2.6.18-rc2-git7/arch/x86_64/kernel/time.c
===================================================================
--- linux-2.6.18-rc2-git7.orig/arch/x86_64/kernel/time.c
+++ linux-2.6.18-rc2-git7/arch/x86_64/kernel/time.c
@@ -28,6 +28,7 @@
 #include <linux/acpi.h>
 #ifdef CONFIG_ACPI
 #include <acpi/achware.h>	/* for PM timer frequency */
+#include <acpi/acpi_bus.h>
 #endif
 #include <asm/8253pit.h>
 #include <asm/pgtable.h>
@@ -953,11 +954,18 @@ __cpuinit int unsynchronized_tsc(void)
 #ifdef CONFIG_SMP
 	if (apic_is_clustered_box())
 		return 1;
- 	/* Intel systems are normally all synchronized. Exceptions
- 	   are handled in the check above. */
- 	if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
- 		return 0;
 #endif
+	/* Most intel systems have synchronized TSCs except for
+	   multi node systems */
+ 	if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) {
+#ifdef CONFIG_ACPI
+		/* But TSC doesn't tick in C3 so don't use it there */
+		if (acpi_fadt.length > 0 && acpi_fadt.plvl3_lat < 100)
+			return 1;
+#endif
+ 		return 0;
+	}
+
  	/* Assume multi socket systems are not synchronized */
  	return num_present_cpus() > 1;
 }

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-08-01 22:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-29 19:42 [PATCH for 2.6.18] [2/8] x86_64: On Intel systems when CPU has C3 don't use TSC Andi Kleen
2006-08-01 13:04 ` Sergio Monteiro Basto
2006-08-01 17:10   ` [discuss] " Andi Kleen
2006-08-01 21:40     ` Sergio Monteiro Basto
2006-08-01 21:56       ` Andi Kleen
     [not found]         ` <1154470000.5123.1.camel@localhost.portugal>
2006-08-01 22:21           ` Andi Kleen
2006-08-01 22:52             ` Sergio Monteiro Basto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox