All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Disable Xen PowerNow! support on Opteron 2nd gen and earlier processors
@ 2008-01-22 17:52 Mark Langsdorf
  2008-01-22 21:16 ` Ian Pratt
  0 siblings, 1 reply; 39+ messages in thread
From: Mark Langsdorf @ 2008-01-22 17:52 UTC (permalink / raw)
  To: xen-devel

The Xen hypervisor uses the TSC as a time source.  1st and 2nd generation AMD 
Operton processors have TSCs that change with frequency under power management.
The Xen hypervisor currently cannot cope with the way the TSCs change and the
time will regularly go backwards on multicore systems.  

This patch disables PowerNow! on SMP/CMP 1st and 2nd generation Opteron 
processors and their Athlon 64, Turion, and Sempron equivalents.  3rd generation
Opteron, Athlon 64, and Phenom parts have pstate invariant TSCs and do not
suffer from the time regression.

There is an optional override by passing powernow-k8.xen_tsc_override=1 on
the kernel command line, for users who are willing to trade potential time
regression or drift for improved power usage.

Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>

diff -r 47916bd012c6 arch/i386/kernel/cpu/cpufreq/powernow-k8.c
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c	Fri Jan 18 13:37:53 2008 +0000
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c	Tue Jan 22 11:14:47 2008 -0600
@@ -60,6 +60,7 @@ static cpumask_t cpu_core_map[1];
 static cpumask_t cpu_core_map[1];
 #endif
 
+static int xen_tsc_override;
 /* Return a frequency in MHz, given an input fid */
 static u32 find_freq_from_fid(u32 fid)
 {
@@ -1317,6 +1318,10 @@ static int __cpuinit powernowk8_init(voi
 			supported_cpus++;
 	}
 
+	if (!xen_tsc_override && 
+		disable_if_tsc_problems(cpu_family, supported_cpus))
+		return -ENODEV;
+
 	if (supported_cpus == num_online_cpus()) {
 		powernow_k8_cpu_preinit_acpi();
 		printk(KERN_INFO PFX "Found %d %s "
@@ -1340,5 +1345,8 @@ MODULE_DESCRIPTION("AMD Athlon 64 and Op
 MODULE_DESCRIPTION("AMD Athlon 64 and Opteron processor frequency driver.");
 MODULE_LICENSE("GPL");
 
+module_param(xen_tsc_override,  int, 0);
+MODULE_PARM_DESC(xen_tsc_override, "Allow Xen PowerNow! even if the TSCs are variable.  May cause time to go backwards.");
+
 late_initcall(powernowk8_init);
 module_exit(powernowk8_exit);
diff -r 47916bd012c6 arch/i386/kernel/cpu/cpufreq/powernow-k8.h
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h	Fri Jan 18 13:37:53 2008 +0000
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h	Tue Jan 22 11:14:47 2008 -0600
@@ -221,3 +221,21 @@ static inline void define_siblings(int c
 	cpu_set(0, cpu_sharedcore_mask[0]);
 }
 #endif
+
+#ifdef CONFIG_XEN
+static inline int disable_if_tsc_problems(unsigned int cpu_family, unsigned int supported_cpus)
+{
+	/* Disable support for multi-core RevF on Xen due to tsc issues */
+	if ((cpu_family == CPU_OPTERON) &&
+	    (supported_cpus > 1))
+		return -ENODEV;
+	else
+		return 0;
+}
+#else
+static inline int disable_if_tsc_problems()
+{
+	return 0;
+}
+#endif
+

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

end of thread, other threads:[~2008-02-11 11:27 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-22 17:52 [PATCH] Disable Xen PowerNow! support on Opteron 2nd gen and earlier processors Mark Langsdorf
2008-01-22 21:16 ` Ian Pratt
2008-01-22 21:51   ` Keir Fraser
2008-01-23  2:04     ` [PATCH] Disable Xen PowerNow! support on Opteron2nd " Tian, Kevin
2008-01-23 15:17     ` [PATCH] Disable Xen PowerNow! support on Opteron 2nd " Langsdorf, Mark
2008-01-23 15:26       ` Keir Fraser
2008-01-23 15:31         ` Langsdorf, Mark
2008-01-23 15:41           ` Keir Fraser
2008-01-25 17:19         ` Stephen C. Tweedie
2008-01-25 17:46           ` John Levon
2008-01-25 18:18             ` Keir Fraser
2008-01-25 18:12           ` Keir Fraser
2008-01-23 20:27       ` Ian Pratt
2008-01-23 21:34         ` Langsdorf, Mark
2008-01-23 22:34           ` Ian Pratt
2008-01-23 23:04             ` Langsdorf, Mark
2008-01-23 23:06             ` Keir Fraser
2008-01-25 22:58               ` Mark Langsdorf
2008-01-25 23:22                 ` Keir Fraser
2008-01-25 23:31                   ` Xavian-Anderson Macpherson
2008-01-25 23:41                     ` [PATCH] Disable Xen PowerNow! support on Opteron2nd " Ian Pratt
2008-01-26  0:32                   ` [PATCH] Disable Xen PowerNow! support on Opteron 2nd " Langsdorf, Mark
2008-01-26  0:54                   ` Langsdorf, Mark
2008-01-26  8:16                     ` Keir Fraser
2008-01-26 11:30                       ` Keir Fraser
2008-01-28 21:52                         ` Langsdorf, Mark
2008-01-28 22:00                           ` Keir Fraser
2008-01-29  9:53                           ` Keir Fraser
2008-01-29 10:32                             ` Keir Fraser
2008-01-29 11:20                               ` Keir Fraser
2008-01-29 16:13                                 ` Langsdorf, Mark
2008-02-11 11:27                                   ` Ralf Schenk
2008-02-01 16:39                                 ` Langsdorf, Mark
2008-02-02 10:34                                   ` Keir Fraser
2008-02-04 21:52                                     ` Langsdorf, Mark
2008-02-04 22:41                                       ` Keir Fraser
2008-01-25 23:39                 ` Ian Pratt
2008-01-26  0:21                   ` Langsdorf, Mark
2008-01-23 22:34           ` Keir Fraser

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.