Received: by 10.223.185.116 with SMTP id b49csp179202wrg; Thu, 15 Feb 2018 19:22:12 -0800 (PST) X-Google-Smtp-Source: AH8x22409Kw6AiP6C0aGkaJHiayAF29ci6wORRg0jcKq/lgb7QGZn6UWjiXpvxHaLibphVQVIqws X-Received: by 10.99.120.199 with SMTP id t190mr3869188pgc.72.1518751331925; Thu, 15 Feb 2018 19:22:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518751331; cv=none; d=google.com; s=arc-20160816; b=G0LXLbgXC494VLw9uyoRTInb+NvlxDCMk56v4QN4WMphyScHb+xxo5nAc1KgnlPd4f bf2oq/Rw2JLgN8EXQX1f94nbHx2XeRtO1yeBHWi2gwAniVrkDd91fwuqcssqLWKDBCxQ /RZz4siiywjMslUIWfirEgphPx1HVpAS5deq6zWiCjT479ewbb4MrSLr9TN3mDGew7Wt Vaq4CDmhs0oyaSWvT0uw3k7Qh6Fp5ZWlUWslYQXzC3TuBOoNPm7BqqJbRBFAVN6nc3UY YKTUJ/EVk8k4u1QxMXa7iw2PJg3Iuq+83jf06kMfNvfD6afXRaoieORpmBfLc42+ykKb Iz4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=DGurBcl+cwZ7eULoDrMv1kMuhct74mSMOSDiD/y5sRU=; b=gC32YaH6qD5uXi/+LUzGtlDClBQU5GqCSk3rlqu+o/Mh23rbGrlFUDI0LIkK7N2HFt 0bkUBZsg96OIl84M4F7hG1k6Bp863xfRsvSqT51zlG5geURkBOS6kKKz/mw1fheY9Xc+ UzwGg8UQyb9utX6gID1Rp3PHdcNKgq7cZTYcVPKiokYFhyMigo3OZimehGABEST2zre8 GOXVNFHvaKDQYScQxm2CRbRgM5mwVL5yXEOejggqV7+mKjoWhTDeWVrMSXQq1t7TLbVR FlFY1NPzFf014uKvcUMvFk9xwMCtqn3E7Z8utTqaIV7nOS8uhLdZaL+Skp8IeLOVoRPm lYjQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20si576141pff.85.2018.02.15.19.21.55; Thu, 15 Feb 2018 19:22:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424344AbeBOPot (ORCPT + 99 others); Thu, 15 Feb 2018 10:44:49 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:34518 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423899AbeBOPoq (ORCPT ); Thu, 15 Feb 2018 10:44:46 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E220811A6; Thu, 15 Feb 2018 15:44:44 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Pieralisi , Christoffer Dall , James Morse Subject: [PATCH 4.15 135/202] KVM: arm/arm64: Handle CPU_PM_ENTER_FAILED Date: Thu, 15 Feb 2018 16:17:15 +0100 Message-Id: <20180215151720.202055192@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: James Morse commit 58d6b15e9da5042a99c9c30ad725792e4569150e upstream. cpu_pm_enter() calls the pm notifier chain with CPU_PM_ENTER, then if there is a failure: CPU_PM_ENTER_FAILED. When KVM receives CPU_PM_ENTER it calls cpu_hyp_reset() which will return us to the hyp-stub. If we subsequently get a CPU_PM_ENTER_FAILED, KVM does nothing, leaving the CPU running with the hyp-stub, at odds with kvm_arm_hardware_enabled. Add CPU_PM_ENTER_FAILED as a fallthrough for CPU_PM_EXIT, this reloads KVM based on kvm_arm_hardware_enabled. This is safe even if CPU_PM_ENTER never gets as far as KVM, as cpu_hyp_reinit() calls cpu_hyp_reset() to make sure the hyp-stub is loaded before reloading KVM. Fixes: 67f691976662 ("arm64: kvm: allows kvm cpu hotplug") CC: Lorenzo Pieralisi Reviewed-by: Christoffer Dall Signed-off-by: James Morse Signed-off-by: Christoffer Dall Signed-off-by: Greg Kroah-Hartman --- virt/kvm/arm/arm.c | 1 + 1 file changed, 1 insertion(+) --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c @@ -1239,6 +1239,7 @@ static int hyp_init_cpu_pm_notifier(stru cpu_hyp_reset(); return NOTIFY_OK; + case CPU_PM_ENTER_FAILED: case CPU_PM_EXIT: if (__this_cpu_read(kvm_arm_hardware_enabled)) /* The hardware was enabled before suspend. */