From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52337) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xwbqz-0006TQ-T4 for qemu-devel@nongnu.org; Thu, 04 Dec 2014 14:14:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xwbqv-0001hu-2j for qemu-devel@nongnu.org; Thu, 04 Dec 2014 14:14:17 -0500 Received: from mail-lb0-f175.google.com ([209.85.217.175]:61798) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xwbqu-0001hq-Rc for qemu-devel@nongnu.org; Thu, 04 Dec 2014 14:14:12 -0500 Received: by mail-lb0-f175.google.com with SMTP id u10so14408108lbd.6 for ; Thu, 04 Dec 2014 11:14:12 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1417637822-28984-1-git-send-email-christoffer.dall@linaro.org> References: <1417637822-28984-1-git-send-email-christoffer.dall@linaro.org> From: Peter Maydell Date: Thu, 4 Dec 2014 19:13:51 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH] target-arm: Check error conditions on kvm_arm_reset_vcpu List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoffer Dall Cc: QEMU Developers , "kvmarm@lists.cs.columbia.edu" On 3 December 2014 at 20:17, 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. I like this patch, but it is going to conflict with a patch I'm nearly done testing and plan to send tomorrow that unifies the sysreg handling for 32 and 64 bit KVM/ARM. Part of what that involves is using a single kvm_arm_reset_vcpu() in kvm.c rather than different 32 and 64 bit versions. So you should probably respin this patch on top of that one. > Signed-off-by: Christoffer Dall > --- > target-arm/kvm32.c | 13 +++++++++++-- > target-arm/kvm64.c | 8 +++++++- > 2 files changed, 18 insertions(+), 3 deletions(-) > > diff --git a/target-arm/kvm32.c b/target-arm/kvm32.c > index 5ec4eb1..1fd0e83 100644 > --- a/target-arm/kvm32.c > +++ b/target-arm/kvm32.c > @@ -511,9 +511,18 @@ int kvm_arch_get_registers(CPUState *cs) > > 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)); Shouldn't this be strerror(-ret) ? thanks -- PMM