From patchwork Mon Dec 8 11:53:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 41996 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7F2E0202E0 for ; Mon, 8 Dec 2014 11:54:26 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id r20sf1674402wiv.1 for ; Mon, 08 Dec 2014 03:54:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=pkdtBitpfo3bnQ6usuDAUi6fS05XrcEaemM3Vh0Bba0=; b=T3J3SjEa5yfmPDvktruNBVLmhOxFGUHNs+u2rNG3SbqBDP7tZIfkBf3M/jo/Y360V9 dmVxU58ZVcDQgYJc3TC0gSbNqnFxlAOivd7U0sXKg4goXsBoJOWSBcldHrFcgVvThus2 AqFDR2oiyP5x7V+uEdgoRIn5IZ4UHFgd3JHSbTkgRe9vVDslhSUGvaMiNtOLgtKkq8gO I7NuQ5a9t146bzja7wgWHHNRv1iRU2dmPdrRKWEVuckCCIyJDb3rYwmBpJRPVQ32pfDx 7AEuDXzVgLXaD2+yp2sdVs/1l+IwMv5y81xTGNlINRKHbjdz4D3xzc4P8r8hYx9aWRHT Lbzw== X-Gm-Message-State: ALoCoQmu8zpO578hylXggS68YlQ/T98DMAB8iOMLNaSPhFrcYp2DsMuD1vh61vaxijoIagrmLC2B X-Received: by 10.181.27.135 with SMTP id jg7mr3378580wid.5.1418039665764; Mon, 08 Dec 2014 03:54:25 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.10 with SMTP id lc10ls625299lac.22.gmail; Mon, 08 Dec 2014 03:54:25 -0800 (PST) X-Received: by 10.112.189.104 with SMTP id gh8mr16053515lbc.91.1418039665503; Mon, 08 Dec 2014 03:54:25 -0800 (PST) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id u9si29494411laj.89.2014.12.08.03.54.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Dec 2014 03:54:25 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by mail-lb0-f170.google.com with SMTP id 10so2061925lbg.1 for ; Mon, 08 Dec 2014 03:54:25 -0800 (PST) X-Received: by 10.153.7.170 with SMTP id dd10mr15779937lad.44.1418039665359; Mon, 08 Dec 2014 03:54:25 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp590071lbc; Mon, 8 Dec 2014 03:54:24 -0800 (PST) X-Received: by 10.194.92.176 with SMTP id cn16mr43893491wjb.62.1418039663471; Mon, 08 Dec 2014 03:54:23 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id ld10si14945931wjc.92.2014.12.08.03.54.23 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 08 Dec 2014 03:54:23 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:33641 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxwtS-00087y-BC for patch@linaro.org; Mon, 08 Dec 2014 06:54:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39847) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxwsG-0006Zj-Ns for qemu-devel@nongnu.org; Mon, 08 Dec 2014 06:53:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XxwsA-00066Y-5T for qemu-devel@nongnu.org; Mon, 08 Dec 2014 06:53:08 -0500 Received: from mail-la0-f46.google.com ([209.85.215.46]:33174) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xxws9-00066M-UX for qemu-devel@nongnu.org; Mon, 08 Dec 2014 06:53:02 -0500 Received: by mail-la0-f46.google.com with SMTP id q1so3781815lam.5 for ; Mon, 08 Dec 2014 03:53:01 -0800 (PST) X-Received: by 10.152.2.41 with SMTP id 9mr15574576lar.47.1418039581080; Mon, 08 Dec 2014 03:53:01 -0800 (PST) Received: from localhost.localdomain (188-178-240-98-static.dk.customer.tdc.net. [188.178.240.98]) by mx.google.com with ESMTPSA id eg2sm10756898lbb.29.2014.12.08.03.52.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Dec 2014 03:53:00 -0800 (PST) From: Christoffer Dall To: qemu-devel@nongnu.org Date: Mon, 8 Dec 2014 12:53:50 +0100 Message-Id: <1418039630-11773-1-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.1.2.330.g565301e.dirty X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.215.46 Cc: kvmarm@lists.cs.columbia.edu, Christoffer Dall Subject: [Qemu-devel] [PATCH v2] target-arm: Check error conditions on kvm_arm_reset_vcpu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 Reviewed-by: Peter Maydell --- Changes [v1 -> v2]: - Rebased onto Peter Maydell's "support migration/save/load on AArch64 CPUs" series. 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)