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

[PATCH] Disable kvmclock for non constant tsc cpus.



Hi,
	We've a pretty gnarly issue with KVM paravirt clock at the moment.
Basically, cpufreq can kick the TSC out of sync on CPUs and that
confuses the hell out of guests because the current code assumes the
same TSC rate on all CPUs.

	The problem manifests itself as completely random hangs and guest
crashes, with the current workaround being to boot the guest with
clocksource=acpi_pm. See:

  https://bugzilla.redhat.com/475598

	Glommer, Gerd, Juan and Marcelo are all trying to figure out the best
fix, with the latest candidate being:

  https://bugzilla.redhat.com/attachment.cgi?id=329812

	But we'd really like to add this temporary patch to rawhide (and maybe
F10 if we don't fix it soon) ... any objections?

Thanks,
Mark.

From: Glauber Costa <glommer redhat com>
Date: Thu, 29 Jan 2009 12:39:22 -0500
Subject: [PATCH] Disable kvmclock for non constant tsc cpus.

Currently, this code path is posing us big troubles,
and we won't have a decent patch in time. So, temporarily
disable it.

See:

  https://bugzilla.redhat.com/475598

There's a module parameter for the adventurous who want to force
it.

Signed-off-by: Glauber Costa <glommer redhat com>
Signed-off-by: Marcelo Tosatti <mtosatti redhat com>
Signed-off-by: Mark McLoughlin <markmc redhat com>
---
 arch/x86/kvm/x86.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index cc17546..2e22ac9 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -957,6 +957,9 @@ out:
 	return r;
 }
 
+static int force_kvmclock = 0;
+module_param(force_kvmclock, bool, 0644);
+
 int kvm_dev_ioctl_check_extension(long ext)
 {
 	int r;
@@ -967,7 +970,6 @@ int kvm_dev_ioctl_check_extension(long ext)
 	case KVM_CAP_MMU_SHADOW_CACHE_CONTROL:
 	case KVM_CAP_SET_TSS_ADDR:
 	case KVM_CAP_EXT_CPUID:
-	case KVM_CAP_CLOCKSOURCE:
 	case KVM_CAP_PIT:
 	case KVM_CAP_NOP_IO_DELAY:
 	case KVM_CAP_MP_STATE:
@@ -992,6 +994,9 @@ int kvm_dev_ioctl_check_extension(long ext)
 	case KVM_CAP_IOMMU:
 		r = iommu_found();
 		break;
+	case KVM_CAP_CLOCKSOURCE:
+		r = force_kvmclock || boot_cpu_has(X86_FEATURE_CONSTANT_TSC);
+		break;
 	default:
 		r = 0;
 		break;
-- 
1.6.1


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