From patchwork Tue Jun 2 14:48:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 49390 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A0CA520BD1 for ; Tue, 2 Jun 2015 14:50:33 +0000 (UTC) Received: by wibbk2 with SMTP id bk2sf31695477wib.2 for ; Tue, 02 Jun 2015 07:50:33 -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=NWDNXhFhFci9Z4dkv/ETwb6RG2uCbRFCTJVRY7VT4+g=; b=ixTDDp2l2Vm3I2OE2ekalPXwTHt4vwItXUvUg8NhvdNhfigMxRwUJ/6bN7FN5MY+QY bVFnPfyc53rCeNq5ngcWFH+oZ7jcvCO+l09+h7NgevIcAjxVSrAm+4zZ7v4dIjwEi9xm x8bkZWYfmLT6bbPCAXSEKPdgczfLZIhf5LI8IyZVAdI4esTZRF/mOlcPb3dniL4wiCfA hCQw8xG986kILAjoRpc2kq3HsXfvdUulcAVn5rpiR7hKFCDsPN3ZNMmcbPpY/99+/7+R bdCI1DRpyFxeE2vw4zC8QjQDYzHCK2FgrNuXKwOZ0+tjzv2kFInJBbxklbh2kp8bvj5T lrhA== X-Gm-Message-State: ALoCoQlduhwop8U86qYoq7sTuuyhmcbVqlA0M9IV/oEfUbEGLxDrijQNtvUt2zDdgLcmrvqf6ame X-Received: by 10.112.97.210 with SMTP id ec18mr26152015lbb.15.1433256632959; Tue, 02 Jun 2015 07:50:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.65 with SMTP id o1ls803605laj.108.gmail; Tue, 02 Jun 2015 07:50:32 -0700 (PDT) X-Received: by 10.112.159.9 with SMTP id wy9mr21981888lbb.120.1433256632777; Tue, 02 Jun 2015 07:50:32 -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 aw7si15281115lbc.80.2015.06.02.07.50.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jun 2015 07:50:32 -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 laei3 with SMTP id i3so39645806lae.3 for ; Tue, 02 Jun 2015 07:50:32 -0700 (PDT) X-Received: by 10.112.155.197 with SMTP id vy5mr26273586lbb.29.1433256632675; Tue, 02 Jun 2015 07:50:32 -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.108.230 with SMTP id hn6csp3129096lbb; Tue, 2 Jun 2015 07:50:31 -0700 (PDT) X-Received: by 10.66.255.67 with SMTP id ao3mr50392203pad.60.1433256630856; Tue, 02 Jun 2015 07:50:30 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hv8si26697315pdb.173.2015.06.02.07.50.30; Tue, 02 Jun 2015 07:50:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759024AbbFBOu3 (ORCPT + 2 others); Tue, 2 Jun 2015 10:50:29 -0400 Received: from mail-ob0-f170.google.com ([209.85.214.170]:33412 "EHLO mail-ob0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759013AbbFBOu2 (ORCPT ); Tue, 2 Jun 2015 10:50:28 -0400 Received: by obbnx5 with SMTP id nx5so129186795obb.0 for ; Tue, 02 Jun 2015 07:50:28 -0700 (PDT) X-Received: by 10.202.196.211 with SMTP id u202mr21809150oif.10.1433256628443; Tue, 02 Jun 2015 07:50:28 -0700 (PDT) Received: from localhost ([167.160.116.34]) by mx.google.com with ESMTPSA id oy10sm9571248obb.1.2015.06.02.07.50.26 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 02 Jun 2015 07:50:27 -0700 (PDT) From: shannon.zhao@linaro.org To: stable@vger.kernel.org Cc: gregkh@linuxfoundation.org, christoffer.dall@linaro.org, shannon.zhao@linaro.org, Vladimir Murzin Subject: [PATCH for 3.14.y stable 15/32] arm: kvm: fix CPU hotplug Date: Tue, 2 Jun 2015 22:48:10 +0800 Message-Id: <1433256507-7856-16-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1433256507-7856-1-git-send-email-shannon.zhao@linaro.org> References: <1433256507-7856-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.215.50 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 55c1ebf..fb9c291 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -825,7 +825,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; }