Il 27/01/2014 14:44, Alexander Graf ha scritto:

On 20.01.2014, at 15:44, Paolo Bonzini <pbonz...@redhat.com> wrote:

From: thomas knych <thoma...@google.com>

Upstreaming this change from Android 
(https://android-review.googlesource.com/54211).

On heavily loaded machines with many VM instances we see KVM_CREATE_VM
failing with EINTR on this path:

kvm_dev_ioctl_create_vm -> kvm_create_vm -> kvm_init_mmu_notifier -> 
mmu_notifier_register ->  do_mmu_notifier_register -> mm_take_all_locks

which checks if any signals have been raised while it was attaining locks
and returns EINTR.  Retrying the system call greatly improves reliability.

Cc: qemu-sta...@nongnu.org
Signed-off-by: thomas knych <thoma...@google.com>
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
---
kvm-all.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/kvm-all.c b/kvm-all.c
index 3937754..6df2ee1 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1442,16 +1442,22 @@ int kvm_init(void)
        nc++;
    }

-    s->vmfd = kvm_ioctl(s, KVM_CREATE_VM, 0);
-    if (s->vmfd < 0) {
+    do {
+        ret = kvm_ioctl(s, KVM_CREATE_VM, 0);
+    } while (ret == -EINTR);
+
+    if (ret < 0) {
+        fprintf(stderr, "ioctl(KVM_CREATE_VM) failed: %d %s\n", -s->vmfd,

Shouldn't this be -ret?

Yes.  Can you send a patch?

Paolo


Reply via email to