From patchwork Wed Nov 4 14:49:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 55990 Delivered-To: patch@linaro.org Received: by 10.112.61.134 with SMTP id p6csp2461953lbr; Wed, 4 Nov 2015 06:59:02 -0800 (PST) X-Received: by 10.107.11.100 with SMTP id v97mr3978388ioi.56.1446649142167; Wed, 04 Nov 2015 06:59:02 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id n20si2537529ioi.144.2015.11.04.06.59.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Nov 2015 06:59:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com 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 1ZtzVL-0001X3-9C; Wed, 04 Nov 2015 14:57:39 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZtzRS-0005Fu-4n for linux-arm-kernel@bombadil.infradead.org; Wed, 04 Nov 2015 14:53:38 +0000 Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]) by merlin.infradead.org with esmtps (Exim 4.85 #2 (Red Hat Linux)) id 1ZtzRQ-0001Nw-EP for linux-arm-kernel@lists.infradead.org; Wed, 04 Nov 2015 14:53:37 +0000 Received: by wmff134 with SMTP id f134so43611007wmf.0 for ; Wed, 04 Nov 2015 06:53:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jHf+EU5qZcVwAYgvKldBrxvEASuoKq+iTdw1MgRTFUQ=; b=CgLlBFzGu+cFfsPJW0B8TkOKIp7j7h+6Qr9taoQJqZk7JzwdYWVVJPV/URbp2j991b 5LTukc3Va2S7S/HMLRl+ehLPplMETUZYwFc0QEgvkrgTk8S9v7O0uUxCROIVXqId9Gl+ qZ21U7QV3W63vrNTOXVyYcCVuqFLU7MBxfcDtiUXAkx0ifqgWdLtixRrrYTfEQtBAodc YxYUMZUKFGCexM7VK72Yohkia/CvUMx/9ZcAze1OmCmPpegyOOTfkJAwJlaiGBki1RWL bMumKb1ti0plJ5EbeVqqn+oz8n9ky4xOo2xcSrS62KdqjtiscAjnuFogZfZjikR+jA7O kTAw== 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=jHf+EU5qZcVwAYgvKldBrxvEASuoKq+iTdw1MgRTFUQ=; b=UDR6Tsmnd0Q9WdGGUfg/7sFjs0HCrp114dk1wQTtzbINqqn7VV/n8IwYrfEMUi4ZhC mQQjChkROyJ4M0NW3ahT7R7ClXKmbWZGEB6SrA/uMY8gYpHacpKqiakAEbOLnlp29Arw DWQ5fxab/6RTkktaT1pjOP3HdVlA9duG7oisn7PoES/qFZdR9UYZIp+n95fgOoBhK0EC pf96Y3BNkJKfPkm08+QNPPdO033qvagDPdJ76rwIQLALlG2Up+6XJK3OMCBYSBTayB// Jqe0WUYCKEgoGkN87uBmUZJUIjsSpk7q0qopEqA8kOPx1S/7/T+mtY7yqMvp/1t0sNyj Lp5A== X-Gm-Message-State: ALoCoQnJ0LQsX8NRP59lB5u7rhH4kev35ghoIo75yxmlQ6ZxuYQ8gSE/0dSUTXxAj0Ks5x6VFm/6 X-Received: by 10.28.93.20 with SMTP id r20mr28358214wmb.101.1446648790517; Wed, 04 Nov 2015 06:53:10 -0800 (PST) Received: from localhost.localdomain ([94.18.191.146]) by smtp.gmail.com with ESMTPSA id e9sm1985081wjw.8.2015.11.04.06.53.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Nov 2015 06:53:10 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PULL 12/21] KVM: arm/arm64: check power_off in critical section before VCPU run Date: Wed, 4 Nov 2015 15:49:51 +0100 Message-Id: <1446648600-27297-13-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.1.2.330.g565301e.dirty In-Reply-To: <1446648600-27297-1-git-send-email-christoffer.dall@linaro.org> References: <1446648600-27297-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151104_095336_770405_614510E2 X-CRM114-Status: GOOD ( 11.93 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c09:0:0:0:22a listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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: Marc Zyngier , Christoffer Dall , Eric Auger MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org From: Eric Auger 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 Signed-off-by: Christoffer Dall --- arch/arm/kvm/arm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.1.2.330.g565301e.dirty _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index d04deeb..3b3384c 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);