kvm-tools: can't seem to set guest_mac and KVM_GET_SUPPORTED_CPUID failed.
There was a patch (quoted below) that changed networking at the end of September. When I try to set the guest_mac from the usage in the patch and an admittaly too brief a look at the code, the guest's mac address isn't being set. I'm using:
sudo /path/to/linux-kvm/tools/kvm/kvm run -c 1 -m 256 -k /path/to/bzImage-3.0.8 \
-i /path/to/initramfs-host.img --console serial -p ' console=ttyS0 ' -n tap,guest_mac=00:11:11:11:11:11
In the guest I get:
# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 02:15:15:15:15:15
inet addr:192.168.122.237 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:24 errors:0 dropped:2 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1874 (1.8 KiB) TX bytes:656 (656.0 B)which is the default.
Also, when I start the guest I sometimes get the following error message:
# kvm run -k /path/to/bzImage-3.0.8 -m 256 -c 1 --name guest-15757 KVM_GET_SUPPORTED_CPUID failed: Argument list too long
I haven't seen that before.
Thanks,
\dae
Quoted 9 lines · Sasha Levin
This patch adds support for multiple network devices. The command line syntax changes to the following:
--network/-n [mode=[tap/user/none]] [guest_ip=[guest ip]] [host_ip=[
host_ip]] [guest_mac=[guest_mac]] [script=[script]]Each of the parameters is optional, and the config defaults to a TAP based networking with a random MAC.
...
Quoted 19 lines · David Evensky
There was a patch (quoted below) that changed networking at the end of September. When I try to set the
guest_macfrom the usage in the patch and an admittaly too brief a look at the code, the guest's mac address isn't being set. I'm using:sudo /path/to/linux-kvm/tools/kvm/kvm run -c 1 -m 256 -k /path/to/bzImage-3.0.8 \ -i /path/to/initramfs-host.img --console serial -p ' console=ttyS0 ' -n tap,guest_mac=00:11:11:11:11:11In the guest I get:
# ifconfig eth0 eth0 Link encap:Ethernet HWaddr 02:15:15:15:15:15 inet addr:192.168.122.237 Bcast:192.168.122.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:24 errors:0 dropped:2 overruns:0 frame:0 TX packets:2 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1874 (1.8 KiB) TX bytes:656 (656.0 B)
Quoted 1 line
which is the default.
This should be '-n mode=tap,guest_mac=00:11:11:11:11:11'
It will set the right mac:
sh-2.05b# ifconfig
eth0 Link encap:Ethernet HWaddr 00:11:11:11:11:11
[...]
Quoted 5 lines
Also, when I start the guest I sometimes get the following error message:
# kvm run -k /path/to/bzImage-3.0.8 -m 256 -c 1 --name guest-15757 KVM_GET_SUPPORTED_CPUID failed: Argument list too long
Heh, we were talking about it couple of weeks ago, but since I couldn't reproduce it here (it was happening to me before, but now it's gone) the discussing died.
Could you please provide some statistics on how often it happens to you? Also, can you try wrapping the ioctl with a 'while (1)' (theres only 1 ioctl call to KVM_GET_SUPPORTED_CPUID) and see if it would happen at some point?
Thanks!
Quoted 20 lines
I haven't seen that before.
Thanks,
\daeQuoted 9 lines · Sasha Levin
This patch adds support for multiple network devices. The command line syntax changes to the following:
--network/-n [mode=[tap/user/none]] [guest_ip=[guest ip]] [host_ip=[
host_ip]] [guest_mac=[guest_mac]] [script=[script]]Each of the parameters is optional, and the config defaults to a TAP based networking with a random MAC.
...--
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
Signature · 1 line
Sasha.
Quoted 5 lines · Sasha Levin
Quoted 4 lines
Also, when I start the guest I sometimes get the following error message:
# kvm run -k /path/to/bzImage-3.0.8 -m 256 -c 1 --name guest-15757 KVM_GET_SUPPORTED_CPUID failed: Argument list too long
Quoted 8 lines
Heh, we were talking about it couple of weeks ago, but since I couldn't reproduce it here (it was happening to me before, but now it's gone) the discussing died.
Could you please provide some statistics on how often it happens to you? Also, can you try wrapping the ioctl with a 'while (1)' (theres only 1 ioctl call to
KVM_GET_SUPPORTED_CPUID) and see if it would happen at some point?
I'm no longer able to reproduce it here with 3.2-rc1. We could just try the easy way out and do what Qemu does and retry for E2BIG...
Quoted 10 lines · Pekka Enberg
Quoted 9 lines · Sasha Levin
Quoted 4 lines
Also, when I start the guest I sometimes get the following error message:
# kvm run -k /path/to/bzImage-3.0.8 -m 256 -c 1 --name guest-15757 KVM_GET_SUPPORTED_CPUID failed: Argument list too longHeh, we were talking about it couple of weeks ago, but since I couldn't reproduce it here (it was happening to me before, but now it's gone) the discussing died.
Quoted 7 lines
Quoted 4 lines
Could you please provide some statistics on how often it happens to you? Also, can you try wrapping the ioctl with a 'while (1)' (theres only 1 ioctl call to
KVM_GET_SUPPORTED_CPUID) and see if it would happen at some point?I'm no longer able to reproduce it here with 3.2-rc1. We could just try the easy way out and do what Qemu does and retry for E2BIG...
Let's not do that :)
It'll just get uncovered again when someone decides to use KVM_GET_SUPPORTED_CPUID somewhere else (like in Avi's cpuid patch).
I'll try going back to <3.0 later today and see if it comes back.
David, which host kernel do you use?
Signature · 1 line
Sasha.
Quoted 16 lines · Sasha Levin
Quoted 15 lines · Pekka Enberg
Quoted 13 lines · Sasha Levin
Quoted 4 lines
Also, when I start the guest I sometimes get the following error message:
# kvm run -k /path/to/bzImage-3.0.8 -m 256 -c 1 --name guest-15757 KVM_GET_SUPPORTED_CPUID failed: Argument list too longHeh, we were talking about it couple of weeks ago, but since I couldn't reproduce it here (it was happening to me before, but now it's gone) the discussing died.
Could you please provide some statistics on how often it happens to you? Also, can you try wrapping the ioctl with a 'while (1)' (theres only 1 ioctl call to
KVM_GET_SUPPORTED_CPUID) and see if it would happen at some point?
Quoted 4 lines
Quoted 2 lines
I'm no longer able to reproduce it here with 3.2-rc1. We could just try the easy way out and do what Qemu does and retry for E2BIG...
Let's not do that :)
Right :)
Quoted 4 lines
It'll just get uncovered again when someone decides to use
KVM_GET_SUPPORTED_CPUIDsomewhere else (like in Avi's cpuid patch).I'll try going back to <3.0 later today and see if it comes back.
It might be worthwhile to write a small program that only does KVM_GET_SUPPORTED_CPUID, to rule out issues in userspace (though there isn't much of a window for such issues).
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 24 lines · Avi Kivity
Quoted 16 lines · Sasha Levin
Quoted 15 lines · Pekka Enberg
Quoted 13 lines · Sasha Levin
Quoted 4 lines
Also, when I start the guest I sometimes get the following error message:
# kvm run -k /path/to/bzImage-3.0.8 -m 256 -c 1 --name guest-15757 KVM_GET_SUPPORTED_CPUID failed: Argument list too longHeh, we were talking about it couple of weeks ago, but since I couldn't reproduce it here (it was happening to me before, but now it's gone) the discussing died.
Could you please provide some statistics on how often it happens to you? Also, can you try wrapping the ioctl with a 'while (1)' (theres only 1 ioctl call to
KVM_GET_SUPPORTED_CPUID) and see if it would happen at some point?Quoted 4 lines
Quoted 2 lines
I'm no longer able to reproduce it here with 3.2-rc1. We could just try the easy way out and do what Qemu does and retry for E2BIG...
Let's not do that :)
Right :)
Quoted 8 lines
Quoted 4 lines
It'll just get uncovered again when someone decides to use
KVM_GET_SUPPORTED_CPUIDsomewhere else (like in Avi's cpuid patch).I'll try going back to <3.0 later today and see if it comes back.
It might be worthwhile to write a small program that only does
KVM_GET_SUPPORTED_CPUID, to rule out issues in userspace (though there isn't much of a window for such issues).
Heh... It actually discovered a different (minor) issue there, and a documentation error as well.
I'll send patches in a bit.
Signature · 1 line
Sasha.
Quoted 6 lines · Sasha Levin
Quoted 2 lines · Pekka Enberg
Quoted 1 line · Sasha Levin
Quoted 1 line
Also, when I start the guest I sometimes get the following error message:
....
David, which host kernel do you use?
I'm using the kernel that ships with Debian Sid, which I last booted as 3.0.0-2-amd64. My guest kernel is a 32bit kernel built from kernel.org's linux-3.0.8.
Quoted 9 lines
Signature · 8 lines
-- Sasha. -- 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
Quoted 10 lines · David Evensky
Quoted 6 lines · Sasha Levin
Quoted 2 lines · Pekka Enberg
Quoted 1 line · Sasha Levin
Quoted 1 line
Also, when I start the guest I sometimes get the following error message:
....
David, which host kernel do you use?
I'm using the kernel that ships with Debian Sid, which I last booted as 3.0.0-2-amd64. My guest kernel is a 32bit kernel built from kernel.org's linux-3.0.8.
Hm... This should be new enough...
Could you please try compiling and running the code below several times and see if you get an error message? This should help us understand if it's a usermode or a kernel issue.
Thanks!
------------ cut here---------------
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <linux/kvm.h>
int main(void)
{
struct kvm_cpuid2 *cpuid;
int kvm, r = 0;
kvm = open("/dev/kvm", O_RDWR);
cpuid = malloc(sizeof(*cpuid) + sizeof(struct kvm_cpuid_entry2) * 100);
cpuid->nent = 100;
r = ioctl(kvm, KVM_GET_SUPPORTED_CPUID, cpuid);
if (r)
printf("KVM_GET_SUPPORTED_CPUID returned %d with errno %d\n", r, errno);
else
printf("Returned entries: %d\n", cpuid->nent);
free(cpuid);
close(kvm);
return 0;
}Signature · 1 line
Sasha.
It prints 'Returned entries: 31'
\dae
Quoted 57 lines · Sasha Levin
Quoted 10 lines · David Evensky
Quoted 6 lines · Sasha Levin
Quoted 2 lines · Pekka Enberg
Quoted 1 line · Sasha Levin
Quoted 1 line
Also, when I start the guest I sometimes get the following error message:
....
David, which host kernel do you use?
I'm using the kernel that ships with Debian Sid, which I last booted as 3.0.0-2-amd64. My guest kernel is a 32bit kernel built from kernel.org's linux-3.0.8.
Hm... This should be new enough...
Could you please try compiling and running the code below several times and see if you get an error message? This should help us understand if it's a usermode or a kernel issue.
Thanks!
------------ cut here---------------
#include <
stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <linux/kvm.h>int main(void)
{ struct kvm_cpuid2 *cpuid; int kvm, r = 0; kvm = open("/dev/kvm", O_RDWR); cpuid = malloc(sizeof(*cpuid) + sizeof(struct kvm_cpuid_entry2) * 100); cpuid->nent = 100; r = ioctl(kvm, KVM_GET_SUPPORTED_CPUID, cpuid); if (r) printf("KVM_GET_SUPPORTED_CPUID returned %d with errno %d\n", r, errno); else printf("Returned entries: %d\n", cpuid->nent); free(cpuid); close(kvm); return 0; }Signature · 6 lines
Sasha. -- 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
Quoted 2 lines · David Evensky
It prints 'Returned entries: 31'
\dae
Thats the OK scenario, could you run it several times to see if you can trigger it to print something else?
Signature · 1 line
Sasha.
Quoted 6 lines · Sasha Levin
Quoted 2 lines · David Evensky
It prints 'Returned entries: 31'
\daeThats the OK scenario, could you run it several times to see if you can trigger it to print something else?
Maybe with 'taskset' to get it to run on different cpus?
In a loop please.
Signature · 1 line
error compiling committee.c: too many arguments to function
evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..100000){ $o=`./4sasha`; chomp($o); $histogram{$o}++}; for $o (keys %histogram){print "$o: $histogram{$o}\n"}'
Returned entries: 31: 99987
Returned entries: 56: 1
KVM_GET_SUPPORTED_CPUID returned -1 with errno 7: 8
Returned entries: 37: 4\dae
Quoted 15 lines · Avi Kivity
Quoted 6 lines · Sasha Levin
Quoted 2 lines · David Evensky
It prints 'Returned entries: 31'
\daeThats the OK scenario, could you run it several times to see if you can trigger it to print something else?
Maybe with 'taskset' to get it to run on different cpus?
In a loop please.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 6 lines · David Evensky
evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..100000){ $o=`./4sasha`; chomp($o); $histogram{$o}++}; for $o (keys %histogram){print "$o: $histogram{$o}\n"}'
Returned entries: 31: 99987
Returned entries: 56: 1
KVM_GET_SUPPORTED_CPUID returned -1 with errno 7: 8
Returned entries: 37: 4Awesome, thanks!
So it's a kernel thing.
Quoted 8 lines · David Evensky
evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..100000){ $o=`./4sasha`; chomp($o); $histogram{$o}++}; for $o (keys %histogram){print "$o: $histogram{$o}\n"}'
Returned entries: 31: 99987
Returned entries: 56: 1
KVM_GET_SUPPORTED_CPUID returned -1 with errno 7: 8
Returned entries: 37: 4So it seems to be cpu migration related. But there's a get_cpu() in do_cpuid_ent().
What happens if you change ./4sasha to taskset 1 ./4sasha? or 2 4 8 10 20 etc?
Signature · 1 line
error compiling committee.c: too many arguments to function
Avi,
evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..10000){ $o=`taskset 0x01 ./4sasha`; chomp($o); $histogram{$o}++}; for $o (sort keys %histogram){print "$o: $histogram{$o}\n"}'
KVM_GET_SUPPORTED_CPUID returned -1 with errno 7: 3
Returned entries: 31: 9995
Returned entries: 32: 1
Returned entries: 64: 1
evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..10000){ $o=`taskset 0x02 ./4sasha`; chomp($o); $histogram{$o}++}; for $o (sort keys %histogram){print "$o: $histogram{$o}\n"}'
KVM_GET_SUPPORTED_CPUID returned -1 with errno 7: 1
Returned entries: 31: 9999
evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..10000){ $o=`taskset 0x03 ./4sasha`; chomp($o); $histogram{$o}++}; for $o (sort keys %histogram){print "$o: $histogram{$o}\n"}'
KVM_GET_SUPPORTED_CPUID returned -1 with errno 7: 3
Returned entries: 31: 9995
Returned entries: 57: 1
Returned entries: 58: 1
evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..10000){ $o=`taskset 0x04 ./4sasha`; chomp($o); $histogram{$o}++}; for $o (sort keys %histogram){print "$o: $histogram{$o}\n"}'
Returned entries: 31: 10000
evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..10000){ $o=`taskset 0x08 ./4sasha`; chomp($o); $histogram{$o}++}; for $o (sort keys %histogram){print "$o: $histogram{$o}\n"}'
KVM_GET_SUPPORTED_CPUID returned -1 with errno 7: 1
Returned entries: 31: 9998
Returned entries: 54: 1\dae
Quoted 23 lines · Avi Kivity
Quoted 8 lines · David Evensky
evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..100000){ $o=`./4sasha`; chomp($o); $histogram{$o}++}; for $o (keys %histogram){print "$o: $histogram{$o}\n"}' Returned entries: 31: 99987 Returned entries: 56: 1 KVM_GET_SUPPORTED_CPUID returned -1 with errno 7: 8 Returned entries: 37: 4So it seems to be cpu migration related. But there's a
get_cpu()indo_cpuid_ent().What happens if you change
./4sashatotaskset 1 ./4sasha? or 2 4 8 10 20 etc?Signature · 6 lines
error compiling committee.c: too many arguments to function -- 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
Quoted 13 lines · David Evensky
Avi,
evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..10000){ $o=`taskset 0x01 ./4sasha`; chomp($o); $histogram{$o}++}; for $o (sort keys %histogram){print "$o: $histogram{$o}\n"}' KVM_GET_SUPPORTED_CPUID returned -1 with errno 7: 3 Returned entries: 31: 9995 Returned entries: 32: 1 Returned entries: 64: 1 evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..10000){ $o=`taskset 0x02 ./4sasha`; chomp($o); $histogram{$o}++}; for $o (sort keys %histogram){print "$o: $histogram{$o}\n"}' KVM_GET_SUPPORTED_CPUID returned -1 with errno 7: 1 Returned entries: 31: 9999 evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..10000){ $o=`taskset 0x03 ./4sasha`; chomp($o); $histogram{$o}++}; for $o (sort keys %histogram){print "$o: $histogram{$o}\n"}' KVM_GET_SUPPORTED_CPUID returned -1 with errno 7: 3 Returned entries: 31: 9995
Quoted 9 lines
Returned entries: 57: 1
Returned entries: 58: 1
evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..10000){ $o=`taskset 0x04 ./4sasha`; chomp($o); $histogram{$o}++}; for $o (sort keys %histogram){print "$o: $histogram{$o}\n"}'
Returned entries: 31: 10000
evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..10000){ $o=`taskset 0x08 ./4sasha`; chomp($o); $histogram{$o}++}; for $o (sort keys %histogram){print "$o: $histogram{$o}\n"}'
KVM_GET_SUPPORTED_CPUID returned -1 with errno 7: 1
Returned entries: 31: 9998
Returned entries: 54: 1Please run the attached program (which works for me, btw).
Signature · 1 line
error compiling committee.c: too many arguments to function
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <linux/kvm.h>
int main(void)
{
struct kvm_cpuid2 *cpuid;
int kvm, r = 0, i, j;
for (i = 0; i < 1000000; ++i) {
kvm = open("/dev/kvm", O_RDWR);
cpuid = malloc(sizeof(*cpuid) + sizeof(struct kvm_cpuid_entry2) * 100);
cpuid->nent = 100;
r = ioctl(kvm, KVM_GET_SUPPORTED_CPUID, cpuid);
if (r)
printf("KVM_GET_SUPPORTED_CPUID returned %d with errno %d\n", r, errno);
else if (cpuid->nent > 31) {
printf("Returned entries: %d\n", cpuid->nent);
for (j = 0; j < cpuid->nent; ++j) {
struct kvm_cpuid_entry2 *e = &cpuid->entries[j];
printf("func %08x ind %08x flags %08x -> %08x %08x %08x %08x\n",
e->function, e->index, e->flags,
e->eax, e->ebx, e->ecx, e->edx);
}
return 1;
}
free(cpuid);
close(kvm);
}
return 0;
}Avi, sure:
evensky@waltz:~$ gcc supported-cpuid.c -o supported-cpuid evensky@waltz:~$ ./supported-cpuid Returned entries: 37 func 00000000 ind 00000000 flags 00000000 -> 0000000d 756e6547 6c65746e 49656e69 func 00000001 ind 00000000 flags 00000000 -> 000206a7 01100800 16b82203 0f8bfbff func 00000002 ind 00000000 flags 00000006 -> 76035a01 00f0b2ff 00000000 00ca0000 func 00000003 ind 00000000 flags 00000000 -> 00000000 00000000 00000000 00000000 func 00000004 ind 00000000 flags 00000001 -> 1c004121 01c0003f 0000003f 00000000 func 00000004 ind 00000001 flags 00000001 -> 1c004122 01c0003f 0000003f 00000000 func 00000004 ind 00000002 flags 00000001 -> 1c004143 01c0003f 000001ff 00000000 func 00000004 ind 00000003 flags 00000001 -> 1c03c163 03c0003f 00000fff 00000006 func 00000004 ind 00000004 flags 00000001 -> 00000000 00000000 00000000 00000000 func 00000005 ind 00000000 flags 00000000 -> 00000040 00000040 00000003 00021120 func 00000006 ind 00000000 flags 00000000 -> 00000077 00000002 00000009 00000000 func 00000007 ind 00000000 flags 00000000 -> 00000000 00000000 00000000 00000000 func 00000008 ind 00000000 flags 00000000 -> 00000000 00000000 00000000 00000000 func 00000009 ind 00000000 flags 00000000 -> 00000000 00000000 00000000 00000000 func 0000000a ind 00000000 flags 00000000 -> 07300403 00000000 00000000 00000603 func 0000000b ind 00000000 flags 00000001 -> 00000001 00000002 00000100 00000001 func 0000000b ind 00000001 flags 00000001 -> 00000004 00000004 00000201 00000001 func 0000000b ind 00000002 flags 00000001 -> 00000000 00000000 00000002 00000001 func 0000000c ind 00000000 flags 00000000 -> 00000000 00000000 00000000 00000000 func 0000000d ind 00000000 flags 00000001 -> 00000007 00000340 00000340 00000000 func 0000000d ind 00000001 flags 00000001 -> 00000001 00000000 00000000 00000000 func 80000001 ind 00000000 flags 00000000 -> 00000000 00000000 00000001 28100800 func 0000000d ind 00000003 flags 00000001 -> 00000000 00000000 00000000 00000000 func 0000000d ind 00000004 flags 00000001 -> 00000000 00000000 00000000 00000000 func 0000000d ind 00000005 flags 00000001 -> 00000000 00000000 00000000 00000000 func 80000005 ind 00000000 flags 00000000 -> 00000000 00000000 00000000 00000000 func 80000000 ind 00000000 flags 00000000 -> 80000008 00000000 00000000 00000000 func 80000001 ind 00000000 flags 00000000 -> 00000000 00000000 00000001 28100800 func 80000002 ind 00000000 flags 00000000 -> 20202020 49202020 6c65746e 20295228 func 80000003 ind 00000000 flags 00000000 -> 65726f43 294d5428 2d376920 30323632 func 80000004 ind 00000000 flags 00000000 -> 5043204d 20402055 30372e32 007a4847 func 80000005 ind 00000000 flags 00000000 -> 00000000 00000000 00000000 00000000 func 80000006 ind 00000000 flags 00000000 -> 00000000 00000000 01006040 00000000 func 80000007 ind 00000000 flags 00000000 -> 00000000 00000000 00000000 00000100 func 80000008 ind 00000000 flags 00000000 -> 00003024 00000000 00000000 00000000 func 40000000 ind 00000000 flags 00000000 -> 00000000 4b4d564b 564b4d56 0000004d func 40000001 ind 00000000 flags 00000000 -> 0100001b 00000000 00000000 00000000
\dae
Quoted 67 lines · Avi Kivity
Quoted 13 lines · David Evensky
Avi,
evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..10000){ $o=`taskset 0x01 ./4sasha`; chomp($o); $histogram{$o}++}; for $o (sort keys %histogram){print "$o: $histogram{$o}\n"}' KVM_GET_SUPPORTED_CPUID returned -1 with errno 7: 3 Returned entries: 31: 9995 Returned entries: 32: 1 Returned entries: 64: 1 evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..10000){ $o=`taskset 0x02 ./4sasha`; chomp($o); $histogram{$o}++}; for $o (sort keys %histogram){print "$o: $histogram{$o}\n"}' KVM_GET_SUPPORTED_CPUID returned -1 with errno 7: 1 Returned entries: 31: 9999 evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..10000){ $o=`taskset 0x03 ./4sasha`; chomp($o); $histogram{$o}++}; for $o (sort keys %histogram){print "$o: $histogram{$o}\n"}' KVM_GET_SUPPORTED_CPUID returned -1 with errno 7: 3 Returned entries: 31: 9995Quoted 9 lines
Returned entries: 57: 1 Returned entries: 58: 1 evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..10000){ $o=`taskset 0x04 ./4sasha`; chomp($o); $histogram{$o}++}; for $o (sort keys %histogram){print "$o: $histogram{$o}\n"}' Returned entries: 31: 10000 evensky@waltz:~/megatux/vmatic$ perl -e 'for $cnt (1..10000){ $o=`taskset 0x08 ./4sasha`; chomp($o); $histogram{$o}++}; for $o (sort keys %histogram){print "$o: $histogram{$o}\n"}' KVM_GET_SUPPORTED_CPUID returned -1 with errno 7: 1 Returned entries: 31: 9998 Returned entries: 54: 1Please run the attached program (which works for me, btw).
Signature · 40 lines
error compiling committee.c: too many arguments to function #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <errno.h> #include <linux/kvm.h> int main(void) { struct kvm_cpuid2 *cpuid; int kvm, r = 0, i, j; for (i = 0; i < 1000000; ++i) { kvm = open("/dev/kvm", O_RDWR); cpuid = malloc(sizeof(*cpuid) + sizeof(struct kvm_cpuid_entry2) * 100); cpuid->nent = 100; r = ioctl(kvm, KVM_GET_SUPPORTED_CPUID, cpuid); if (r) printf("KVM_GET_SUPPORTED_CPUID returned %d with errno %d\n", r, errno); else if (cpuid->nent > 31) { printf("Returned entries: %d\n", cpuid->nent); for (j = 0; j < cpuid->nent; ++j) { struct kvm_cpuid_entry2 *e = &cpuid->entries[j]; printf("func %08x ind %08x flags %08x -> %08x %08x %08x %08x\n", e->function, e->index, e->flags, e->eax, e->ebx, e->ecx, e->edx); } return 1; } free(cpuid); close(kvm); } return 0; }
Quoted 5 lines · David Evensky
func
0000000dind 00000001 flags 00000001 -> 00000001 00000000 00000000 00000000 func 80000001 ind 00000000 flags 00000000 -> 00000000 00000000 00000001 28100800 func0000000dind 00000003 flags 00000001 -> 00000000 00000000 00000000 00000000 func0000000dind 00000004 flags 00000001 -> 00000000 00000000 00000000 00000000 func0000000dind 00000005 flags 00000001 -> 00000000 00000000 00000000 00000000
Leaf 0xd handling is broken in 3.0:
case 0xd: {
int i;
entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
for (i = 1; *nent < maxnent && i < 64; ++i) {
if (entry[i].eax == 0)
continue;
do_cpuid_1_ent(&entry[i], function, i);
entry[i].flags |=
KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
++*nent;
}
break;
}We check entry[i].eax before we compute it. 3.2 is fine, so it's only a matter of backports.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 5 lines · Sasha Levin
Quoted 2 lines · David Evensky
...
This should be '-n mode=tap,guest_mac=00:11:11:11:11:11'
...
Thanks!
Quoted 6 lines
Quoted 5 lines
Also, when I start the guest I sometimes get the following error message:
# kvm run -k /path/to/bzImage-3.0.8 -m 256 -c 1 --name guest-15757 KVM_GET_SUPPORTED_CPUID failed: Argument list too long
Quoted 8 lines
Heh, we were talking about it couple of weeks ago, but since I couldn't reproduce it here (it was happening to me before, but now it's gone) the discussing died.
Could you please provide some statistics on how often it happens to you? Also, can you try wrapping the ioctl with a 'while (1)' (theres only 1 ioctl call to
KVM_GET_SUPPORTED_CPUID) and see if it would happen at some point?
Last night I was getting it > 10%; but now that the sun has risen, of course I can't produce it with 10 tries with 3 sets of args that I was using. I did upgrade a few packages last night, but nothing that should affect this.
Quoted 7 lines
Thanks!
Quoted 5 lines
I haven't seen that before.
Thanks,
\dae
...