From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7mdK-00075E-IY for qemu-devel@nongnu.org; Mon, 27 Jan 2014 08:53:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W7mdF-00064n-DO for qemu-devel@nongnu.org; Mon, 27 Jan 2014 08:53:50 -0500 Message-ID: <52E664DB.4030503@redhat.com> Date: Mon, 27 Jan 2014 14:53:31 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1390229051-28635-1-git-send-email-pbonzini@redhat.com> <1390229051-28635-8-git-send-email-pbonzini@redhat.com> <2C8CC4E0-C561-4904-B256-476BECCA7F4A@suse.de> In-Reply-To: <2C8CC4E0-C561-4904-B256-476BECCA7F4A@suse.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PULL 7/9] KVM: Retry KVM_CREATE_VM on EINTR List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: gleb@kernel.org, thomas knych , Marcelo Tosatti , QEMU Developers , qemu-stable@nongnu.org Il 27/01/2014 14:44, Alexander Graf ha scritto: > > On 20.01.2014, at 15:44, Paolo Bonzini wrote: > >> From: thomas knych >> >> 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-stable@nongnu.org >> Signed-off-by: thomas knych >> Signed-off-by: Paolo Bonzini >> --- >> 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