public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: David Evensky <evensky@dancer.ca.sandia.gov>
Cc: Sasha Levin <levinsasha928@gmail.com>,
	Pekka Enberg <penberg@kernel.org>,
	kvm@vger.kernel.org
Subject: Re: kvm-tools: can't seem to set guest_mac and KVM_GET_SUPPORTED_CPUID failed.
Date: Thu, 17 Nov 2011 18:49:16 +0200	[thread overview]
Message-ID: <4EC53B0C.4090300@redhat.com> (raw)
In-Reply-To: <20111117162959.GC25489@dancer.ca.sandia.gov>

[-- Attachment #1: Type: text/plain, Size: 1590 bytes --]

On 11/17/2011 06:29 PM, David Evensky wrote:
> 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
>

Please run the attached program (which works for me, btw). 

-- 
error compiling committee.c: too many arguments to function


[-- Attachment #2: supported-cpuid.c --]
[-- Type: text/x-csrc, Size: 1008 bytes --]

#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;
}

  reply	other threads:[~2011-11-17 16:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-17  0:42 kvm-tools: can't seem to set guest_mac and KVM_GET_SUPPORTED_CPUID failed David Evensky
2011-11-17  6:07 ` Sasha Levin
2011-11-17  6:53   ` Pekka Enberg
2011-11-17  6:56     ` Sasha Levin
2011-11-17  9:04       ` Avi Kivity
2011-11-17 10:08         ` Sasha Levin
2011-11-17 15:38       ` David Evensky
2011-11-17 15:43         ` Sasha Levin
2011-11-17 15:50           ` David Evensky
2011-11-17 15:52             ` Sasha Levin
2011-11-17 15:53               ` Avi Kivity
2011-11-17 16:12                 ` David Evensky
2011-11-17 16:20                   ` Sasha Levin
2011-11-17 16:20                   ` Avi Kivity
2011-11-17 16:29                     ` David Evensky
2011-11-17 16:49                       ` Avi Kivity [this message]
2011-11-17 17:13                         ` David Evensky
2011-11-17 17:30                           ` Avi Kivity
2011-11-17 15:55   ` David Evensky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EC53B0C.4090300@redhat.com \
    --to=avi@redhat.com \
    --cc=evensky@dancer.ca.sandia.gov \
    --cc=kvm@vger.kernel.org \
    --cc=levinsasha928@gmail.com \
    --cc=penberg@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox