qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/1] KVM: Retry KVM_CREATE_VM on EINTR or EAGAIN


From: Tom Knych
Subject: Re: [Qemu-devel] [PATCH 1/1] KVM: Retry KVM_CREATE_VM on EINTR or EAGAIN
Date: Fri, 10 Jan 2014 14:15:04 -0800

I'll flip the conditional check

So I traced thru the code and the one path I saw returning EINTR was:

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.

Going thru my logs - all of my errors actually are EINTRs I'll remove the EAGAIN

Thanks for the review 
-Tom


On Fri, Jan 10, 2014 at 5:01 AM, Paolo Bonzini <address@hidden> wrote:
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 <address@hidden>
> ---
>  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");
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]