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: 418683 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 134431400D5 for ; Mon, 8 Dec 2014 22:54:09 +1100 (AEDT) Received: from localhost ([::1]:33641 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxwtD-00087y-A3 for incoming@patchwork.ozlabs.org; Mon, 08 Dec 2014 06:54:07 -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-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pkdtBitpfo3bnQ6usuDAUi6fS05XrcEaemM3Vh0Bba0=; b=HZCkK+kZIG871uE41yL+816VaLUnXOU0K3EMvWp/7nc7Arxi6sh+kyHtqYdNgMqKLk 1j+xJu+kqvUzdZothXxqKz39YekJ8f/SKC6yeThiBJthEN6AdibvYA2LrPulIdZPT0bK SmW5dEuZgE+tFOC938JZVEsxYK+D6LHT18INukcUqMpPX/G4BlxKj+VnEv4gpfbfNVI6 vCPIVS9Y5scuGwqOODbFG2q5oZjOeoyzbk1lAjmiutjv7SrxQ0SeEM096vX9fS9TDRHr 9+nxFtOzzpp5GEdhm/ykgxhdVXGKARwPVSvLkuPtVKrdlNKjn27G2038j7GEzQyuf+11 +Uow== X-Gm-Message-State: ALoCoQkcUVYvhVIPPX4RF0Qpue0ETBH9K90rgsxtHD5idMZbL95AYeYlE1JowHE4yMF347ojrv6U 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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)