From patchwork Fri Aug 7 16:08:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 52049 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id 5871F22EAD for ; Fri, 7 Aug 2015 16:09:30 +0000 (UTC) Received: by labth1 with SMTP id th1sf41332537lab.2 for ; Fri, 07 Aug 2015 09:09:29 -0700 (PDT) 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:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=eAF3gW3yzsu/MJ3KwbNHUl0irZBdezSmW0xn7aFsr9M=; b=bcVpAjBDpi9SKdts2Et1yr6ky11RZMNTxNv3gKqB7fXB29Trw3vK+wRWzXPWxl2jzw pzYEeHpDX7kPRQkc3sV//0Z41lodZHi7lndfYlZSqJ2jP/luSxyz6fMWZtPg0Lgc6mrN qO/rONoHTLRYbzOw0c2+RFs45IamFUkAkmeNvB18A1z5/fMQomsgIOsiSbB3q87LRPyp xt35scJ0GvnR01woOjUOxjtO5uorY1eqdZ93ouFOKJofmq4o9ybrm4QWGEKaW8Nf7MQI hjAcbyzZzTduSNFGohQCqj7zfqntNQMSPDsbQii6qlq9u4OQJbRcwN8UyYvNYAegKI3k AvpA== X-Gm-Message-State: ALoCoQmdnEkl6EOBCrEZikgALLClz/SeXFiFKf8RtbC4VSDAzUUS+SZZR8ndan2yS2+RLz8prWG3 X-Received: by 10.194.80.69 with SMTP id p5mr2377444wjx.2.1438963769282; Fri, 07 Aug 2015 09:09:29 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.2 with SMTP id s2ls456100lal.86.gmail; Fri, 07 Aug 2015 09:09:29 -0700 (PDT) X-Received: by 10.152.37.227 with SMTP id b3mr8263772lak.91.1438963769124; Fri, 07 Aug 2015 09:09:29 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id e10si7784784lam.131.2015.08.07.09.09.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Aug 2015 09:09:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lbbtg9 with SMTP id tg9so25663697lbb.1 for ; Fri, 07 Aug 2015 09:09:29 -0700 (PDT) X-Received: by 10.112.120.134 with SMTP id lc6mr8382348lbb.86.1438963768885; Fri, 07 Aug 2015 09:09:28 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.7.198 with SMTP id l6csp480610lba; Fri, 7 Aug 2015 09:09:28 -0700 (PDT) X-Received: by 10.194.9.102 with SMTP id y6mr16270978wja.91.1438963765566; Fri, 07 Aug 2015 09:09:25 -0700 (PDT) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com. [209.85.212.182]) by mx.google.com with ESMTPS id u2si20632674wjz.147.2015.08.07.09.09.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Aug 2015 09:09:25 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.182 as permitted sender) client-ip=209.85.212.182; Received: by wicgj17 with SMTP id gj17so67285777wic.1 for ; Fri, 07 Aug 2015 09:09:25 -0700 (PDT) X-Received: by 10.180.215.101 with SMTP id oh5mr8526071wic.6.1438963765222; Fri, 07 Aug 2015 09:09:25 -0700 (PDT) Received: from gnx2579.home (LCaen-156-56-7-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id by17sm9127438wib.18.2015.08.07.09.09.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Aug 2015 09:09:24 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, christoffer.dall@linaro.org, marc.zyngier@arm.com, drjones@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, patches@linaro.org, pbonzini@redhat.com Subject: [PATCH v2 3/4] KVM: arm/arm64: check power_off in critical section before VCPU run Date: Fri, 7 Aug 2015 18:08:32 +0200 Message-Id: <1438963713-10460-4-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438963713-10460-1-git-send-email-eric.auger@linaro.org> References: <1438963713-10460-1-git-send-email-eric.auger@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eric.auger@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.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In case KVM_SET_MP_STATE ioctl is called just after we executed the vcpu_sleep check, we can enter the guest although KVM_MP_STATE_STOPPED is set. Let's check the power_off state in the critical section, just before entering the guest. Signed-off-by: Eric Auger Reported-by: Christoffer Dall --- arch/arm/kvm/arm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 4f50be3..cc404a8 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -555,7 +555,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) run->exit_reason = KVM_EXIT_INTR; } - if (ret <= 0 || need_new_vmid_gen(vcpu->kvm)) { + if (ret <= 0 || need_new_vmid_gen(vcpu->kvm) || + vcpu->arch.power_off) { local_irq_enable(); kvm_vgic_sync_hwstate(vcpu); preempt_enable();