Module Name: src
Committed By: christos
Date: Wed Jun 26 20:52:28 UTC 2013
Modified Files:
src/sys/arch/x86/x86: identcpu.c
Log Message:
PR/47967: Jeff Rizzo: Add a probe for QEMU to disable it from claiming it
has MSR_TSC. Fixes DTRACE crashing because it returned a frequency of 0.
To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/x86/x86/identcpu.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.32 src/sys/arch/x86/x86/identcpu.c:1.33
--- src/sys/arch/x86/x86/identcpu.c:1.32 Sat Jun 16 13:30:19 2012
+++ src/sys/arch/x86/x86/identcpu.c Wed Jun 26 16:52:28 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: identcpu.c,v 1.32 2012/06/16 17:30:19 chs Exp $ */
+/* $NetBSD: identcpu.c,v 1.33 2013/06/26 20:52:28 christos Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.32 2012/06/16 17:30:19 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.33 2013/06/26 20:52:28 christos Exp $");
#include "opt_xen.h"
@@ -563,6 +563,17 @@ cpu_probe_geode(struct cpu_info *ci)
}
static void
+cpu_probe_qemu(struct cpu_info *ci)
+{
+ if (memcmp("QEMU Virtual CPU", cpu_brand_string, 16) != 0)
+ return;
+
+ /* if QEMU does not implement MSR_TSC, disable the TSC */
+ ci->ci_feat_val[0] &= ~CPUID_MSR;
+ cpu_feature[0] &= ~CPUID_MSR;
+}
+
+static void
cpu_probe_vortex86(struct cpu_info *ci)
{
#define PCI_MODE1_ADDRESS_REG 0x0cf8
@@ -709,6 +720,7 @@ cpu_probe(struct cpu_info *ci)
cpu_probe_c3(ci);
cpu_probe_geode(ci);
cpu_probe_vortex86(ci);
+ cpu_probe_qemu(ci);
x86_cpu_topology(ci);