From patchwork Mon Nov 13 09:17:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10055347 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 40B3760586 for ; Mon, 13 Nov 2017 09:19:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 446F028FAE for ; Mon, 13 Nov 2017 09:19:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3741B291CE; Mon, 13 Nov 2017 09:19:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D2D1B28FAE for ; Mon, 13 Nov 2017 09:19:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=vyGQjcBd/w9xOXoW1d243xnIkkabprPcC9QiOlsZYXg=; b=r5kpVjo6mU3aNByoZ7RtNgJA6P Ae0PKKSL09LfgizCTN1/DNpJ5AWlLgKW84ct+6BQFb1q+Wen768iPkUrSKs8EiT3Z7JQvkBPab+mA 6q6S+v58FmQKrUfSHBFZbeLF1ZEUIa169phgwlDPCqOyP7KAUdw19WuSXiXc7kSCeg8qv27AHlec7 emcAN5IC+btz01a9YibLXFeu7a00OLr9mFGvu/gIqbmsPK5emZhp1gRUZXSkIZbBYTOzIPYXtXBgF fSRMxI0L/LkE03KcGcujbbuBW+ay9KRgertYYgJeTNcOjouJYnjNRSyVmu14WhSc4XGRTsPWw/emg gG9EtTlg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eEAu0-0003RR-Qf; Mon, 13 Nov 2017 09:19:36 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eEAsn-00022Q-1W for linux-arm-kernel@lists.infradead.org; Mon, 13 Nov 2017 09:18:25 +0000 Received: by mail-wm0-x244.google.com with SMTP id b189so6521951wmd.5 for ; Mon, 13 Nov 2017 01:18:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hlhH8es6WqGH+m1G410BXvZDm3f6nxShdynycOLIx+k=; b=K2bsSpEvHieFqnLQ3IkZ3aVhP7dc73v9ImaNTZ9lJ09Ov+4JYDpt7vFah6Szp/bmeQ 7R4MZjUsJdXNYhEHXHtye/2+ypGjCoC0MJPKt73JuBLzQsRB7F7XhCGLceuNJ6ZfhW2/ bNAXecz5JP09qtCM+VIV3ojxW46BhKAa46wJs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hlhH8es6WqGH+m1G410BXvZDm3f6nxShdynycOLIx+k=; b=aozyFLKP4dd73RZ00YBqGxo7JeOf8T7L1uA9M/i8AmfZoMC8d25qFfEfGrFOqmWRHe iddrO3NYFsgpvWbW9aX0VmpQw82e93ZLTVnu1OX4IwG5KQ4yIKXWRn4tIkV/bZqGhm7U kAMVePIHoYFn/o1AEXBXYErVquRQNxnCzvZMpotsfe1tnvxnmAlW/f5jI5d45waTy+yu D/bQ4ipQgRRm6LX/LjWCf6QGepGxGRPt+op8JEr2yy1vHrLaHeI8PFwsUGNu4d1XB5mW ezujpSOTGXUzijfa/dzyM7AfbuGEUEJBAmdj7LiM0tAnz2tNgRaCaeW9gUTU+VKoYrah WlXA== X-Gm-Message-State: AJaThX570Zz6K7RSkhnmWvVytNrJLkEBdILk+A3dEdt1xgFz9mbtNhhF gcOYlE8No8XXKbrNZ5AdAVU37w== X-Google-Smtp-Source: AGs4zMYSijd4eVA+HZN2S9OBvD8pPrbbYYgL1SPWUxpLsWZf+dUXQ4egwMy8ww6iDYBwcVGZEqKMSg== X-Received: by 10.28.24.203 with SMTP id 194mr5924227wmy.34.1510564679313; Mon, 13 Nov 2017 01:17:59 -0800 (PST) Received: from localhost.localdomain (xd93dd96b.cust.hiper.dk. [217.61.217.107]) by smtp.gmail.com with ESMTPSA id x63sm9651399wma.39.2017.11.13.01.17.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Nov 2017 01:17:58 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 04/27] KVM: arm/arm64: vgic: Move kvm_vgic_destroy call around Date: Mon, 13 Nov 2017 10:17:29 +0100 Message-Id: <20171113091752.10663-5-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171113091752.10663-1-christoffer.dall@linaro.org> References: <20171113091752.10663-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171113_011821_490907_0501BC16 X-CRM114-Status: GOOD ( 10.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Christoffer Dall , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marc Zyngier The way we call kvm_vgic_destroy is a bit bizarre. We call it *after* having freed the vcpus, which sort of defeats the point of cleaning up things before that point. Let's move kvm_vgic_destroy towards the beginning of kvm_arch_destroy_vm, which seems more sensible. Acked-by: Christoffer Dall Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- virt/kvm/arm/arm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index 79f8ddd604c1..e1e947fe9bc2 100644 --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c @@ -177,6 +177,8 @@ void kvm_arch_destroy_vm(struct kvm *kvm) { int i; + kvm_vgic_destroy(kvm); + free_percpu(kvm->arch.last_vcpu_ran); kvm->arch.last_vcpu_ran = NULL; @@ -186,8 +188,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm) kvm->vcpus[i] = NULL; } } - - kvm_vgic_destroy(kvm); } int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)