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: 7268141 Return-Path: X-Original-To: patchwork-kvm@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 C6145BEEC1 for ; Fri, 25 Sep 2015 21:43:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EFC9E208E6 for ; Fri, 25 Sep 2015 21:43:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 162B9208E1 for ; Fri, 25 Sep 2015 21:43:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753280AbbIYVmi (ORCPT ); Fri, 25 Sep 2015 17:42:38 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:34708 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753120AbbIYVme (ORCPT ); Fri, 25 Sep 2015 17:42:34 -0400 Received: by padhy16 with SMTP id hy16so116482880pad.1 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=hZFspRew7zq7iVlydXqLNP+0JsSYt5T/ddjcJd07eNN0MQMMXJteamLC7f0HNxFYW+ NKKyXw1eUDdC5LTK/SUd0M2F/6aqeCkL9w/PVwaPPCXARDxxlQJj8zmlD986yZ0Yfnpb h/7UbUS5GPCFinsSU8qyM5M4FhhJw2FdjcjSMUxztGrbI9xJjLZP7SRMTGiY//0qNJsN OAC1uZYZPlYqqITObl18qV6tiWd8l12kuQxYsxgW1SmQWJl3CCFOTz80JPlRqd9jXoBV Ocbl6Nbr4LPPYwK2TQ8M4JjDLJlLv8mh2jzIfpCXp9TZsGZVUZUnCRsXV86H+EQa0oSo G9DQ== X-Gm-Message-State: ALoCoQlTboCghwNtlCXL6T7DOUXxeFSFWD3nRYe+a4zpvAcrV7d8rxzk9Gh3ggiATEHDPN8bwmDX 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> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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);