From owner-svn-src-all@FreeBSD.ORG Mon Aug 22 03:10:30 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0DD491065672; Mon, 22 Aug 2011 03:10:30 +0000 (UTC) (envelope-from silby@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F21868FC13; Mon, 22 Aug 2011 03:10:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7M3ATm0030992; Mon, 22 Aug 2011 03:10:29 GMT (envelope-from silby@svn.freebsd.org) Received: (from silby@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7M3ATr2030990; Mon, 22 Aug 2011 03:10:29 GMT (envelope-from silby@svn.freebsd.org) Message-Id: <201108220310.p7M3ATr2030990@svn.freebsd.org> From: Mike Silbersack Date: Mon, 22 Aug 2011 03:10:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225069 - head/sys/x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2011 03:10:30 -0000 Author: silby Date: Mon Aug 22 03:10:29 2011 New Revision: 225069 URL: http://svn.freebsd.org/changeset/base/225069 Log: Disable TSC usage inside SMP VM environments. On my VMware ESXi 4.1 environment with a core i5-2500K, operation in this mode causes timeouts from the mpt driver. Switching to the ACPI-fast timer resolves this issue. Switching the VM back to single CPU mode also works, which is why I have not disabled the TSC in that mode. I did not test with KVM or other VM environments, but I am being cautious and assuming that the TSC is not reliable in SMP mode there as well. Reviewed by: kib Approved by: re (kib) MFC after: Not applicable, the timecounter code is new for 9.x Modified: head/sys/x86/x86/tsc.c Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Sun Aug 21 22:09:30 2011 (r225068) +++ head/sys/x86/x86/tsc.c Mon Aug 22 03:10:29 2011 (r225069) @@ -464,11 +464,16 @@ init_TSC_tc(void) * synchronized. If the user is sure that the system has synchronized * TSCs, set kern.timecounter.smp_tsc tunable to a non-zero value. * We also limit the frequency even lower to avoid "temporal anomalies" - * as much as possible. + * as much as possible. The TSC seems unreliable in virtualized SMP + * environments, so it is set to a negative quality in those cases. */ if (smp_cpus > 1) { - tsc_timecounter.tc_quality = test_smp_tsc(); - max_freq >>= 8; + if (vm_guest != 0) { + tsc_timecounter.tc_quality = -100; + } else { + tsc_timecounter.tc_quality = test_smp_tsc(); + max_freq >>= 8; + } } else #endif if (tsc_is_invariant)