...and provide a boot option to indicate TSCs may be skewed.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
static int __initdata opt_watchdog = 0;
boolean_param("watchdog", opt_watchdog);
-/* opt_tsc_unstable: Override all tests; assume TSC is unreliable. */
-static int opt_tsc_unstable;
-boolean_param("tsc_unstable", opt_tsc_unstable);
-
/* **** Linux config option: propagated to domain0. */
/* "acpi=off": Sisables both ACPI table parsing and interpreter. */
/* "acpi=force": Override the disable blacklist. */
}
cmdline_parse(cmdline);
- /* If TSC is marked as unstable, clear all enhanced TSC features. */
- if ( opt_tsc_unstable )
- {
- setup_clear_cpu_cap(X86_FEATURE_CONSTANT_TSC);
- setup_clear_cpu_cap(X86_FEATURE_NONSTOP_TSC);
- setup_clear_cpu_cap(X86_FEATURE_TSC_RELIABLE);
- }
-
parse_video_info();
set_current((struct vcpu *)0xfffff000); /* debug sanity */
}
/* Physically added CPUs do not have synchronised TSC. */
- cpu_set(cpu, tsc_sync_cpu_mask);
+ if ( boot_cpu_has(X86_FEATURE_TSC_RELIABLE) )
+ {
+ static bool_t once_only;
+ if ( !test_and_set_bool(once_only) )
+ printk(XENLOG_WARNING
+ " ** New physical CPU %u may have skewed TSC and hence "
+ "break assumed cross-CPU TSC coherency.\n"
+ " ** Consider using boot parameter \"tsc=skewed\" "
+ "which forces TSC emulation where appropriate.\n", cpu);
+ cpu_set(cpu, tsc_sync_cpu_mask);
+ }
srat_detect_node(cpu);
numa_add_cpu(cpu);
* PV SoftTSC Emulation.
*/
+/*
+ * tsc=unstable: Override all tests; assume TSC is unreliable.
+ * tsc=skewed: Assume TSCs are individually reliable, but skewed across CPUs.
+ */
+static void __init tsc_parse(const char *s)
+{
+ if ( !strcmp(s, "unstable") )
+ {
+ setup_clear_cpu_cap(X86_FEATURE_CONSTANT_TSC);
+ setup_clear_cpu_cap(X86_FEATURE_NONSTOP_TSC);
+ setup_clear_cpu_cap(X86_FEATURE_TSC_RELIABLE);
+ }
+ else if ( !strcmp(s, "skewed") )
+ {
+ setup_clear_cpu_cap(X86_FEATURE_TSC_RELIABLE);
+ }
+}
+custom_param("tsc", tsc_parse);
+
u64 gtime_to_gtsc(struct domain *d, u64 tsc)
{
if ( !is_hvm_domain(d) )
int host_tsc_is_safe(void)
{
- return boot_cpu_has(X86_FEATURE_TSC_RELIABLE) || (num_online_cpus() == 1);
+ return boot_cpu_has(X86_FEATURE_TSC_RELIABLE);
}
void cpuid_time_leaf(uint32_t sub_idx, uint32_t *eax, uint32_t *ebx,