From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1biu-00025L-0f for qemu-devel@nongnu.org; Fri, 10 Jan 2014 08:02:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1bio-0006D1-Vg for qemu-devel@nongnu.org; Fri, 10 Jan 2014 08:02:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:3413) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1bio-0006Cv-Mo for qemu-devel@nongnu.org; Fri, 10 Jan 2014 08:01:58 -0500 Message-ID: <52CFEF3C.5000403@redhat.com> Date: Fri, 10 Jan 2014 14:01:48 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1389302063-2432-1-git-send-email-thomaswk@google.com> <1389302063-2432-2-git-send-email-thomaswk@google.com> In-Reply-To: <1389302063-2432-2-git-send-email-thomaswk@google.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/1] KVM: Retry KVM_CREATE_VM on EINTR or EAGAIN List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: thomas knych Cc: digit@google.com, qemu-devel@nongnu.org, gleb@redhat.com Il 09/01/2014 22:14, thomas knych ha scritto: > 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 > --- > 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)); No yoda conditionals---please write "s->vmfd == -EINTR". However, I would like to understand where in the KVM module the error originates and is propagated from. Especially EAGAIN seems weird. Paolo > + > 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"); >