From patchwork Mon May 26 09:18:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 30925 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f197.google.com (mail-qc0-f197.google.com [209.85.216.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9EB5820491 for ; Mon, 26 May 2014 09:19:04 +0000 (UTC) Received: by mail-qc0-f197.google.com with SMTP id w7sf27766805qcr.4 for ; Mon, 26 May 2014 02:19:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:message-id :mime-version:user-agent: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:content-type :content-disposition; bh=ki5FoNxSGSugqQuf6PONc+zye9713j//gZCs5OkZthA=; b=V4h3RRExzEQzqZl4H97tSyO9gpGozWihmBxuL3tkTNN1l/IFzB9cRYbMF3OhIZuHIJ B0R3J6NIBbuOWV3Mow87EEMJxEvDy8cxzyxXwcfEfTuHdBoSj1BIzGmOXQBWFXoeLyQ1 /usH+SoKkerNGm65he9YWYzQGaqQrp8zVyIJrS5ng8GHAAXHNO2xqgOAWO5c87C+2yXO gUIgCZCvAP5DFL//Yu1pzFyIyEzmrytHFvCNmF/c1qbLLkH5r4Dx9rmrUTk5icw/HqXd EkHPPSTvT/hzewC4mgTxxUAg8c4sXusXNdnitNIFFKyE64GHutixRa71GyICU5N9hgZw J3gQ== X-Gm-Message-State: ALoCoQmgNN1OqVgTBZjHk0yQqwQF/ACn8RQPsUNZk+uJQQWuqJqsBAvJXZ2/OViRyUW2If7msrKp X-Received: by 10.236.144.136 with SMTP id n8mr8814817yhj.22.1401095944442; Mon, 26 May 2014 02:19:04 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.239 with SMTP id l102ls2623801qgd.81.gmail; Mon, 26 May 2014 02:19:04 -0700 (PDT) X-Received: by 10.53.12.229 with SMTP id et5mr17157751vdd.32.1401095944344; Mon, 26 May 2014 02:19:04 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id up9si5958080vec.97.2014.05.26.02.19.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 May 2014 02:19:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.175 as permitted sender) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id jw12so8883808veb.6 for ; Mon, 26 May 2014 02:19:04 -0700 (PDT) X-Received: by 10.52.135.226 with SMTP id pv2mr16937219vdb.33.1401095940258; Mon, 26 May 2014 02:19:00 -0700 (PDT) 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.220.221.72 with SMTP id ib8csp29404vcb; Mon, 26 May 2014 02:19:00 -0700 (PDT) X-Received: by 10.140.95.80 with SMTP id h74mr28724202qge.2.1401095939929; Mon, 26 May 2014 02:18:59 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id p10si12809805qag.0.2014.05.26.02.18.59 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 26 May 2014 02:18:59 -0700 (PDT) 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]:55666 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wor3b-0005p8-HV for patch@linaro.org; Mon, 26 May 2014 05:18:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wor33-0005TH-Fh for qemu-devel@nongnu.org; Mon, 26 May 2014 05:18:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wor2v-0005LN-NZ for qemu-devel@nongnu.org; Mon, 26 May 2014 05:18:25 -0400 Received: from mail-lb0-f175.google.com ([209.85.217.175]:41204) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wor2v-0005Kv-Fd for qemu-devel@nongnu.org; Mon, 26 May 2014 05:18:17 -0400 Received: by mail-lb0-f175.google.com with SMTP id l4so4032022lbv.6 for ; Mon, 26 May 2014 02:18:16 -0700 (PDT) X-Received: by 10.112.156.71 with SMTP id wc7mr525483lbb.86.1401095896122; Mon, 26 May 2014 02:18:16 -0700 (PDT) Received: from localhost (188-178-240-98-static.dk.customer.tdc.net. [188.178.240.98]) by mx.google.com with ESMTPSA id g3sm10068852lam.18.2014.05.26.02.18.14 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 26 May 2014 02:18:15 -0700 (PDT) Date: Mon, 26 May 2014 11:18:13 +0200 From: Christoffer Dall To: qemu-devel@nongnu.org Message-ID: <20140526091813.GA31431@lvm> MIME-Version: 1.0 User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.217.175 Cc: Peter Maydell , Paolo Bonzini , Alexander Graf , kvm@vger.kernel.org, afaerber@suse.de Subject: [Qemu-devel] BUG: commit 50a2c6e breaks KVM/ARM (reset/init vcpu order) 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.128.175 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 Content-Disposition: inline Hi, I noticed that commit 50a2c6e55fa2ce5a2916a2c206bad2c6b0e06df1 broke KVM/ARM, because the realize function (arm_cpu_realizefn()) now calls cpu_reset() before qemu_init_vcpu(), which causes kvm_arm_reset_cpu() to segfault because it dereferences cpu->cpreg_reset_values, which is not allocated before kvm_arch_init_vcpu(). Simply changing the order of the reset/init calls (see the tiny patch below) seems to fix it, but I'm not completely sure this is a clean and correct fix: Please adivce :) Thanks, -Christoffer Acked-by: Paolo Bonzini diff --git a/target-arm/cpu.c b/target-arm/cpu.c index 6c6f2b3..794dcb9 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -370,8 +370,8 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) init_cpreg_list(cpu); - cpu_reset(cs); qemu_init_vcpu(cs); + cpu_reset(cs); acc->parent_realize(dev, errp); }