* [Bug 77271] New: CPUID Leaf 0x40000000 return 0 in eax
@ 2014-06-03 19:48 bugzilla-daemon
2014-06-03 20:44 ` [Bug 77271] " bugzilla-daemon
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: bugzilla-daemon @ 2014-06-03 19:48 UTC (permalink / raw)
To: kvm
https://bugzilla.kernel.org/show_bug.cgi?id=77271
Bug ID: 77271
Summary: CPUID Leaf 0x40000000 return 0 in eax
Product: Virtualization
Version: unspecified
Kernel Version: 3.14
Hardware: All
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: kvm
Assignee: virtualization_kvm@kernel-bugs.osdl.org
Reporter: jidong.xiao@gmail.com
Regression: No
I am using kernel 3.14 as the host OS. And using 2.6.34 as the guest OS kernel.
According to
https://github.com/torvalds/linux/commit/57c22e5f35aa4b9b2fe11f73f3e62bbf9ef36190
Since kernel 3.5, the cpuid instruction (in the Guest OS) with 0x40000000
function should return 0x40000001 in eax, instead of 0. But what I am seeing
is, it still returns 0.
To reproduce, use a program like this, run it in the Guest:
linux:~/code # cat cpusig.c
#include <stdio.h>
#define cpuid(func,eax,ebx,ecx,edx)\
__asm__ __volatile__ ("cpuid":\
"=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (func));
main()
{
unsigned long a,b,c,d;
cpuid(0x40000000,a,b,c,d);
printf("0x40000000 KVM_CPUID_SIGNATURE %lx %lx %lx %lx\n",a,b,c,d);
}
What I saw is:
linux:~/code # ./cpusig
0x40000000 KVM_CPUID_SIGNATURE 0 4b4d564b 564b4d56 4d
It looks like ebx,ecx,edx all contain right values, but eax does not.
--
You are receiving this mail because:
You are watching the assignee of the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug 77271] CPUID Leaf 0x40000000 return 0 in eax
2014-06-03 19:48 [Bug 77271] New: CPUID Leaf 0x40000000 return 0 in eax bugzilla-daemon
@ 2014-06-03 20:44 ` bugzilla-daemon
2014-06-04 0:28 ` bugzilla-daemon
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: bugzilla-daemon @ 2014-06-03 20:44 UTC (permalink / raw)
To: kvm
https://bugzilla.kernel.org/show_bug.cgi?id=77271
Alex Williamson <alex.williamson@redhat.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |alex.williamson@redhat.com
--- Comment #1 from Alex Williamson <alex.williamson@redhat.com> ---
Further up in cpuid.txt is the statement:
"This is not always guaranteed to work, since userspace can
mask-out some, or even all KVM-related cpuid features before launching
a guest."
Which is exactly what is happening here. QEMU sets eax = 0 for this leaf:
target-i386/kvm.c
memcpy(signature, "KVMKVMKVM\0\0\0", 12);
c = &cpuid_data.entries[cpuid_i++];
c->function = KVM_CPUID_SIGNATURE | kvm_base;
c->eax = 0;
c->ebx = signature[0];
c->ecx = signature[1];
c->edx = signature[2];
So I don't think there's a bug here.
--
You are receiving this mail because:
You are watching the assignee of the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug 77271] CPUID Leaf 0x40000000 return 0 in eax
2014-06-03 19:48 [Bug 77271] New: CPUID Leaf 0x40000000 return 0 in eax bugzilla-daemon
2014-06-03 20:44 ` [Bug 77271] " bugzilla-daemon
@ 2014-06-04 0:28 ` bugzilla-daemon
2014-06-04 0:36 ` bugzilla-daemon
2014-06-04 1:11 ` bugzilla-daemon
3 siblings, 0 replies; 5+ messages in thread
From: bugzilla-daemon @ 2014-06-04 0:28 UTC (permalink / raw)
To: kvm
https://bugzilla.kernel.org/show_bug.cgi?id=77271
--- Comment #2 from Jidong Xiao <jidong.xiao@gmail.com> ---
Oh, thanks Alex. I think you are right here, it's not a bug. But do you think
that, does it make sense to submit a patch to qemu, so as to make them
consistent between userspace qemu and the kernel side kvm? Like this:
diff --git a/qemu-2.0.0/target-i386/kvm.c.orig b/qemu-2.0.0/target-i386/kvm.c
index 4389959..b8b282d 100644
--- a/qemu-2.0.0/target-i386/kvm.c.orig
+++ b/qemu-2.0.0/target-i386/kvm.c
@@ -530,7 +530,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
memcpy(signature, "KVMKVMKVM\0\0\0", 12);
c = &cpuid_data.entries[cpuid_i++];
c->function = KVM_CPUID_SIGNATURE | kvm_base;
- c->eax = 0;
+ c->eax = KVM_CPUID_FEATURES;
c->ebx = signature[0];
c->ecx = signature[1];
c->edx = signature[2];
--
You are receiving this mail because:
You are watching the assignee of the bug.
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Bug 77271] CPUID Leaf 0x40000000 return 0 in eax
2014-06-03 19:48 [Bug 77271] New: CPUID Leaf 0x40000000 return 0 in eax bugzilla-daemon
2014-06-03 20:44 ` [Bug 77271] " bugzilla-daemon
2014-06-04 0:28 ` bugzilla-daemon
@ 2014-06-04 0:36 ` bugzilla-daemon
2014-06-04 1:11 ` bugzilla-daemon
3 siblings, 0 replies; 5+ messages in thread
From: bugzilla-daemon @ 2014-06-04 0:36 UTC (permalink / raw)
To: kvm
https://bugzilla.kernel.org/show_bug.cgi?id=77271
--- Comment #3 from Alex Williamson <alex.williamson@redhat.com> ---
The best way to find out is to submit a patch.
--
You are receiving this mail because:
You are watching the assignee of the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug 77271] CPUID Leaf 0x40000000 return 0 in eax
2014-06-03 19:48 [Bug 77271] New: CPUID Leaf 0x40000000 return 0 in eax bugzilla-daemon
` (2 preceding siblings ...)
2014-06-04 0:36 ` bugzilla-daemon
@ 2014-06-04 1:11 ` bugzilla-daemon
3 siblings, 0 replies; 5+ messages in thread
From: bugzilla-daemon @ 2014-06-04 1:11 UTC (permalink / raw)
To: kvm
https://bugzilla.kernel.org/show_bug.cgi?id=77271
Jidong Xiao <jidong.xiao@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |INVALID
--- Comment #4 from Jidong Xiao <jidong.xiao@gmail.com> ---
Great, thank Alex, I have submitted a patch to Qemu, I think this ticket can be
closed now.
--
You are receiving this mail because:
You are watching the assignee of the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-06-04 1:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-03 19:48 [Bug 77271] New: CPUID Leaf 0x40000000 return 0 in eax bugzilla-daemon
2014-06-03 20:44 ` [Bug 77271] " bugzilla-daemon
2014-06-04 0:28 ` bugzilla-daemon
2014-06-04 0:36 ` bugzilla-daemon
2014-06-04 1:11 ` bugzilla-daemon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox