WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Disable Xen PowerNow! support on Opteron 2nd gen and

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Disable Xen PowerNow! support on Opteron 2nd gen and earlier processors
From: "Mark Langsdorf" <mark.langsdorf@xxxxxxx>
Date: Tue, 22 Jan 2008 11:52:43 -0600
Delivery-date: Tue, 22 Jan 2008 10:29:17 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.6 (enterprise 20070904.708012)
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@xxxxxxx>

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
+



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