All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoffer Dall <christoffer.dall@linaro.org>
To: qemu-devel@nongnu.org
Cc: kvmarm@lists.cs.columbia.edu
Subject: Re: [Qemu-devel] [PATCH v2] target-arm: Check error conditions on kvm_arm_reset_vcpu
Date: Mon, 8 Dec 2014 12:58:31 +0100	[thread overview]
Message-ID: <20141208115831.GD8936@cbox> (raw)
In-Reply-To: <1418039630-11773-1-git-send-email-christoffer.dall@linaro.org>

On Mon, Dec 08, 2014 at 12:53:50PM +0100, Christoffer Dall wrote:
> When resetting a VCPU we currently call both kvm_arm_vcpu_init() and
> write_kvmstate_to_list(), both of which can fail, but we never check the
> return value.
> 
> The only choice here is to print an error an exit if the calls fail.
> 
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> ---
> Changes [v1 -> v2]:
>  - Rebased onto Peter Maydell's "support migration/save/load on AArch64 CPUs"
>    series.

Forgot to mention that I also changed strerror(ret) to strerror(-ret).

-Christoffer

> 
>  target-arm/kvm.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/target-arm/kvm.c b/target-arm/kvm.c
> index 191e759..4d81f3d 100644
> --- a/target-arm/kvm.c
> +++ b/target-arm/kvm.c
> @@ -442,11 +442,20 @@ bool write_list_to_kvmstate(ARMCPU *cpu)
>  
>  void kvm_arm_reset_vcpu(ARMCPU *cpu)
>  {
> +    int ret;
> +
>      /* Re-init VCPU so that all registers are set to
>       * their respective reset values.
>       */
> -    kvm_arm_vcpu_init(CPU(cpu));
> -    write_kvmstate_to_list(cpu);
> +    ret = kvm_arm_vcpu_init(CPU(cpu));
> +    if (ret < 0) {
> +        fprintf(stderr, "kvm_arm_vcpu_init failed: %s\n", strerror(-ret));
> +        abort();
> +    }
> +    if (!write_kvmstate_to_list(cpu)) {
> +        fprintf(stderr, "write_kvmstate_to_list failed\n");
> +        abort();
> +    }
>  }
>  
>  void kvm_arch_pre_run(CPUState *cs, struct kvm_run *run)
> -- 
> 2.1.2.330.g565301e.dirty
> 

  parent reply	other threads:[~2014-12-08 11:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-08 11:53 [Qemu-devel] [PATCH v2] target-arm: Check error conditions on kvm_arm_reset_vcpu Christoffer Dall
2014-12-08 11:55 ` Peter Maydell
2014-12-08 11:58 ` Christoffer Dall [this message]
2014-12-08 11:59   ` Peter Maydell

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=20141208115831.GD8936@cbox \
    --to=christoffer.dall@linaro.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.