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: Auger Eric X-Patchwork-Id: 54178 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 60EB0218DB for ; Fri, 25 Sep 2015 21:42:40 +0000 (UTC) Received: by laff1 with SMTP id f1sf44771396laf.2 for ; Fri, 25 Sep 2015 14:42:39 -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=JFSILXMfrsil6u4j5wl/mAXPMZxMHihW99ussnopa4k=; b=eEiM0sZlC3h+p419IzeoJFZTgSMQVAiRVtSkX09ph6WaGI2aVa7MtHC2TvEf8rUntY 2syg/4pB5Sj6N6NG1gVlljz7zlb+wWZllRSr3gc6JeXbrBOGiakR6Ayv1VfTYH1T9Dh4 vKjGVS+GnGY917/4TEBXMZ4aRMd4gIUSF0/SoAh0NJiFQ2uf3dRBNFu/wPVuRH080wgo 6BZZrfih+nrXmFhZ2fvFOR0Nu9W0n7i2iXoTW4H2IRR7T/Q4Eic7kimjIETnR2mFA58d +yfduZ6yx2zzKsuYRMBaTb5q3nnGOFivZ96YfUemBc9GBsGyUXnWhjipQyBFmPYFApbd ViCA== X-Gm-Message-State: ALoCoQk6Cy7HneUH9MRzlWAww4RLNElb0NAz0uOsSqO1dD9SXFNg70UJ+Db+xCNzi0U1P4dVnIb3 X-Received: by 10.152.26.5 with SMTP id h5mr1292635lag.5.1443217359009; Fri, 25 Sep 2015 14:42:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.30.18 with SMTP id e18ls253365lfe.35.gmail; Fri, 25 Sep 2015 14:42:38 -0700 (PDT) X-Received: by 10.25.19.73 with SMTP id j70mr1500833lfi.29.1443217358720; Fri, 25 Sep 2015 14:42:38 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id bn6si2535115lbc.95.2015.09.25.14.42.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Sep 2015 14:42:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lahh2 with SMTP id h2so110546583lah.0 for ; Fri, 25 Sep 2015 14:42:38 -0700 (PDT) X-Received: by 10.25.28.73 with SMTP id c70mr1294143lfc.76.1443217358614; Fri, 25 Sep 2015 14:42:38 -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.59.35 with SMTP id w3csp279218lbq; Fri, 25 Sep 2015 14:42:37 -0700 (PDT) X-Received: by 10.66.121.229 with SMTP id ln5mr9932368pab.133.1443217354647; Fri, 25 Sep 2015 14:42:34 -0700 (PDT) Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com. [209.85.220.53]) by mx.google.com with ESMTPS id if3si8202728pbc.192.2015.09.25.14.42.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Sep 2015 14:42:34 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.220.53 as permitted sender) client-ip=209.85.220.53; Received: by pablk4 with SMTP id lk4so19529944pab.3 for ; Fri, 25 Sep 2015 14:42:34 -0700 (PDT) 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 Cc: linux-kernel@vger.kernel.org, patches@linaro.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-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.215.50 as permitted sender) smtp.mailfrom=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 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);