[tip:tools/kvm] kvm tools: Filter out CPU vendor string

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

 



Commit-ID:  06c17025e2997acfc1bb25d251d1fc205c0807c4
Gitweb:     http://git.kernel.org/tip/06c17025e2997acfc1bb25d251d1fc205c0807c4
Author:     Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
AuthorDate: Tue, 28 May 2013 15:49:44 +0400
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Sat, 8 Jun 2013 14:29:01 +0300

kvm tools: Filter out CPU vendor string

Ingo Molnar reports unhandled MSR reads on an AMD machine:

  [1709265.368464] kvm: 25706: cpu6 unhandled rdmsr: 0xc0010048
  [1709265.397161] kvm: 25706: cpu7 unhandled rdmsr: 0xc0010048
  [1709265.425774] kvm: 25706: cpu8 unhandled rdmsr: 0xc0010048

  processor       : 11
  vendor_id       : AuthenticAMD
  cpu family      : 16
  model           : 8
  model name      : AMD Engineering Sample
  stepping        : 0
  cpu MHz         : 2400.000
  cache size      : 512 KB
  physical id     : 1
  siblings        : 6
  core id         : 5
  cpu cores       : 6
  apicid          : 21
  initial apicid  : 13
  fpu             : yes
  fpu_exception   : yes
  cpuid level     : 5
  wp              : yes
  flags           : fpu vme de pse tsc msr pae mce cx8 apic sep
  mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall
  nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc
  rep_good nopl nonstop_tsc extd_apicid pni monitor cx16 popcnt
  lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse
  3dnowprefetch osvw ibs skinit wdt hw_pstate npt lbrv svm_lock
  nrip_save pausefilter
  bogomips        : 4800.01
  TLB size        : 1024 4K pages
  clflush size    : 64
  cache_alignment : 64
  address sizes   : 48 bits physical, 48 bits virtual
  power management: ts ttp tm stc 100mhzsteps hwpstate

and Asias He reports guest not booting on an AMD machine:

  processor       : 0
  vendor_id       : AuthenticAMD
  cpu family      : 21
  model           : 1
  model name      : AMD Opteron(TM) Processor 6274
  stepping        : 2
  microcode       : 0x6000626
  cpu MHz         : 2200.034
  cache size      : 2048 KB
  physical id     : 0
  siblings        : 16
  core id         : 0
  cpu cores       : 8
  apicid          : 32
  initial apicid  : 0
  fpu             : yes
  fpu_exception   : yes
  cpuid level     : 13
  wp              : yes
  flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
  mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext
  fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc
  extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor ssse3 cx16 sse4_1
  sse4_2 popcnt aes xsave avx lahf_lm cmp_legacy svm extapic cr8_legacy
  abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4
  nodeid_msr topoext perfctr_core perfctr_nb arat cpb hw_pstate npt lbrv
  svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists
  pausefilter pfthreshold
  bogomips        : 4400.06
  TLB size        : 1536 4K pages
  clflush size    : 64
  cache_alignment : 64
  address sizes   : 48 bits physical, 48 bits virtual
  power management: ts ttp tm 100mhzsteps hwpstate cpb

If CPU vendor string is not filetered in case of host AMD machine we get
unhandled MSR reads. Thus provide own string and kernel will use generic
CPU init.

Reported-by: Ingo Molnar <mingo@xxxxxxxxxx>
CC: Sasha Levin <sasha.levin@xxxxxxxxxx>
Tested-by: Asias He <asias@xxxxxxxxxx>
Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
[ penberg@xxxxxxxxxx: improve changelog ]
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/x86/cpuid.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/kvm/x86/cpuid.c b/tools/kvm/x86/cpuid.c
index 4c140f0..72ab983 100644
--- a/tools/kvm/x86/cpuid.c
+++ b/tools/kvm/x86/cpuid.c
@@ -12,6 +12,7 @@
 
 static void filter_cpuid(struct kvm_cpuid2 *kvm_cpuid)
 {
+	unsigned int signature[3];
 	unsigned int i;
 
 	/*
@@ -21,6 +22,13 @@ static void filter_cpuid(struct kvm_cpuid2 *kvm_cpuid)
 		struct kvm_cpuid_entry2 *entry = &kvm_cpuid->entries[i];
 
 		switch (entry->function) {
+		case 0:
+			/* Vendor name */
+			memcpy(signature, "LKVMLKVMLKVM", 12);
+			entry->ebx = signature[0];
+			entry->ecx = signature[1];
+			entry->edx = signature[2];
+			break;
 		case 1:
 			/* Set X86_FEATURE_HYPERVISOR */
 			if (entry->index == 0)
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux