Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1715991imm; Sat, 13 Oct 2018 02:17:09 -0700 (PDT) X-Google-Smtp-Source: ACcGV62UpRj7O8UvQBmHdec8xLp8dlZ5KaXILMFNzyOVwrzk5XvJ7RN9yVptXgg4Vruj5ZCPGY3f X-Received: by 2002:a17:902:d88b:: with SMTP id b11-v6mr9092871plz.136.1539422229548; Sat, 13 Oct 2018 02:17:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539422229; cv=none; d=google.com; s=arc-20160816; b=09iFlbL0RT/g1dBrAm1POnXwjc7ujvC9yvR/Vj3OsUekCFqRLytC8yIUKfSTH8h8Rk Vhu0ah9bU6SYDJq95bFPGAqwakRmnFAhPPV2+4ZNHHe2yk/X1CZLWBLgWsSWeHR/ddAk e5zsEGmbwzRpIP1wUZLdkfD/pgh2wSLyZr6XWObYX2PTNkGeTM5nolf5IR8B18QTlP6A BBX/XUAosMLMkkph6PPclCeUnan4OO+Bc70AzWK6nSv/309g+/Tp7sgNoJiixi2eVx9w SPbKiOrWbMqhwp6mWv2BkW93lHHX9Xey5zDPK2VrbIHiod+p5k4VaJi/xCt4NSM6cpnk MZmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:message-id; bh=Oc1D2LCZeWEb3sbWWGO2xcDUeonqfOaawgH1qMbAtUY=; b=mPdGFq/7U/OKM2JQkYJ9Y4IOYa8iOhW2xUU85hBC0FYtFVpIcRMuQWkzu4na5nHbrA 1BQ2021I8ZS/zzSUixsgHnxbYs51gx28GyF5gI5xncKli/m1xTS80CviAxoCpHEyhAsc q139zXecfQbJ1LNtSHESmSIjX0On0WpzNnVEComu2Cq+2yofVZdcuBLKQ3odSdDVZEld LMw7FlAdG0dXtXZqjziL5xsvXWE5Cfz0WSfleBWKGVaWW6APdxE5l1Nkt82aDsK/KoWJ KfkUc9Sx3Vmf0ISu8Z4qxlxyVHCL9dYKuw4gAO/Jg6kYfh7mTSfQl8igsxvhgBW1GnBH EjvA== 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 s17-v6si3376092pgv.445.2018.10.13.02.16.54; Sat, 13 Oct 2018 02:17:09 -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 S1726786AbeJMQws (ORCPT + 99 others); Sat, 13 Oct 2018 12:52:48 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:12748 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726123AbeJMQws (ORCPT ); Sat, 13 Oct 2018 12:52:48 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 42XJwd4y0Gz9ttFt; Sat, 13 Oct 2018 11:16:17 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id xl_QyuytFTXF; Sat, 13 Oct 2018 11:16:17 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 42XJwd4P8Qz9ttFr; Sat, 13 Oct 2018 11:16:17 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E454B8B782; Sat, 13 Oct 2018 11:16:22 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id E8m8eOxeGacV; Sat, 13 Oct 2018 11:16:22 +0200 (CEST) Received: from pc13168vm.idsi0.si.c-s.fr (unknown [192.168.232.3]) by messagerie.si.c-s.fr (Postfix) with ESMTP id A195C8B74B; Sat, 13 Oct 2018 11:16:22 +0200 (CEST) Received: by pc13168vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 605656F2BD; Sat, 13 Oct 2018 09:16:22 +0000 (UTC) Message-Id: From: Christophe Leroy Subject: [PATCH] powerpc/traps: restore recoverability of machine_check interrupts To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , npiggin@gmail.com Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Sat, 13 Oct 2018 09:16:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit b96672dd840f ("powerpc: Machine check interrupt is a non- maskable interrupt") added a call to nmi_enter() at the beginning of machine check restart exception handler. Due to that, in_interrupt() always returns true regardless of the state before entering the exception, and die() panics even when the system was not already in interrupt. This patch calls nmi_exit() before calling die() in order to restore the interrupt state we had before calling nmi_enter() Fixes: b96672dd840f ("powerpc: Machine check interrupt is a non-maskable interrupt") Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/traps.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index fd58749b4d6b..4f880c2a6e4c 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c @@ -765,12 +765,17 @@ void machine_check_exception(struct pt_regs *regs) if (check_io_access(regs)) goto bail; - die("Machine check", regs, SIGBUS); - /* Must die if the interrupt is not recoverable */ if (!(regs->msr & MSR_RI)) nmi_panic(regs, "Unrecoverable Machine check"); + if (!nested) + nmi_exit(); + + die("Machine check", regs, SIGBUS); + + return; + bail: if (!nested) nmi_exit(); -- 2.13.3