[Top][All Lists]

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

[Qemu-commits] [COMMIT 76ae317] kvm: work around supported cpuid ioctl()

From: Anthony Liguori
Subject: [Qemu-commits] [COMMIT 76ae317] kvm: work around supported cpuid ioctl() brokenness
Date: Wed, 20 May 2009 14:26:57 -0000

From: Mark McLoughlin <address@hidden>

KVM_GET_SUPPORTED_CPUID has been known to fail to return -E2BIG
when it runs out of entries. Detect this by always trying again
with a bigger table if the ioctl() fills the table.

Signed-off-by: Mark McLoughlin <address@hidden>

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index fe67eed..7cdcf31 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -45,6 +45,9 @@ static struct kvm_cpuid2 *try_get_cpuid(KVMState *s, int max)
     cpuid = (struct kvm_cpuid2 *)qemu_mallocz(size);
     cpuid->nent = max;
     r = kvm_ioctl(s, KVM_GET_SUPPORTED_CPUID, cpuid);
+    if (r == 0 && cpuid->nent >= max) {
+        r = -E2BIG;
+    }
     if (r < 0) {
         if (r == -E2BIG) {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]