qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: thomas knych <thomaswk@google.com>
Cc: digit@google.com, qemu-devel@nongnu.org, gleb@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/1] KVM: Retry KVM_CREATE_VM on EINTR or EAGAIN
Date: Fri, 10 Jan 2014 14:01:48 +0100	[thread overview]
Message-ID: <52CFEF3C.5000403@redhat.com> (raw)
In-Reply-To: <1389302063-2432-2-git-send-email-thomaswk@google.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 <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));

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	other threads:[~2014-01-10 13:02 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 ` [Qemu-devel] [PATCH 1/1] " thomas knych
2014-01-10 13:01   ` Paolo Bonzini [this message]
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=52CFEF3C.5000403@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=digit@google.com \
    --cc=gleb@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thomaswk@google.com \
    /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).