Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7259191imm; Tue, 28 Aug 2018 08:55:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZcLf8BXxc3OyvqKTRmZTkyAd+GQgYCUrbnh383hUJJwLhAaIihOXBb4p64ad4jaoyBgEJt X-Received: by 2002:a63:231c:: with SMTP id j28-v6mr2107715pgj.332.1535471723776; Tue, 28 Aug 2018 08:55:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535471723; cv=none; d=google.com; s=arc-20160816; b=bglKQ4Ma6v1EDhAs9ZDauxATpPeKuYREM4yt3Vggz/yVDquy3Pmhh+Rsw6Mjn4MJ0z ziY1q0O9R2kfrAAo9gtBmERLzzJ26IjTJ5FU3JsTyuR9oMAh4PGfB3cAI4AdZ7yVWOY/ uf0jobwrcpny3+lbcLwbs8L8RXShCAznALCC5QT+prlxwXnDlbaRrDZd0rWu2Tf5edaz uoi2RGm8cHpAuLYbFRUbnlbvdcZvoLZfZoU0Huy9oh+aUvPV7RKIKARnA7CxLBBxB8Jq BX+MCWoIJfyh9aDTWRl+E7zWfCbXX0Tl0FKoh6fsxc2pzAg3/JmuERy7BtwLVBlV/Gru SMEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=v7DlR+X3w2iSXdpnzKvqQ9Gurh89PaNCNNksm5sDB9M=; b=gwxFmvcGOfGefYi2m9Zy0lvXXIdHoeFjAweT4u8saZESkx88pyTrRG0b5eOpX10kT0 VUoPrHY+m4tiddKso2NpG8FzKZmxlSf3sxxHuJNSCAt+51yQ4UbPav5OhsFpziJRexqA KkNLpHVcX7gAc94gWvOFLAdEQ4kTxtPPJM2+YFMtdGDUWE78rIPO8s3uS6lpg+LT0/3j ChCqnbMHwxD0eijJXrfcvymy0QEswxrKya+3HAxVLHDvKic4QSRRhv7zqt8WB3DMwhIj DudlkyDa5r/V5Afq6h6b6jCkIHwJNJYuSo53JFaKq8B6Tk6g1yRJI6zXo6LkGNfX/TsN 7wTA== 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 be11-v6si1240396plb.347.2018.08.28.08.55.08; Tue, 28 Aug 2018 08:55:23 -0700 (PDT) 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 S1727955AbeH1TpA (ORCPT + 99 others); Tue, 28 Aug 2018 15:45:00 -0400 Received: from foss.arm.com ([217.140.101.70]:41172 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbeH1To7 (ORCPT ); Tue, 28 Aug 2018 15:44:59 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 927B2174E; Tue, 28 Aug 2018 08:52:42 -0700 (PDT) Received: from e112298-lin.Emea.Arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 80CC23F557; Tue, 28 Aug 2018 08:52:40 -0700 (PDT) From: Julien Thierry To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, daniel.thompson@linaro.org, joel@joelfernandes.org, marc.zyngier@arm.com, mark.rutland@arm.com, christoffer.dall@arm.com, james.morse@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, Julien Thierry , Dave Martin Subject: [PATCH v5 23/27] arm64: Handle serror in NMI context Date: Tue, 28 Aug 2018 16:51:33 +0100 Message-Id: <1535471497-38854-24-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1535471497-38854-1-git-send-email-julien.thierry@arm.com> References: <1535471497-38854-1-git-send-email-julien.thierry@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Per definition of the daifflags, Serrors can occur during any interrupt context, that includes NMI contexts. Trying to nmi_enter in an nmi context will crash. Skip nmi_enter/nmi_exit when serror occurred during an NMI. Suggested-by: James Morse Signed-off-by: Julien Thierry Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Rutland Cc: Dave Martin Cc: James Morse --- arch/arm64/kernel/traps.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index 039e9ff..4955ec6 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -713,13 +713,17 @@ bool arm64_is_fatal_ras_serror(struct pt_regs *regs, unsigned int esr) asmlinkage void do_serror(struct pt_regs *regs, unsigned int esr) { - nmi_enter(); + const bool was_in_nmi = in_nmi(); + + if (!was_in_nmi) + nmi_enter(); /* non-RAS errors are not containable */ if (!arm64_is_ras_serror(esr) || arm64_is_fatal_ras_serror(regs, esr)) arm64_serror_panic(regs, esr); - nmi_exit(); + if (!was_in_nmi) + nmi_exit(); } void __pte_error(const char *file, int line, unsigned long val) -- 1.9.1