Skip to contentSkip to conversation

A few fixes for make and cpuid

PATCH Applied Cyrill Gorcunov 5 participants 11 messages May 28, 2013 – Jun 8, 2013 KVM

lore
Share & tools
lore
#0 lore raw

cover A few fixes for make and cpuid

Hi guys, here are a couple of fixes for "make clean" and cpuid filtering. Please give them a shot.

#1 lore raw

PATCH 1/2 tools: lkvm - Dont generate deps and verion file on clean target

This is redundant since we're to remove them right after being generated.

CC Ingo Molnar <[email protected]>
CC Pekka Enberg <[email protected]>
CC Sasha Levin <[email protected]>
CC Asias He <[email protected]>
---
 tools/kvm/Makefile |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
tools/kvm/Makefile +8 -5
Index: linux-2.6.git/tools/kvm/Makefile
===================================================================
@@ -324,10 +324,6 @@ all: arch_support_check $(PROGRAM) $(PRO
 arch_support_check:
 	$(UNSUPP_ERR)
 
-KVMTOOLS-VERSION-FILE:
-	@$(SHELL_PATH) util/KVMTOOLS-VERSION-GEN $(OUTPUT)
--include $(OUTPUT)KVMTOOLS-VERSION-FILE
-
 # When building -static all objects are built with appropriate flags, which
 # may differ between static & dynamic .o.  The objects are separated into
 # .o and .static.o.  See the %.o: %.c rules below.
@@ -504,5 +500,12 @@ cscope:
 	$(Q) $(CSCOPE) -bkqu
 .PHONY: cscope
 
-# Deps
+#
+# Escape redundant work on cleaning up
+ifneq ($(MAKECMDGOALS),clean)
 -include $(DEPS)
+
+KVMTOOLS-VERSION-FILE:
+	@$(SHELL_PATH) util/KVMTOOLS-VERSION-GEN $(OUTPUT)
+-include $(OUTPUT)KVMTOOLS-VERSION-FILE
+endif
#2 lore raw

PATCH 2/2 tools: lkvm - Filter out cpu vendor string

In reply to Cyrill Gorcunov

If cpuvendor string is not filetered in case of host amd machine we get unhandled msr reads

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

thus provide own string and kernel will use generic cpu init.

---
 tools/kvm/x86/cpuid.c |    8 ++++++++
 1 file changed, 8 insertions(+)
tools/kvm/x86/cpuid.c +8 -0
Index: linux-2.6.git/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_cpui
 		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)
#3 lore raw

Re: [patch 2/2] tools: lkvm - Filter out cpu vendor string

Quoted 34 lines · Cyrill Gorcunov

If cpuvendor string is not filetered in case of host amd machine we get unhandled msr reads

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

thus provide own string and kernel will use generic cpu init.

---
 tools/kvm/x86/cpuid.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Index: linux-2.6.git/tools/kvm/x86/cpuid.c
===================================================================

