{"id":784405,"url":"http://patchwork.ozlabs.org/api/1.2/patches/784405/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170705035627.19563-4-npiggin@gmail.com/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/1.2/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<20170705035627.19563-4-npiggin@gmail.com>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20170705035627.19563-4-npiggin@gmail.com/","date":"2017-07-05T03:56:27","name":"[v2,3/3] powerpc: do not send system reset request through the oops path","commit_ref":"4388c9b3a6ee7d6afc36c8a0bb5579b1606229b5","pull_url":null,"state":"accepted","archived":false,"hash":"7934d2edf8d8e339a89f0b87305695762abbf584","submitter":{"id":69518,"url":"http://patchwork.ozlabs.org/api/1.2/people/69518/?format=json","name":"Nicholas Piggin","email":"npiggin@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170705035627.19563-4-npiggin@gmail.com/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/784405/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/784405/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3x2Rzm0Z07z9sBR\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed,  5 Jul 2017 14:03:00 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3x2Rzl6dVjzDqyc\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed,  5 Jul 2017 14:02:59 +1000 (AEST)","from mail-pg0-x241.google.com (mail-pg0-x241.google.com\n\t[IPv6:2607:f8b0:400e:c05::241])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3x2Rrh2W87zDr1n\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tWed,  5 Jul 2017 13:56:52 +1000 (AEST)","by mail-pg0-x241.google.com with SMTP id u36so29558362pgn.3\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 04 Jul 2017 20:56:52 -0700 (PDT)","from roar.au.ibm.com (59-102-83-48.tpgi.com.au. [59.102.83.48])\n\tby smtp.gmail.com with ESMTPSA id\n\tu9sm47797908pfg.127.2017.07.04.20.56.47\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 04 Jul 2017 20:56:49 -0700 (PDT)"],"Authentication-Results":["ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"QkGZZTkD\"; dkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"QkGZZTkD\"; dkim-atps=neutral","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"QkGZZTkD\"; dkim-atps=neutral"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=PdKfubyjV133ULjSEcPebBbxfH+dASJ7RjRx0x1geg8=;\n\tb=QkGZZTkDAWDrt0kOvLVdmo3F2azIAzpiCQxtt+yt+73oCrD+Gg1jNXAbcv46s0sC4R\n\tGqyXUTjEPi8Vu9OhEtLtBfhfF4jM1pDfet1NMAsfb+poucimWWvx3W5d3Zd8A18HYGwe\n\t+q6sUB3zsABMeuYLpNkiu5IaCxe1olI0SZ2c+olh1vbAsTExlr3wRQHXn4MAUsLGeSyv\n\trSa2TYwOVF4lNfTyT4I1+kNqvnTnZ+39W0iVIUkeZHmOuA8bsLmNqU/9CGgOsS7gwSY6\n\tPceeBK+yfTMKpjyEkKyiKYhfdHE/6/Mx9R4dCrVBv7HpawvIcVeVhOh5zL8QSbiO+fMl\n\tRoWw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=PdKfubyjV133ULjSEcPebBbxfH+dASJ7RjRx0x1geg8=;\n\tb=ODHlYsthoz30cz4CUefvwvXPcITRF887tA1RQqDdPg8wPub10yeBNq9CVI7Mcg7X/r\n\tQW5j2bGuHXJ49bO40Uc/hko6cppIo/wN6gMRQDjWDDmPeb5eFjFJwo1XhCJ030bKGyMD\n\tvyN8GMjY2r0daX1Pg34bge1G5PNZNHbc7jWLZHwIHzSXDQ70BNFGbgnSXqb/Rl6PWN/F\n\tHH4wzaNEpCUneOi79Vt27cXphe+7UmMr5npHS4WcAIaqX7hk8/IYfGqQ/NVugvgveAd+\n\trJeiTFBfGEtk/+8Wp9iorbG7BGFFDNEMyFHRj/5XQ0bw4vLRqhj3K7thK2NkDFGNKWgE\n\tbuDw==","X-Gm-Message-State":"AIVw1103RYWt+1vMiKqaFj/vcOWEXWBvGN6OCN4fAuchfJbsJ5GxzoLj\n\t9JCFR4MCat+XZA8B","X-Received":"by 10.84.131.6 with SMTP id 6mr20260497pld.33.1499227010323;\n\tTue, 04 Jul 2017 20:56:50 -0700 (PDT)","From":"Nicholas Piggin <npiggin@gmail.com>","To":"linuxppc-dev@lists.ozlabs.org","Subject":"[PATCH v2 3/3] powerpc: do not send system reset request through the\n\toops path","Date":"Wed,  5 Jul 2017 13:56:27 +1000","Message-Id":"<20170705035627.19563-4-npiggin@gmail.com>","X-Mailer":"git-send-email 2.11.0","In-Reply-To":"<20170705035627.19563-1-npiggin@gmail.com>","References":"<20170705035627.19563-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\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"Nicholas Piggin <npiggin@gmail.com>,\n\tMahesh Jagannath Salgaonkar <mahesh@linux.vnet.ibm.com>","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"},"content":"A system reset is a request to crash / debug the system rather than\nnecessarily caused by encountering a BUG. So there is no need to\nserialize all CPUs behind the die lock, adding taints to all subsequent\ntraces beyond the first, breaking console locks, etc.\n\nThe system reset is NMI context which has its own printk buffers to\nprevent output being interleaved. Then it's better to have all\nsecondaries print out their debug as quickly as possible and the primary\nwill flush out all printk buffers during panic().\n\nSo remove the 0x100 path from die, and move it into system_reset. Name\nthe crash/dump reasons \"System Reset\".\n\nThis gives \"not tained\" traces when crashing an untainted kernel. It\nalso gives the panic reason as \"System Reset\" as opposed to \"Fatal\nexception in interrupt\" (or \"die oops\" for fadump).\n\nSigned-off-by: Nicholas Piggin <npiggin@gmail.com>\n---\n arch/powerpc/kernel/traps.c | 47 ++++++++++++++++++++++++++++++---------------\n 1 file changed, 31 insertions(+), 16 deletions(-)","diff":"diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c\nindex bfcfd9ef09f2..574e949f8db9 100644\n--- a/arch/powerpc/kernel/traps.c\n+++ b/arch/powerpc/kernel/traps.c\n@@ -162,21 +162,9 @@ static void oops_end(unsigned long flags, struct pt_regs *regs,\n \n \tcrash_fadump(regs, \"die oops\");\n \n-\t/*\n-\t * A system reset (0x100) is a request to dump, so we always send\n-\t * it through the crashdump code.\n-\t */\n-\tif (kexec_should_crash(current) || (TRAP(regs) == 0x100)) {\n+\tif (kexec_should_crash(current))\n \t\tcrash_kexec(regs);\n \n-\t\t/*\n-\t\t * We aren't the primary crash CPU. We need to send it\n-\t\t * to a holding pattern to avoid it ending up in the panic\n-\t\t * code.\n-\t\t */\n-\t\tcrash_kexec_secondary(regs);\n-\t}\n-\n \tif (!signr)\n \t\treturn;\n \n@@ -294,17 +282,44 @@ void system_reset_exception(struct pt_regs *regs)\n \t\t\tgoto out;\n \t}\n \n-\tdie(\"System Reset\", regs, SIGABRT);\n+\tif (debugger(regs))\n+\t\tgoto out;\n+\n+\t/*\n+\t * A system reset is a request to dump, so we always send\n+\t * it through the crashdump code (if fadump or kdump are\n+\t * registered).\n+\t */\n+\tcrash_fadump(regs, \"System Reset\");\n+\n+\tcrash_kexec(regs);\n+\n+\t/*\n+\t * We aren't the primary crash CPU. We need to send it\n+\t * to a holding pattern to avoid it ending up in the panic\n+\t * code.\n+\t */\n+\tcrash_kexec_secondary(regs);\n+\n+\t/*\n+\t * No debugger or crash dump registered, print logs then\n+\t * panic.\n+\t */\n+\t__die(\"System Reset\", regs, SIGABRT);\n+\n+\tmdelay(2*MSEC_PER_SEC); /* Wait a little while for others to print */\n+\tadd_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);\n+\tnmi_panic(regs, \"System Reset\");\n \n out:\n #ifdef CONFIG_PPC_BOOK3S_64\n \tBUG_ON(get_paca()->in_nmi == 0);\n \tif (get_paca()->in_nmi > 1)\n-\t\tpanic(\"Unrecoverable nested System Reset\");\n+\t\tnmi_panic(regs, \"Unrecoverable nested System Reset\");\n #endif\n \t/* Must die if the interrupt is not recoverable */\n \tif (!(regs->msr & MSR_RI))\n-\t\tpanic(\"Unrecoverable System Reset\");\n+\t\tnmi_panic(regs, \"Unrecoverable System Reset\");\n \n \tif (!nested)\n \t\tnmi_exit();\n","prefixes":["v2","3/3"]}