[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



> 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.

Surely it should be possible to inform Xen of frequency changes (other
that T-states due to thermal throttling) and hence allow Xen to ensure
monotonicity? Xen itself does not require that the CPUs run with the
same rate TSC. It does need to know what frequency they're running at,
and when they change.

Ian

> 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

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.