Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1596232imd; Sun, 4 Nov 2018 06:03:20 -0800 (PST) X-Google-Smtp-Source: AJdET5e3spV1y8oAgmAbAnr+Z6JTUqNl2SVEF0IL+fpWWz6/HRCjvYpXeliDODrOoo5hBDy50Mcm X-Received: by 2002:a17:902:f209:: with SMTP id gn9mr17887990plb.6.1541340200600; Sun, 04 Nov 2018 06:03:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541340200; cv=none; d=google.com; s=arc-20160816; b=bVp6wm8CaUOTfLHpKoW4EyD1k8I1TfqfMuoqAgbhXweOCUlrTM8KjW1bEsIgxg+6a4 FnP/D8994XOLCT1aZly2hghBJghzSOZNxdCunwQ1BzgBjsn2of2SapwaH9gGOOL9JQJw pLgY3oJ+bCeYxF7xPhaeepk7b0mxFhA+gwfXVfwlNxXGUKo6+1MEEBLE0uxXqmhmGzO6 7+8sXeNVjPZ2Dj3L+f6eSJfrb8J6nYSk2jk4LLvjV5MKwydTAVYewzD0PSm7WlevT1e/ sBJBa4KRZ1ICAGHIRQ9WGt29CF9vkpIKKA9Cen44WzG/bCF/wyfvYaLV4fIwrOsETLn6 pMWg== 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:dkim-signature; bh=vRFaUaijCalVOqLrBI0FxfAZ2js9GHle30VdX2MN2s0=; b=hMXPFIjmmlU4dT6WLp063HPLPSJ7sgkMqVAfC80dIt+O6RCUauIaeWrsFQkd1BjEvy 6lGraTiA8a9sWYo7189lQQTbGgL839vQGMsV2klvZaK+XbLJugGL5cponIn6beaKG+R6 9uLWP/15ut0doIs8kCEJ1IllS00dBhliUdGgvp5nNo6ua/haHKbPA18yB62erDGuHm56 kEU7qPmDTpD0OtbIXXmuPZDk0F7ksLoQy2AdvioFiqNV4xlnnLUoTG1PLu3T3XiLsQ/y KP6h47i1O6Mj/WEROMAYsO02B898Y6Ekm/8YQF0Lsg9fjC9Jnf7qXxRJDWnU8hOn6C7q heSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="zn8ON/cV"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d37-v6si30195731plb.167.2018.11.04.06.03.05; Sun, 04 Nov 2018 06:03:20 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b="zn8ON/cV"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731575AbeKDXQE (ORCPT + 99 others); Sun, 4 Nov 2018 18:16:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:47446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731181AbeKDXIg (ORCPT ); Sun, 4 Nov 2018 18:08:36 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F2A5C2085A; Sun, 4 Nov 2018 13:53:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541339612; bh=mEU8TXZ04pa/CbsjhN99lZQNZWuQSfhnoMTgtblGISg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zn8ON/cVEwX6UaZgTRkqR1jSsob3qbLHlfjY7CIMb8gH/qSx0TvwvIhvP6eXCAMJV ni10G1HKHHlCX99pQStWwJOaDXbG55B66Lgad670d5hUBkbJbGmvGG5ZG/wJ18tpF8 yvceVQeGVJGEZCAZcVETAOn3zW1qDTmo0l2PJkFM= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH AUTOSEL 4.14 05/30] powerpc/traps: restore recoverability of machine_check interrupts Date: Sun, 4 Nov 2018 08:53:00 -0500 Message-Id: <20181104135325.88524-5-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181104135325.88524-1-sashal@kernel.org> References: <20181104135325.88524-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe Leroy [ Upstream commit daf00ae71dad8aa05965713c62558aeebf2df48e ] 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 Reviewed-by: Nicholas Piggin Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- 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 ac2e5e56a9f0..a5f2b7593976 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c @@ -694,12 +694,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.17.1