Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3487664imd; Mon, 29 Oct 2018 07:53:41 -0700 (PDT) X-Google-Smtp-Source: AJdET5cV8GdTcq1blOMaNHLTqwGuMT9eIE7Q6yqyHWhqEODWO4uKQcmP/Co/PYQdKhFy4uDQvJBz X-Received: by 2002:a63:5a08:: with SMTP id o8mr13873283pgb.185.1540824821908; Mon, 29 Oct 2018 07:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540824821; cv=none; d=google.com; s=arc-20160816; b=pPqQ1v4+HoD+27H7uxih998pQcQhv4QET0O/z1Fw9EMCcu9cDCJt86EvkdqUNI2gtH 15oDkr9x6w/MXWkRu1NVPEFDEDmiiTGCdBGFrvZjj9dgmjSX6WNB/p/phJ7zErkak8Et dYr+8o73vsmlgchsG4nXet0TRxB+Motlsws1M5nYjz6op0R7FzBAzrkxhC5wve97vyDR rOgzB5zcUw64Mfi0axpv0cUSpMuy/nCxpBRYpeBYhIuhWMoyhLxegTuJByocsHtL4FNI CLGV3Y8FCtpx3tSgOF80dOx9GuSbFyoyGwC8zm5JEpI7lDPdTeeCdZMZt+Y51rkAhvnB OzuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=N9ELJtJM1/eKUwMPybB6A54ObmomJj2aC5mfdA6ei8A=; b=NywahuvVCP07hhwEgnYPR2IUEaRY+UxENNzI7Nu5O0KwmSRIKHy0rA2x1fgj8hVhiH ggQkIDv1oCaDe1RIx/rhZzCJSt7bTPhnLk376LpAVfvt12jWz1z5UjCKdFpa3RYYxlo1 tVlKu9QoYGElrw3PnX1DBmUGhiFFFG3IBg4anh8QhGFK8mlp/t8h5bn7wayvKDowF2vo xrVlpMd0xzpdXJFAXkiumenyqhYXmY8I+LDjBsz/nrqVxTirMoqOfJG9F1mPotjsx2bK t35VgyySCeNy/dfliv8lqhHXvLeD3Q5xRe1Ih6zjkrgaorN/A0DyM6ga0IHaikh+GLvs Kd3Q== 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 u9-v6si1335576plm.284.2018.10.29.07.53.25; Mon, 29 Oct 2018 07:53:41 -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 S1727606AbeJ2XlC (ORCPT + 99 others); Mon, 29 Oct 2018 19:41:02 -0400 Received: from foss.arm.com ([217.140.101.70]:41706 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726035AbeJ2XlC (ORCPT ); Mon, 29 Oct 2018 19:41:02 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 71103341; Mon, 29 Oct 2018 07:52:04 -0700 (PDT) Received: from [10.1.196.75] (e110467-lin.cambridge.arm.com [10.1.196.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1896D3F71D; Mon, 29 Oct 2018 07:52:02 -0700 (PDT) Subject: Re: [PATCH] arm: mm: fault: check ADFSR in case of abort To: "Wiebe, Wladislav (Nokia - DE/Ulm)" , "linux@armlinux.org.uk" , "tony@atomide.com" , "akpm@linux-foundation.org" , "ebiederm@xmission.com" , "jrdr.linux@gmail.com" , "linux-arm-kernel@lists.infradead.org" Cc: "linux-kernel@vger.kernel.org" References: From: Robin Murphy Message-ID: Date: Mon, 29 Oct 2018 14:52:01 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/10/2018 14:20, Wiebe, Wladislav (Nokia - DE/Ulm) wrote: > When running into situations like: > "Unhandled fault: synchronous external abort (0x210) at 0xXXX" > or > "Unhandled prefetch abort: synchronous external abort (0x210) at 0xXXX" > it is useful to know the content of ADFSR (Auxiliary Data Fault Status > Register) to indicate an ECC double-bit error in L1 or L2 cache. > > Refer to: > Cortex-A15 Technical Reference Manual, Revision: r2p1 > [6.4.8. Error Correction Code] The contents of ADFSR are implementation-defined, though, so this interpretation is *only* valid on Cortex-A15. Other processors may use those bit positions to report something else, at which point printing a message about ECC errors would be totally misleading. Robin. > Signed-off-by: Wladislav Wiebe > --- > arch/arm/mm/fault.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c > index 3232afb6fdc0..5e240deb6ed6 100644 > --- a/arch/arm/mm/fault.c > +++ b/arch/arm/mm/fault.c > @@ -547,6 +547,22 @@ hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int, struct pt_regs *) > fsr_info[nr].name = name; > } > > +/* > + * Check for ECC double-bit errors in Auxiliary Data Fault Status Register > + */ > +static void check_adfsr_for_ecc(void) > +{ > + u32 adfsr = 0; > + > + asm("mrc p15, 0, %0, c5, c1, 0" : "=r" (adfsr)); > + > + if (adfsr & (BIT(31) | BIT(23))) { > + pr_alert("ADFSR status 0x%x indicates that an L1 or L2 cache\n" > + "ECC double-bit error occurred at some time.\n", > + adfsr); > + } > +} > + > /* > * Dispatch a data abort to the relevant handler. > */ > @@ -559,6 +575,7 @@ do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs) > if (!inf->fn(addr, fsr & ~FSR_LNX_PF, regs)) > return; > > + check_adfsr_for_ecc(); > pr_alert("Unhandled fault: %s (0x%03x) at 0x%08lx\n", > inf->name, fsr, addr); > show_pte(current->mm, addr); > @@ -593,6 +610,7 @@ do_PrefetchAbort(unsigned long addr, unsigned int ifsr, struct pt_regs *regs) > if (!inf->fn(addr, ifsr | FSR_LNX_PF, regs)) > return; > > + check_adfsr_for_ecc(); > pr_alert("Unhandled prefetch abort: %s (0x%03x) at 0x%08lx\n", > inf->name, ifsr, addr); > >