From patchwork Tue Feb 28 02:00:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 733259 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vXMM52XL9z9s8W for ; Tue, 28 Feb 2017 13:04:01 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Bu6iVqa0"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3vXMM51HZQzDqHs for ; Tue, 28 Feb 2017 13:04:01 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Bu6iVqa0"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pf0-x242.google.com (mail-pf0-x242.google.com [IPv6:2607:f8b0:400e:c00::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3vXMHm5ffszDqGk for ; Tue, 28 Feb 2017 13:01:08 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Bu6iVqa0"; dkim-atps=neutral Received: by mail-pf0-x242.google.com with SMTP id o64so5401969pfb.1 for ; Mon, 27 Feb 2017 18:01:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CnMh7SW3tyDQDUtG8mii4EEUuFAgDl7znUY6CElJJu8=; b=Bu6iVqa0Eto4posLLwu4vuISoXPFANsIGuGF8PXrY0sEXVsn19NEwIOl+Xn7bfRPtK o12QfJTSKiExSlDEj7WbZ7Fl5YP1Hdm2VllDIeBXO1NmyMZNBL/xJSKSDuLlUYhkGefw rjfhyQrKSwPseJCOcrajRz9KbQdJq69uO9chYyPG27ee+NRhZgrTHgfxdtj2G82Jaqzb pUfukFQbX6Ld6yPJ+27v3BgPZw+Sy1Jst38v6yhycnPYFl6UDfD4KLa/P9SxnadzgTYu 3BI63N9W0VgVXphkLEpWPEwClqDox2J9uUV30jPvH4aW7UgZRAIeAtSooq6pFN1D6i3s ZiRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CnMh7SW3tyDQDUtG8mii4EEUuFAgDl7znUY6CElJJu8=; b=q98JvaPQQWBUClmtpsm5wvpK7aHHfmg9y74v/tfT4eJ4kOrgT6UHSP2LZgJY/uz3Q0 11Js7K9LRscD7g0dVAza2+A8gLhhZpt7BX+SkoNzt3G9UK8qzBBAhHBhkOfx7EI5P03y Li5J3Ap3Z+Zrj3qK/dNo0nGenWW8AxjrLhLa/fazNcY+BT5uZxmkhZyjilCtpUVCDovM B92PdzQf5p20Ft2QBXM/V5NYNl2uAEfuTCPTvwI43OlHDbjqCw4mwI6D7zmAQysEcNhT ob6HUr/kGu+1KQV2U6i1CphbBzyW/5aP7zwDtgcyOhcTQijorvK/TRlqtXrZZ6SX/m+/ q/xQ== X-Gm-Message-State: AMke39m1K8AvFAj52nP5NBzVsMWdmISS1SZjthwSwJKAQj7Ga9NDRYarHCOsjTZ3voM4Vg== X-Received: by 10.99.175.67 with SMTP id s3mr24482912pgo.185.1488247266699; Mon, 27 Feb 2017 18:01:06 -0800 (PST) Received: from roar.au.ibm.com ([203.221.48.234]) by smtp.gmail.com with ESMTPSA id z189sm231186pgb.3.2017.02.27.18.01.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Feb 2017 18:01:05 -0800 (PST) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 1/3] powerpc/64s: fix handling of non-synchronous machine checks Date: Tue, 28 Feb 2017 12:00:46 +1000 Message-Id: <20170228020048.8862-2-npiggin@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170228020048.8862-1-npiggin@gmail.com> References: <20170228020048.8862-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin , Mahesh Salgaonkar Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" A synchronous machine check is an exception raised by the attempt to execute the current instruction. If the error can't be corrected, it can make sense to SIGBUS the currently running process. In other cases, the error condition is not related to the current instruction, so killing the current process is not the right thing to do. Today, all machine checks are MCE_SEV_ERROR_SYNC, so this has no practical change. It will be used to handle POWER9 asynchronous machine checks. Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/powernv/opal.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index 86d9fde93c17..e0f856bfbfe8 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -395,7 +395,6 @@ static int opal_recover_mce(struct pt_regs *regs, struct machine_check_event *evt) { int recovered = 0; - uint64_t ea = get_mce_fault_addr(evt); if (!(regs->msr & MSR_RI)) { /* If MSR_RI isn't set, we cannot recover */ @@ -404,26 +403,18 @@ static int opal_recover_mce(struct pt_regs *regs, } else if (evt->disposition == MCE_DISPOSITION_RECOVERED) { /* Platform corrected itself */ recovered = 1; - } else if (ea && !is_kernel_addr(ea)) { + } else if (evt->severity == MCE_SEV_FATAL) { + /* Fatal machine check */ + pr_err("Machine check interrupt is fatal\n"); + recovered = 0; + } else if ((evt->severity == MCE_SEV_ERROR_SYNC) && + (user_mode(regs) && !is_global_init(current))) { /* - * Faulting address is not in kernel text. We should be fine. - * We need to find which process uses this address. * For now, kill the task if we have received exception when * in userspace. * * TODO: Queue up this address for hwpoisioning later. */ - if (user_mode(regs) && !is_global_init(current)) { - _exception(SIGBUS, regs, BUS_MCEERR_AR, regs->nip); - recovered = 1; - } else - recovered = 0; - } else if (user_mode(regs) && !is_global_init(current) && - evt->severity == MCE_SEV_ERROR_SYNC) { - /* - * If we have received a synchronous error when in userspace - * kill the task. - */ _exception(SIGBUS, regs, BUS_MCEERR_AR, regs->nip); recovered = 1; }