From patchwork Fri Sep 25 21:41:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 7268201 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B4217BEEC1 for ; Fri, 25 Sep 2015 21:44:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D7D0720961 for ; Fri, 25 Sep 2015 21:44:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F2D4A208E6 for ; Fri, 25 Sep 2015 21:44:57 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zfalz-0006I8-5g; Fri, 25 Sep 2015 21:43:19 +0000 Received: from mail-pa0-f41.google.com ([209.85.220.41]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zfala-0005w5-OY for linux-arm-kernel@lists.infradead.org; Fri, 25 Sep 2015 21:42:55 +0000 Received: by pacex6 with SMTP id ex6so116322987pac.0 for ; Fri, 25 Sep 2015 14:42:34 -0700 (PDT) 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:in-reply-to :references; bh=JFSILXMfrsil6u4j5wl/mAXPMZxMHihW99ussnopa4k=; b=HARkfgwN3Qv/aFM5GZuR7fttAW04x0APW9M0ZcS04wdopBdkL+TANJcv0xv5XZm1rO oKeRVRCMSMwAPigqvpckbr20XOtyr2KPFV9HNF7mqbm0wGdk7w6jeBjgGCFDEBxH+LAU ZzVTBP0jT9LoU6Lta2TnM8jdvIjCPqUQPep/5U++Kuu9G2KLSqECrTfFaeBOYhAFFEJg OJp0DdNOblUlCwIMPPbiJm6F9hTj08JrrmvrOCVV1cqENnSsOL6pA3Y7sBfSgQ2eetUJ TeiAQeg3pz2wtmZJmRhJrQoPPnEHcWCEcgzLVwM8b+rixDVb/1fj/moeVvapDVkvKaMG 7nHw== X-Gm-Message-State: ALoCoQnOD11RbNqbE5fg6cv7P1rwfmFLEB9bDmWz+g5vLHrEzbkjae4iN4RcIweF7MSItqF0SNMe X-Received: by 10.68.237.196 with SMTP id ve4mr10057149pbc.98.1443217354302; Fri, 25 Sep 2015 14:42:34 -0700 (PDT) Received: from gnx2579.st.com. ([70.35.39.2]) by smtp.gmail.com with ESMTPSA id u1sm5606756pbz.56.2015.09.25.14.42.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Sep 2015 14:42:33 -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 Subject: [PATCH v3 3/4] KVM: arm/arm64: check power_off in critical section before VCPU run Date: Fri, 25 Sep 2015 23:41:16 +0200 Message-Id: <1443217277-13173-4-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1443217277-13173-1-git-send-email-eric.auger@linaro.org> References: <1443217277-13173-1-git-send-email-eric.auger@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150925_144254_997373_55F3C87D X-CRM114-Status: GOOD ( 12.55 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, patches@linaro.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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case a vcpu off PSCI call is called just after we executed the vcpu_sleep check, we can enter the guest although power_off 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 Reviewed-by: Christoffer Dall --- v2 -> v3: - reword commit message --- 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 9d16f76..4eb59e3 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -560,7 +560,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_timer_sync_hwstate(vcpu); kvm_vgic_sync_hwstate(vcpu);