[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 7/9] KVM: Retry KVM_CREATE_VM on EINTR
From: |
Alexander Graf |
Subject: |
Re: [Qemu-devel] [PULL 7/9] KVM: Retry KVM_CREATE_VM on EINTR |
Date: |
Mon, 27 Jan 2014 14:44:32 +0100 |
On 20.01.2014, at 15:44, Paolo Bonzini <address@hidden> wrote:
> From: thomas knych <address@hidden>
>
> 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: address@hidden
> Signed-off-by: thomas knych <address@hidden>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
> 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?
Alex
> + strerror(-ret));
> +
> #ifdef TARGET_S390X
> fprintf(stderr, "Please add the 'switch_amode' kernel parameter to "
> "your host kernel command line\n");
> #endif
> - ret = s->vmfd;
> goto err;
> }
>
> + s->vmfd = ret;
> missing_cap = kvm_check_extension_list(s, kvm_required_capabilites);
> if (!missing_cap) {
> missing_cap =
> --
> 1.8.3.1
>
>
>
- [Qemu-devel] [PULL 0/8] KVM uq/master changes for 2014-01-20, Paolo Bonzini, 2014/01/20
- [Qemu-devel] [PULL 1/9] target-i386: Intel MPX, Paolo Bonzini, 2014/01/20
- [Qemu-devel] [PULL 4/9] roms: Flush icache when writing roms to guest memory, Paolo Bonzini, 2014/01/20
- [Qemu-devel] [PULL 2/9] target-i386: do not special case TSC writeback, Paolo Bonzini, 2014/01/20
- [Qemu-devel] [PULL 3/9] target-i386: clear guest TSC on reset, Paolo Bonzini, 2014/01/20
- [Qemu-devel] [PULL 7/9] KVM: Retry KVM_CREATE_VM on EINTR, Paolo Bonzini, 2014/01/20
- Re: [Qemu-devel] [PULL 7/9] KVM: Retry KVM_CREATE_VM on EINTR,
Alexander Graf <=
- [Qemu-devel] [PULL 5/9] kvm: x86: Separately write feature control MSR on reset, Paolo Bonzini, 2014/01/20
- [Qemu-devel] [PULL 8/9] KVM: fix addr type for KVM_IOEVENTFD, Paolo Bonzini, 2014/01/20
- [Qemu-devel] [PULL 6/9] mempath prefault: fix off-by-one error, Paolo Bonzini, 2014/01/20
- [Qemu-devel] [PULL 9/9] kvm: always update the MPX model specific register, Paolo Bonzini, 2014/01/20
- Re: [Qemu-devel] [PULL 0/8] KVM uq/master changes for 2014-01-20, Paolo Bonzini, 2014/01/20