From patchwork Fri Apr 24 05:27:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 47534 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0FFBB20553 for ; Fri, 24 Apr 2015 05:34:17 +0000 (UTC) Received: by wizk4 with SMTP id k4sf1573282wiz.2 for ; Thu, 23 Apr 2015 22:34:16 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=AF6vW4WNNx9FKMiqxENDWapyPx3WKtPpeGobKrZ5G6Q=; b=l6XDdG5yJUhThGYNYvSM+WpqpAbaqQ6CsLOpInoV1gWD89zDxsD/gP9S2YB9PFBsgA igVSgFcnvNQ82XXNGUmdENugHptNYji7kj1BgBl+ic49PDWHMpGcks3F5GDGaOaCAjcQ 0E2mbJp+Veptw0TcL8Pr7DbQ1uvGiXyvlmabXJf3p8BGtG1pAnLUGBvsQlMQY773lM/+ i83K698bQwNqAt4WzOGIAUj7LO/W4h2nR4f/8saAZUJME7rNEBqXdmuS9NFqtbUHYvhc 9HdXJoAgVofQ0pxu0iL+AsHfRrhikp1aq9Pr2er2PBkjrpXr21/JWZ4GisTpBJqvTM6t DW0w== X-Gm-Message-State: ALoCoQmFL12+VI9Mw8OSqlgPhqny+GCL9NtDPQT5Y0TSqzNeH/BhoM8KOli5KNgegyqO4YAfjnRs X-Received: by 10.194.249.1 with SMTP id yq1mr3228913wjc.2.1429853656379; Thu, 23 Apr 2015 22:34:16 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.69 with SMTP id kw5ls417997lac.86.gmail; Thu, 23 Apr 2015 22:34:16 -0700 (PDT) X-Received: by 10.152.116.102 with SMTP id jv6mr5425811lab.50.1429853656212; Thu, 23 Apr 2015 22:34:16 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id a9si7486030lbk.31.2015.04.23.22.34.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Apr 2015 22:34:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbbqq2 with SMTP id qq2so28565070lbb.3 for ; Thu, 23 Apr 2015 22:34:15 -0700 (PDT) X-Received: by 10.153.8.167 with SMTP id dl7mr5461360lad.86.1429853655924; Thu, 23 Apr 2015 22:34:15 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp978713lbt; Thu, 23 Apr 2015 22:34:15 -0700 (PDT) X-Received: by 10.70.118.36 with SMTP id kj4mr3002987pdb.52.1429853654150; Thu, 23 Apr 2015 22:34:14 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bd10si15800741pdb.178.2015.04.23.22.34.13; Thu, 23 Apr 2015 22:34:14 -0700 (PDT) Received-SPF: none (google.com: stable-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754569AbbDXFeM (ORCPT + 2 others); Fri, 24 Apr 2015 01:34:12 -0400 Received: from mail-ob0-f180.google.com ([209.85.214.180]:34849 "EHLO mail-ob0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754564AbbDXFeM (ORCPT ); Fri, 24 Apr 2015 01:34:12 -0400 Received: by obcux3 with SMTP id ux3so30223300obc.2 for ; Thu, 23 Apr 2015 22:34:11 -0700 (PDT) X-Received: by 10.182.138.68 with SMTP id qo4mr5733446obb.56.1429853651708; Thu, 23 Apr 2015 22:34:11 -0700 (PDT) Received: from localhost ([167.160.116.36]) by mx.google.com with ESMTPSA id e74sm6088288oib.16.2015.04.23.22.34.09 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 23 Apr 2015 22:34:10 -0700 (PDT) From: shannon.zhao@linaro.org To: stable@vger.kernel.org Cc: jslaby@suse.cz, christoffer.dall@linaro.org, shannon.zhao@linaro.org, Vladimir Murzin Subject: [PATCH for 3.12.y stable 49/63] arm: kvm: fix CPU hotplug Date: Fri, 24 Apr 2015 13:27:47 +0800 Message-Id: <1429853281-6136-50-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1429853281-6136-1-git-send-email-shannon.zhao@linaro.org> References: <1429853281-6136-1-git-send-email-shannon.zhao@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: shannon.zhao@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.217.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Vladimir Murzin commit 37a34ac1d4775aafbc73b9db53c7daebbbc67e6a upstream. On some platforms with no power management capabilities, the hotplug implementation is allowed to return from a smp_ops.cpu_die() call as a function return. Upon a CPU onlining event, the KVM CPU notifier tries to reinstall the hyp stub, which fails on platform where no reset took place following a hotplug event, with the message: CPU1: smp_ops.cpu_die() returned, trying to resuscitate CPU1: Booted secondary processor Kernel panic - not syncing: unexpected prefetch abort in Hyp mode at: 0x80409540 unexpected data abort in Hyp mode at: 0x80401fe8 unexpected HVC/SVC trap in Hyp mode at: 0x805c6170 since KVM code is trying to reinstall the stub on a system where it is already configured. To prevent this issue, this patch adds a check in the KVM hotplug notifier that detects if the HYP stub really needs re-installing when a CPU is onlined and skips the installation call if the stub is already in place, which means that the CPU has not been reset. Signed-off-by: Vladimir Murzin Acked-by: Lorenzo Pieralisi Acked-by: Marc Zyngier Signed-off-by: Christoffer Dall Signed-off-by: Shannon Zhao --- 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 26ca5c6..bac1ba5 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -810,7 +810,8 @@ static int hyp_init_cpu_notify(struct notifier_block *self, switch (action) { case CPU_STARTING: case CPU_STARTING_FROZEN: - cpu_init_hyp_mode(NULL); + if (__hyp_get_vectors() == hyp_default_vectors) + cpu_init_hyp_mode(NULL); break; }