tools/kvm/x86/cpuid.c +1 -0
@@ -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_cpui
                struct kvm_cpuid_entry2 *entry = &kvm_cpuid->entries[i];
 
                switch (entry->function) {

tools/kvm/x86/cpuid.c static void filter_cpuid(struct kvm_cpui · line 34

Quoted 10 lines
tools/kvm/x86/cpuid.c +7 -0
+               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)

Ping! Is there someone out there who has a AMD box they could test this on?

#4 lore raw

Re: [patch 2/2] tools: lkvm - Filter out cpu vendor string

Quoted 4 lines · Pekka Enberg
Quoted 2 lines
                        /* Set X86_FEATURE_HYPERVISOR */
                        if (entry->index == 0)

Ping! Is there someone out there who has a AMD box they could test this on?

I don't have it, sorry :-(

#5 lore raw

Re: [patch 2/2] tools: lkvm - Filter out cpu vendor string

In reply to Pekka Enberg
Quoted 34 lines · Pekka Enberg
Quoted 33 lines · Cyrill Gorcunov

If cpuvendor string is not filetered in case of host amd machine we get unhandled msr reads

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

thus provide own string and kernel will use generic cpu init.

---
 tools/kvm/x86/cpuid.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Index: linux-2.6.git/tools/kvm/x86/cpuid.c
===================================================================

tools/kvm/x86/cpuid.c +1 -0
@@ -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_cpui
                struct kvm_cpuid_entry2 *entry = &kvm_cpuid->entries[i];
 
Quoted 13 lines

tools/kvm/x86/cpuid.c static void filter_cpuid(struct kvm_cpui · line 34

Quoted 11 lines
tools/kvm/x86/cpuid.c +7 -0
                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)

Ping! Is there someone out there who has a AMD box they could test this on?

I will try to find one.

--
Asias

#6 lore raw

Re: [patch 2/2] tools: lkvm - Filter out cpu vendor string

In reply to Pekka Enberg
Quoted 34 lines · Pekka Enberg
Quoted 33 lines · Cyrill Gorcunov

If cpuvendor string is not filetered in case of host amd machine we get unhandled msr reads

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

thus provide own string and kernel will use generic cpu init.

---
 tools/kvm/x86/cpuid.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Index: linux-2.6.git/tools/kvm/x86/cpuid.c
===================================================================

tools/kvm/x86/cpuid.c +1 -0
@@ -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_cpui
                struct kvm_cpuid_entry2 *entry = &kvm_cpuid->entries[i];
 
Quoted 13 lines

tools/kvm/x86/cpuid.c static void filter_cpuid(struct kvm_cpui · line 34

Quoted 11 lines
tools/kvm/x86/cpuid.c +7 -0
                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)

Ping! Is there someone out there who has a AMD box they could test this on?

I tested it on AMD box. Guest boots with this patch, guest does not boot without it. I am not seeing the msr warning in both cases.

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Asias

#7 lore raw

Re: [patch 2/2] tools: lkvm - Filter out cpu vendor string

Quoted 4 lines · Asias He
Quoted 1 line

Ping! Is there someone out there who has a AMD box they could test this on?

I tested it on AMD box. Guest boots with this patch, guest does not boot without it. I am not seeing the msr warning in both cases.

That's pretty interesting. Can you please provide your /proc/cpuinfo so I can include it in the changelog?

Pekka

#8 lore raw

Re: [patch 2/2] tools: lkvm - Filter out cpu vendor string

Quoted 8 lines · Pekka Enberg
Quoted 4 lines · Asias He
Quoted 1 line

Ping! Is there someone out there who has a AMD box they could test this on?

I tested it on AMD box. Guest boots with this patch, guest does not boot without it. I am not seeing the msr warning in both cases.

That's pretty interesting. Can you please provide your /proc/cpuinfo so I can include it in the changelog?

Indeed. Here you go:

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

Signature · 1 line
Asias
#9 lore raw

Re: [patch 2/2] tools: lkvm - Filter out cpu vendor string

Quoted 38 lines · Asias He
Quoted 8 lines · Pekka Enberg
Quoted 4 lines · Asias He
Quoted 1 line

Ping! Is there someone out there who has a AMD box they could test this on?

I tested it on AMD box. Guest boots with this patch, guest does not boot without it. I am not seeing the msr warning in both cases.

That's pretty interesting. Can you please provide your /proc/cpuinfo so I can include it in the changelog?

Indeed. Here you go:

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

Quoted 8 lines

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

And in guest:

# cat /proc/cpuinfo 
processor	: 0
vendor_id	: LKVMLKVMLKVM
cpu family	: 21
model		: 1
model name	: 15/01
stepping	: 2
cpu MHz		: 0.000
cache size	: 0 KB
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 syscall nx mmxext fxsr_opt
pdpe1gb lm nopl pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes
xsave avx hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a
misalignsse 3dnowprefetch osvw xop fma4 npt nrip_save tsc_adjust
bogomips	: 1340.41
clflush size	: 64
cache_alignment	: 64
address sizes	: 48 bits physical, 48 bits virtual
power management:
Signature · 1 line
Asias
Applied
#10 lore raw

Re: [patch 2/2] tools: lkvm - Filter out cpu vendor string

Applied, thanks a lot!