From patchwork Tue Jun 30 10:48:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 50453 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 9AAEC229DF for ; Tue, 30 Jun 2015 10:50:17 +0000 (UTC) Received: by wguu7 with SMTP id u7sf2507564wgu.0 for ; Tue, 30 Jun 2015 03:50: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=NWDNXhFhFci9Z4dkv/ETwb6RG2uCbRFCTJVRY7VT4+g=; b=E+xXOgUUtodiFG7j5HZrNrS/pYBm6is4PnUFMP2sODjuYebLhyLBsMiDQSuDTNFjSX drcBWkUAMkrLHhhrhnyVDd3kQVL5Eaa7QOMMatgMiDoI6ATojUrngI+u3gCs9v2WXeoi ev2TOJQp4mTQ5IFCjzNi8LawvSPgK9KMZHa3ceS/VNR5VAcWbrgnMi0dRMyQa08M/H6X AE7fIWcmBnM7rMW+OtJFKNtzPpDybaO5aDaV0EggH3F+ouvvIYuOjqGyMUJ00Wz0PItv ntG/pAaV90QzKDPwuSYRy5+MDpiK5cxa18NqFen/TDNVSRhQB487wZNPbau2f6K81TJk jS4Q== X-Gm-Message-State: ALoCoQkSq6OQjTDBz/pMVPcyDiOJeK9taRMXD+niux/Usqgwpuu3GxW/7ZtoJpKCxPpdcmHq0+wM X-Received: by 10.112.26.5 with SMTP id h5mr13792765lbg.4.1435661416584; Tue, 30 Jun 2015 03:50:16 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.103 with SMTP id r7ls21620lah.106.gmail; Tue, 30 Jun 2015 03:50:16 -0700 (PDT) X-Received: by 10.152.23.167 with SMTP id n7mr18973868laf.108.1435661416365; Tue, 30 Jun 2015 03:50:16 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id j5si37758673laf.127.2015.06.30.03.50.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jun 2015 03:50:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by lagh6 with SMTP id h6so8087982lag.2 for ; Tue, 30 Jun 2015 03:50:16 -0700 (PDT) X-Received: by 10.152.179.234 with SMTP id dj10mr19003164lac.73.1435661415990; Tue, 30 Jun 2015 03:50: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.108.230 with SMTP id hn6csp2352615lbb; Tue, 30 Jun 2015 03:50:14 -0700 (PDT) X-Received: by 10.67.4.201 with SMTP id cg9mr42475479pad.53.1435661414166; Tue, 30 Jun 2015 03:50:14 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5si66313267par.87.2015.06.30.03.50.13; Tue, 30 Jun 2015 03:50:14 -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 S1751269AbbF3KuM (ORCPT + 2 others); Tue, 30 Jun 2015 06:50:12 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:33472 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750980AbbF3KuL (ORCPT ); Tue, 30 Jun 2015 06:50:11 -0400 Received: by pdjd13 with SMTP id d13so4337251pdj.0 for ; Tue, 30 Jun 2015 03:50:10 -0700 (PDT) X-Received: by 10.68.69.11 with SMTP id a11mr11118315pbu.169.1435661410806; Tue, 30 Jun 2015 03:50:10 -0700 (PDT) Received: from localhost ([120.136.36.232]) by mx.google.com with ESMTPSA id yn5sm45606895pac.48.2015.06.30.03.50.08 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 30 Jun 2015 03:50:09 -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 05/22] arm: kvm: fix CPU hotplug Date: Tue, 30 Jun 2015 18:48:53 +0800 Message-Id: <1435661350-8060-6-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1435661350-8060-1-git-send-email-shannon.zhao@linaro.org> References: <1435661350-8060-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.45 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; }