[ kvm-Bugs-2960363 ] KVM_GET_SREGS ioctl fails due to "Invalid Argument" in glibc

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

 



Bugs item #2960363, was opened at 2010-02-27 12:09
Message generated for change (Tracker Item Submitted) made by zsalwasser
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=893831&aid=2960363&group_id=180599

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: kernel
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Zac Salwasser (zsalwasser)
Assigned to: Nobody/Anonymous (nobody)
Summary: KVM_GET_SREGS ioctl fails due to "Invalid Argument" in glibc

Initial Comment:
cpu vendor type:
vendor_id	: GenuineIntel
cpu family	: 6
model		: 26
model name	: Intel(R) Xeon(R) CPU           E5504  @ 2.00GHz
stepping	: 5
cpu MHz		: 1999.713
cache size	: 4096 KB
(8 cores)

host distribution:
Debian 5 stable
Linux iQCortex-2 2.6.32-2-686-bigmem #1 SMP Thu Feb 11 04:55:32 UTC 2010 i686 GNU/Linux

versions:
Linux 2.6.32-8
kvm-kmod 2.6.32.8
qemu-kvm 0.12.2

bitness:
32 (PAE enabled host)

guest:
32 bit Windows XP SP3, no PAE

I have been having trouble with reading the extended registers
normally read by kvm_get_sregs() on host kernels ~2.6.32 and higher.

I am currently running Linux 2.6.32-8, kvm-kmod 2.6.32.8, and qemu 0.12.2.

I get the following output when I try info registers on the qemu console:

(qemu) info registers
EAX=6d63c93d EBX=ffdffc70 ECX=ffdffc70 EDX=00000000
ESI=ffdffc50 EDI=823e7b68 EBP=80550f50 ESP=80550f34
EIP=f8621d3e EFL=00000246 [---Z-P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =3d65 00001000 b772bdf8 3fffe800 DPL=3 Reserved
CS =4fe1 b7d59ff4 b7d5b3a0 6b300100
SS =0000 b772bde8 0847ab38 6f300a00
DS =b3d0 b7d5b3cc 00000000 7bffd500 DPL=2 DS   [E-A]
FS =e008 b7d5b3a0 b7d59ff4 005bb900 DPL=1 CS32 [--A]
GS =ffff ffffffff 00000007 7fffff00 DPL=3 CS64 [CRA]
LDT=9ff4 b772bde0 00000008 7ffff500 DPL=3 DS   [E-A]
TR =0000 00000080 b7fb63ab 00f00000
GDT=     00014fe1 00000100
IDT=     b7d5b3cc 0000b3d0
CR0=08000101 CR2=00002000 CR3=00000000 CR4=08000101
DR0=00000000 DR1=00000000 DR2=00000000 DR3=00000000
DR6=ffff0ff0 DR7=00000000
FCW=027f FSW=0000 [ST=0] FTW=00 MXCSR=00000000
FPR0=0000000000000000 ffff FPR1=00ff00ff00ff00ff ffff
FPR2=0000000000000000 ffff FPR3=00fe000d009900ee ffff
FPR4=ff0d9aefff6a604c ffff FPR5=00ff000d009a00ef ffff
FPR6=0000000000000000 ffff FPR7=0080008000800080 ffff
XMM00=
00000020000000000000000000000001 XMM01=81181ab88055f980e115d00000000020
XMM02=f79092a481181ab8c03845740dd1d000 XMM03=81181ab8c03845740000016d804e93e0
XMM04=c0384574000000000000000100000000 XMM05=e1150000804e7e36f790931400000000
XMM06=806f02980000000000000000c0384574 XMM07=000000028055f62000000080c0384574

Note that cr3 is 0, which doesn't seem possible.  The contents of the
sregs is also static across invocations of info registers (whereas the
"regs" chang), indicating that the values that are there are garbage.

Delving deeper, when I check actual invocations of kvm_get_sregs(), it
usually returns either 0 or -22, neither value indicating success.

I added some debug output to kvm-all.c and obtained the following example states for kvm_get_regs (which works) and kvm_get_sregs (which doesn't):
(kvm_get_regs): kvm_vcpu_ioctl = 0x808ccad
 1: (kvm_vcpu_ioctl/KVM_GET_REGS): kvm_vcpu_ioctl = 0x808ccad
 2: (kvm_vcpu_ioctl/KVM_GET_REGS): ioctl = 0x8069134, env->kvm_fd = 13, type = -2138001791, arg = 0xb532afb8
 3: (kvm_vcpu_ioctl/KVM_GET_REGS): ret = 0, errno = 4 (Interrupted system call)
 (kvm_get_sregs): kvm_vcpu_ioctl = 0x808ccad
 1: (kvm_vcpu_ioctl/KVM_GET_SREGS): kvm_vcpu_ioctl = 0x808ccad
 2: (kvm_vcpu_ioctl/KVM_GET_SREGS): ioctl = 0x8069134, env->kvm_fd = 13, type = -2126991741, arg = 0xb532ace0
 3: (kvm_vcpu_ioctl/KVM_GET_SREGS): ret = -1, errno = 22 (Invalid argument)

Basically, it seems like the ioctl never comes out the other side of glibc.  Ordinarily, the call goes something like this:
kvm_get_sregs->kvm_vcpu_ioctl(kvm-all.c:1950)->ioctl(glibc)->kvm_vcpu_ioctl(kvm_main.c:1930)->kvm_arch_vcpu_ioctl_get_sregs(?)

But the call never gets to kvm_vcpu_ioctl(kvm_main.c:1930), because glibc appears to be rejecting the call to ioctl for having an invalid argument.

I've got

if (ioctl == KVM_GET_SREGS) {
    printk(KERN_INFO "ZTS: ioctl == KVM_GET_SREGS (%x)\n", ioctl);
}

In kvm_vcpu_ioctl(kvm_main.c:1930) and I never see that message printed on dmesg, so I know that kvm_vcpu_ioctl(kvm_main.c:1930) is never being called with KVM_GET_SREGS as an argument.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=893831&aid=2960363&group_id=180599
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux