qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: thomas knych <thomaswk@google.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, thomas knych <thomaswk@google.com>,
	gleb@redhat.com, digit@google.com
Subject: [Qemu-devel] [PATCH 1/1] KVM: Retry KVM_CREATE_VM on EINTR or EAGAIN
Date: Thu,  9 Jan 2014 13:14:23 -0800	[thread overview]
Message-ID: <1389302063-2432-2-git-send-email-thomaswk@google.com> (raw)
In-Reply-To: <1389302063-2432-1-git-send-email-thomaswk@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/EAGAIN retrying the system call greatly improves
reliability.

Signed-off-by: thomas knych <thomaswk@google.com>
---
 kvm-all.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/kvm-all.c b/kvm-all.c
index 3937754..29787ae 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1442,8 +1442,14 @@ int kvm_init(void)
         nc++;
     }
 
-    s->vmfd = kvm_ioctl(s, KVM_CREATE_VM, 0);
+    do {
+        s->vmfd = kvm_ioctl(s, KVM_CREATE_VM, 0);
+    } while (s->vmfd < 0 && (-EINTR == s->vmfd || -EAGAIN == s->vmfd));
+
     if (s->vmfd < 0) {
+        fprintf(stderr, "ioctl(KVM_CREATE_VM) failed: %d %s\n", -s->vmfd,
+                strerror(-s->vmfd));
+
 #ifdef TARGET_S390X
         fprintf(stderr, "Please add the 'switch_amode' kernel parameter to "
                         "your host kernel command line\n");
-- 
1.8.5.1

  reply	other threads:[~2014-01-09 21:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-09 21:14 [Qemu-devel] [PATCH 0/1] KVM: Retry KVM_CREATE_VM on EINTR or EAGAIN thomas knych
2014-01-09 21:14 ` thomas knych [this message]
2014-01-10 13:01   ` [Qemu-devel] [PATCH 1/1] " Paolo Bonzini
2014-01-10 22:15     ` Tom Knych
2014-01-13 11:16       ` Paolo Bonzini
2014-01-14 18:56         ` Andrea Arcangeli
2014-01-15  2:09           ` Tom Knych
2014-01-15  7:47             ` Paolo Bonzini

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=1389302063-2432-2-git-send-email-thomaswk@google.com \
    --to=thomaswk@google.com \
    --cc=digit@google.com \
    --cc=gleb@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).