From patchwork Fri Sep 23 18:44:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 9348589 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2FB526077A for ; Fri, 23 Sep 2016 18:45:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BFAF2A1D6 for ; Fri, 23 Sep 2016 18:45:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E2E22AD53; Fri, 23 Sep 2016 18:45:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 621C52A1D6 for ; Fri, 23 Sep 2016 18:45:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034614AbcIWSpL (ORCPT ); Fri, 23 Sep 2016 14:45:11 -0400 Received: from mout.gmx.net ([212.227.17.20]:65505 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753191AbcIWSpL (ORCPT ); Fri, 23 Sep 2016 14:45:11 -0400 Received: from ls3530.box ([92.203.55.246]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0MbaS9-1bUTBA3auz-00J6Lp; Fri, 23 Sep 2016 20:45:02 +0200 Date: Fri, 23 Sep 2016 20:44:57 +0200 From: Helge Deller To: linux-parisc@vger.kernel.org, James Bottomley , John David Anglin Subject: [PATCH] parisc: Report trap type as human readable string Message-ID: <20160923184457.GA14114@ls3530.box> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Provags-ID: V03:K0:Qr4NzP8vevUBRnOeiNBrzI/g0DGRKMj1Q525+7OVuxlkMAwVnBM p4v7wjov9/6/9/xi2syBiK0r93XTgkmkxUHfsm0MDHxEIIZplSFyhYyMbdp7S3gir0el5XI KTmqQlTe8T6TNMZOpZ8bB/E7Wl0xcXMt/rqiGQQlQ16WEt6TrnBBLUd6Toqxa9iiLp5f3tg XtBXtdc5Twu3hQJJzLe+A== X-UI-Out-Filterresults: notjunk:1; V01:K0:wlGaFFn7qic=:wEOs7jKodzVvhNJCkUathl 3TTdCmnh3UuZw9bU6QICfdgvN6jW4L01IkhEKmrvYvz5GRGydm90D6PE/hVupWN0JIZFEdg+E 7+9KalTR3ZyLPSxsnsKDBt9US7Cub6JAZcXqGCiK2GWG9hm21n/jdz6+mUBqWZrzjGXyPFA/Q TY8IuKJbnmY4CY4+/cZzcIqFi2YR67Gs1n/wxIQKQVJeMKpdqWaxxNqBke13wHDEc6cPKWsA5 gX2Kp4ENdqb+TthjqUHmeasxaxCOh0NPHa98wQis+xoLBanMJCMtuJ2FCCvucz5BRVldITNy4 wo47IbL++SMolpVrvcxURM/vWJ5mkJiBzlrXp9978p7F2J9ClThCP6ed4W7sUkALOYWSDHuep 6dFjn2GKtxIbsVF6D3N9rPYRgyVQrCgOG+ofzv6oN5817H2u8XfZQasFvVrJ/+47IB04IU45e FUkMALLQ8LnRhJsgfA7F2pU465fl/9BDppGnBfhXS8RHk5EMC5km9jXhiNGgW2VGWifqbYYFz L0XzlEd2esrIcoNdueG+vKbWg+IaGKRkrhLHIOgqffEyYvMi9f8quxRAtPlc0MXfJdqBy/12U JvyMDflS8WhzCVyBLeeJZcBfo9mBc5zlyohLSDOaCfmphYUUxwyc1Ihe0XAq+Lsg2EiKVi2P+ zGKCew95NEb+OuaWptcm9B/+od+CL4hhHmPBfjk1iG/w1Snv9rJZlTnSMjRZoXFghQbZfY5bB oswqMGDkpf7f8IgFp3PrTxOdtmn1KaFhyynD4DaeE7jhXam/3NB2tlqm44M= Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When faulting on some trap, the kernel currently reports in dmesg: do_page_fault() command='perl' type=6 address=0xbe400403 in libcrypt-2.24.so[f9086000+9000] vm_start = 0x00922000, vm_end = 0x00aed000 With this change the trap type additionally gets reported as human readable string which makes it simpler to recognize the type of problem: do_page_fault() command='perl' type=6 address=0xbe400403 in libcrypt-2.24.so[f9086000+9000] Instruction TLB miss fault, vm_start = 0x00922000, vm_end = 0x00aed000 Signed-off-by: Helge Deller --- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index 16dbe81..bdbd73b 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c @@ -168,6 +168,43 @@ int fixup_exception(struct pt_regs *regs) } /* + * parisc hardware trap list + * + * Documented in section 3 "Addressing and Access Control" of the + * "PA-RISC 1.1 Architecture and Instruction Set Reference Manual" + * https://parisc.wiki.kernel.org/index.php/File:Pa11_acd.pdf + * + * For implementation see handle_interruption() in traps.c + */ +static const char * const trap_description[] = { + [1] "High-priority machine check (HPMC)", + [2] "Power failure interrupt", + [3] "Recovery counter trap", + [5] "Low-priority machine check", + [6] "Instruction TLB miss fault", + [7] "Instruction access rights / protection trap", + [8] "Illegal instruction trap", + [9] "Break instruction trap", + [10] "Privileged operation trap", + [11] "Privileged register trap", + [12] "Overflow trap", + [13] "Conditional trap", + [14] "FP Assist Exception trap", + [15] "Data TLB miss fault", + [16] "Non-access ITLB miss fault", + [17] "Non-access DTLB miss fault", + [18] "Data memory protection/unaligned access trap", + [19] "Data memory break trap", + [20] "TLB dirty bit trap", + [21] "Page reference trap", + [22] "Assist emulation trap", + [25] "Taken branch trap", + [26] "Data memory access rights trap", + [27] "Data memory protection ID trap", + [28] "Unaligned data reference trap", +}; + +/* * Print out info about fatal segfaults, if the show_unhandled_signals * sysctl is set: */ @@ -176,6 +213,8 @@ show_signal_msg(struct pt_regs *regs, unsigned long code, unsigned long address, struct task_struct *tsk, struct vm_area_struct *vma) { + const char *trap_name = NULL; + if (!unhandled_signal(tsk, SIGSEGV)) return; @@ -186,6 +225,12 @@ show_signal_msg(struct pt_regs *regs, unsigned long code, pr_warn("do_page_fault() command='%s' type=%lu address=0x%08lx", tsk->comm, code, address); print_vma_addr(KERN_CONT " in ", regs->iaoq[0]); + + if (code < ARRAY_SIZE(trap_description)) + trap_name = trap_description[code]; + if (trap_name) + pr_warn(" %s%c", trap_name, vma ? ',':'\n'); + if (vma) pr_warn(" vm_start = 0x%08lx, vm_end = 0x%08lx\n", vma->vm_start, vma->vm_end);