From patchwork Mon May 4 01:52:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 47968 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3982E2121F for ; Mon, 4 May 2015 01:55:56 +0000 (UTC) Received: by wgin8 with SMTP id n8sf40687698wgi.0 for ; Sun, 03 May 2015 18:55:55 -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=i/dTSNKBq7i+PsKygwuGRdhb40E2pRuFoydevvQG5poeJU+l71cRV578LWztz5uYJm +iLNYq3gQCudkp/QgQ1CZJo9ZOoNMxJwPPRVsmoFBpy8yeU4I5I9gHmb+Awx1sTJZcqT Ms4EkNrGXjPSiKrJWmKcKjREh9Pczhs+W57uctGifwMh7ai9MD6LZInk2K/CVoTdWaN+ 5gnP5eB0MDLneBsmQB2dfzeIA/xOBzT39fGzxRWFunk2mQMEpywi70Goyc9xCX74gv92 rHwgUW8MaUaoKG1I9majp37bVdAPcCuvKLsKgq1gpAdvBki0C+Fw2CS0e9eoclg4QWIh wHIg== X-Gm-Message-State: ALoCoQkYrmGnDMz1srsn6GuP7exHi5F/eGN+uK5JWRl97Xgy4+cEJROsS5yeEKQ7K02YM/V4965r X-Received: by 10.112.189.131 with SMTP id gi3mr16953560lbc.6.1430704555535; Sun, 03 May 2015 18:55:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.9 with SMTP id 9ls789764laq.89.gmail; Sun, 03 May 2015 18:55:55 -0700 (PDT) X-Received: by 10.112.185.100 with SMTP id fb4mr17752577lbc.79.1430704555399; Sun, 03 May 2015 18:55:55 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id o2si9103225laj.20.2015.05.03.18.55.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 May 2015 18:55:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by labbd9 with SMTP id bd9so95100166lab.2 for ; Sun, 03 May 2015 18:55:55 -0700 (PDT) X-Received: by 10.152.87.204 with SMTP id ba12mr17957326lab.35.1430704555300; Sun, 03 May 2015 18:55:55 -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 l1csp1413051lbt; Sun, 3 May 2015 18:55:54 -0700 (PDT) X-Received: by 10.70.43.225 with SMTP id z1mr37705800pdl.45.1430704553535; Sun, 03 May 2015 18:55:53 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ix6si17838787pac.46.2015.05.03.18.55.52; Sun, 03 May 2015 18:55:53 -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 S1751923AbbEDBzw (ORCPT + 2 others); Sun, 3 May 2015 21:55:52 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:35349 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751954AbbEDBzv (ORCPT ); Sun, 3 May 2015 21:55:51 -0400 Received: by pabtp1 with SMTP id tp1so147822925pab.2 for ; Sun, 03 May 2015 18:55:51 -0700 (PDT) X-Received: by 10.70.87.231 with SMTP id bb7mr37773849pdb.70.1430704551498; Sun, 03 May 2015 18:55:51 -0700 (PDT) Received: from localhost ([180.150.153.1]) by mx.google.com with ESMTPSA id fe3sm11003947pbd.76.2015.05.03.18.55.49 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 03 May 2015 18:55:50 -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 30/47] arm: kvm: fix CPU hotplug Date: Mon, 4 May 2015 09:52:25 +0800 Message-Id: <1430704362-6292-31-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1430704362-6292-1-git-send-email-shannon.zhao@linaro.org> References: <1430704362-6292-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.42 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; }