From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6E81C34056 for ; Wed, 19 Feb 2020 19:47:50 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3497F207FD for ; Wed, 19 Feb 2020 19:47:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="spzms7ZF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3497F207FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48N7YH2p6YzDqXq for ; Thu, 20 Feb 2020 06:47:47 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::231; helo=mail-oi1-x231.google.com; envelope-from=radu.rendec@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=spzms7ZF; dkim-atps=neutral Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48N7Wk0cj0zDqN0 for ; Thu, 20 Feb 2020 06:46:23 +1100 (AEDT) Received: by mail-oi1-x231.google.com with SMTP id z2so25026142oih.6 for ; Wed, 19 Feb 2020 11:46:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=5knSbSQijxZC5HFUsAquOUxZL1rUcVluvYQXYeJgsb0=; b=spzms7ZFStDdGcg6RwS0nCJhffhkFMtqAl8wsXV/0mV13bYU9JK1K0Yca2VhCt9DOD iQTujbxr4YcvoqHi8iFGEc7RAWFicLpY6IK+oGJImv6jMkwNpQfzT3awGtwSwzASSWpP 7V43aIY64tCEF1feFR06V7TJEOrOiF6ZBfm252mdnXCnUxvACTPPFJFM/JFm6gUUgRhT Sb9FiVtYLOPws7Y6t2nOSPMPm8LWopj2mcCV7htPibvCQTek9H5FOoM/Tapj/YmwgYZW rCG8rC2mLmis63zTrgO1h37szE89L8CDCvUUB021H4ZVUp1mbzwk74IKSUBFc1nZkRfx B+wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=5knSbSQijxZC5HFUsAquOUxZL1rUcVluvYQXYeJgsb0=; b=kwRI5/1mHr8ArC/RoKzW27veeCLWyxpcZgy+Y+oX3bi0dWWwCRCbjy4xSRsu+V9mU0 15rZcNKKIzKKGNG177PFNWUWB9LQwy7s5ofQWoqx7jIqiUg8uJZsHnjQW3ezrQeVRfCG tSOf4tpfnyM0U80Dl7a3PeRzppEZ/RxoRW3CqSW0EH4jhqn6ZXM4cDYbp6+cfWB58nAd FnGJxGTnjLfai/LQBOMjUtq+7S7VHCfW2qtpbHjkQsH5kf16FOdxlIrIZ+yE5gAxEURY E9Uoej/jJU7/prfkKd2noE+brlvHQqs/qCk8sGu+dv/UO2kPJdTw8h8T64s2pGM6E/0M ndiw== X-Gm-Message-State: APjAAAU6qYqYGYNVCRxzD2DoeHtckyqe5yL6K1RRn0PQwHTSVbbl4TiT CtMZGSVnnNgZuFxHPxB1C5TxfObbTUjbI/hhQjA= X-Google-Smtp-Source: APXvYqzzzF26bBHdJ5gv28LLT3orSkoRJdbEhpTlZLpHzK0Tzgt25s9vmePRmy8uFj6us+9WLfltODWH2Abq+g5S4m0= X-Received: by 2002:a54:4f14:: with SMTP id e20mr5515135oiy.84.1582141581512; Wed, 19 Feb 2020 11:46:21 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Radu Rendec Date: Wed, 19 Feb 2020 14:46:10 -0500 Message-ID: Subject: Re: MCE handler gets NIP wrong on MPC8378 To: Christophe Leroy Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 02/19/2020 at 10:11 AM Radu Rendec wrote: > On 02/18/2020 at 1:08 PM Christophe Leroy wrote= : > > Le 18/02/2020 =C3=A0 18:07, Radu Rendec a =C3=A9crit : > > > The saved NIP seems to be broken inside machine_check_exception() on > > > MPC8378, running Linux 4.9.191. The value is 0x900 most of the times, > > > but I have seen other weird values. > > > > > > I've been able to track down the entry code to head_32.S (vector 0x20= 0), > > > but I'm not sure where/how the NIP value (where the exception occurre= d) > > > is captured. > > > > NIP value is supposed to come from SRR0, loaded in r12 in PROLOG_2 and > > saved into _NIP(r11) in transfer_to_handler in entry_32.S > > > > Can something clobber r12 at some point ? > > > > I did something even simpler: I added the following > > lis r12,0x1234 > > ... right after > > mfspr r12,SPRN_SRR0 > > ... and now the NIP value I see in the crash dump is 0x12340000. This > means r12 is not clobbered and most likely the NIP value I normally see > is the actual SRR0 value. I apologize for the noise. I just found out accidentally that the saved NIP value is correct if interrupts are disabled at the time when the faulty access that triggers the MCE occurs. This seems to happen consistently. By "interrupts are disabled" I mean local_irq_save/local_irq_restore, so it's basically enough to wrap ioread32 to get the NIP value right. Does this make any sense? Maybe it's not a silicon bug after all, or maybe it is and I just found a workaround. Could this happen on other PowerPC CPUs as well? Best regards, Radu