From patchwork Mon Feb 20 19:44:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 730175 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 3vRvRy3sp0z9s9j for ; Tue, 21 Feb 2017 06:52:46 +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="L2tDXL8j"; 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 3vRvRy2DhyzDqKx for ; Tue, 21 Feb 2017 06:52:46 +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="L2tDXL8j"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::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 3vRvH31LJ5zDqHB for ; Tue, 21 Feb 2017 06:45:03 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="L2tDXL8j"; dkim-atps=neutral Received: by mail-pg0-x242.google.com with SMTP id s67so3636972pgb.1 for ; Mon, 20 Feb 2017 11:45:03 -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=dCUU0Hpk9VdN5gVoAY7ZPWoudvZiKL45l3eNyfTcyWU=; b=L2tDXL8jFScI+Lf6U0rGbh+taNGlD499FL1m8S0UJNe9LYnDACHg4CZmasafFOIxtD 3epiVU6fa467/8zJuq7/i/3gW+8zcXXTS+fGFdj+yXo4lNk6+txt2yLgGAl6+7RsBrck rleNe44FNZkzJx0Yir3tyN/k00QmgyRn84j8IcRIM6uA+MeF22sudJKGsRbV3/B6cmkR TZmrus2/gkhhpO6UK2ZMeJyFhUGIPqLNaNiHRbrr/QHYCQx8RhIn07Myi+NUa9Rg04ku XxqsCjYkRNOm7KIL+SxajyOjR6kVVpGHQUK7V9fppWO/zCn5DIASRoBKKFbzetBxq3mm NGKA== 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=dCUU0Hpk9VdN5gVoAY7ZPWoudvZiKL45l3eNyfTcyWU=; b=NwM0BW+SyuNsWFRlLtjfTijdsw/X9hOOhPCR6WmcP/f7gJUuFLpVJmqCqqUDbTbbJL fZm4LvRFdzhbM5OZW2Ihkds8s5kNbc2eAiAxAhbkVO3PMeRZ+Sy4l8oUVJi8QfhoZRh8 LpBsQgdBYkMDgYistYVTj+r+uQUjDYR2mylwywo2cJnGQEhRXEXleC1gSIBSkt4csger iqLHItCi0bife2VFEb9wN72WZvZT75pw3qYxzkGJbQ/WYe2oniLRjdUXw47X16vnKUXc xI3Nsq06qpL6xRyHA4DsAuDTZR2bodC2zttQVV3KmRkV14OP3Sqn6+T4ox4JAXrqbmRW oB3A== X-Gm-Message-State: AMke39ms8U8gpIxPjCrpP4QzdhwEDiWQE1QPTrqlazVO2Z/Lu7jh97n2X0FIIGGSCWylBw== X-Received: by 10.99.4.196 with SMTP id 187mr15326498pge.77.1487619901585; Mon, 20 Feb 2017 11:45:01 -0800 (PST) Received: from roar.au.ibm.com ([203.221.48.234]) by smtp.gmail.com with ESMTPSA id i10sm36813303pgd.37.2017.02.20.11.44.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Feb 2017 11:45:00 -0800 (PST) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 4/9] powerpc/64s: cope with non-synchronous machine checks Date: Tue, 21 Feb 2017 05:44:25 +1000 Message-Id: <20170220194430.32602-5-npiggin@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170220194430.32602-1-npiggin@gmail.com> References: <20170220194430.32602-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" Asynchronous machine checks don't correspond to the instruction or even task that is currently running. Therefore only synchronous machine checks should attempt to kill the currently running task to recover. Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/powernv/opal.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index 282293572dc8..f47430b417d2 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,17 @@ 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) { + /* Async or otherwise fatal machine check */ + pr_err("Machine check interrupt unrecoverable\n"); + recovered = 0; + } else if (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; }