Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/790830/?format=api
{ "id": 790830, "url": "http://patchwork.ozlabs.org/api/1.2/patches/790830/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170719065912.19183-2-npiggin@gmail.com/", "project": { "id": 2, "url": "http://patchwork.ozlabs.org/api/1.2/projects/2/?format=api", "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": "<20170719065912.19183-2-npiggin@gmail.com>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20170719065912.19183-2-npiggin@gmail.com/", "date": "2017-07-19T06:59:10", "name": "[v2,1/3] powerpc/powernv: handle the platform error reboot in ppc_md.restart", "commit_ref": "b746e3e01e70d23ef53dcde1203ab78a1b7ac514", "pull_url": null, "state": "accepted", "archived": false, "hash": "50f2acd480e378b06290c91dc9a1fc8556a3499d", "submitter": { "id": 69518, "url": "http://patchwork.ozlabs.org/api/1.2/people/69518/?format=api", "name": "Nicholas Piggin", "email": "npiggin@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170719065912.19183-2-npiggin@gmail.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/790830/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/790830/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 3xC7K72WnTz9s8P\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 19 Jul 2017 17:03:07 +1000 (AEST)", "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xC7K71NQlzDrVF\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 19 Jul 2017 17:03:07 +1000 (AEST)", "from mail-pg0-x242.google.com (mail-pg0-x242.google.com\n\t[IPv6:2607:f8b0:400e:c05::242])\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 3xC7F01HvnzDrTr\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tWed, 19 Jul 2017 16:59:32 +1000 (AEST)", "by mail-pg0-x242.google.com with SMTP id d193so5805482pgc.2\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 18 Jul 2017 23:59:32 -0700 (PDT)", "from roar.ozlabs.ibm.com. ([122.99.82.10])\n\tby smtp.gmail.com with ESMTPSA id\n\th90sm11326422pfh.133.2017.07.18.23.59.27\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 18 Jul 2017 23:59:28 -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=\"NA3wGJCd\"; 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=\"NA3wGJCd\"; dkim-atps=neutral", "lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"NA3wGJCd\"; 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=orf4ZwosaJfRBo4rtEACMWJDPGx7cDp3LrUoGDBmmKk=;\n\tb=NA3wGJCdjZxkms9Qd2tSGpx10M73xGpBkhIuZBbkWgEAPdrFpHQ/bYQ1t3aT8b3iFe\n\tYeKH3QeLLOv/reEQRdJ99mMKY4EzJCwGzqEYyQDr0rH9W5RtYHgHWZ1Wl/B26uFHOiUY\n\t9Tz3tkfToqt4uYvYhPc22deGfx4p4/BK4MfoM7Q+wRPDYMAY84N4lfNlD5atKV89mr9T\n\t9lOj5wtlqgp+fVXnZkxwj4j3nLwaNiwnYsyXEQWjp0so6fmumne2xfv4hVMwws6NvSrY\n\tWB9tnFr0kRsTrPLgl2ZpjAYIiLpyrVEYrkQm7kFuzMN1rzHnghV7u7F/MEyGZVpaSknm\n\t2cVQ==", "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=orf4ZwosaJfRBo4rtEACMWJDPGx7cDp3LrUoGDBmmKk=;\n\tb=ln8unmRZUtrj9PZjphDGo2T3Amm/GOjX29FJ0Tsd2DotK+FBZTBldayVvP7J7zjuJI\n\t08ujgezTqwc2Ecjx5BTZ0sZtSyJd/h7yhj7kVpA4KPeBPO2+0ubwUXfgBw1+7HmevVw/\n\tVsInMMHmdkyPR6JHh3d5jjwSIJqhFtxGRBZLvbsH5in7ra4dJrAAalIK4nrZnPSsWGuk\n\t53+fBQTFyk674yiGtGUKj+/lw/r1yo49tWm3Jn8p2pdQ0aYgNGDVgbDf9jin3T7jz5eX\n\tHWnalB9DkIKdPfD7tL3ASOhhbs4vw3usonlZsMuXM8Sx3f3C8mqF4LWFeJjGp96M0wun\n\tiNYA==", "X-Gm-Message-State": "AIVw112Pzb0VhUz0goO4DTWPPfpaH0HhvT5hG6Z2qf8TROpJwKnYY7d1\n\tF/kmyODRv7mHJJMs", "X-Received": "by 10.84.209.170 with SMTP id y39mr1260339plh.235.1500447569730; \n\tTue, 18 Jul 2017 23:59:29 -0700 (PDT)", "From": "Nicholas Piggin <npiggin@gmail.com>", "To": "linuxppc-dev@lists.ozlabs.org", "Subject": "[PATCH v2 1/3] powerpc/powernv: handle the platform error reboot in\n\tppc_md.restart", "Date": "Wed, 19 Jul 2017 16:59:10 +1000", "Message-Id": "<20170719065912.19183-2-npiggin@gmail.com>", "X-Mailer": "git-send-email 2.11.0", "In-Reply-To": "<20170719065912.19183-1-npiggin@gmail.com>", "References": "<20170719065912.19183-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": "Unrecovered MCE and HMI errors are sent through a special restart OPAL\ncall to log the platform error. The downside is that they don't go\nthrough normal Linux crash paths, so they don't give much information\nto the Linux console.\n\nChange this by providing a special crash function which does some of\nthe console flushing from the panic() path before calling firmware to\nreboot.\n\nThe downside of this is a little more code to execute before reaching\nthe firmware reboot. However in practice, it's critical to get the\nLinux console messages output in order to debug a problem. So this is\na desirable tradeoff.\n\nNote on the implementation: It is difficult to plumb a custom reboot\nhandler into the panic path, because panic does a little bit too much\nwork. For example, it will try to delay with the timebase, but that\nmay be corrupted in some cases resulting in a hang without reaching\nthe platform reboot. Another problem is that panic can invoke the\ncrash dump code which is not what we want in the case of a hardware\nplatform error. Long-term the best solution will be to rework the\npanic path so it can be suitable for this kind of panic, but for now\nwe just duplicate a bit of the code.\n\nSigned-off-by: Nicholas Piggin <npiggin@gmail.com>\n---\n arch/powerpc/include/asm/opal.h | 2 +-\n arch/powerpc/platforms/powernv/opal-hmi.c | 22 ++------\n arch/powerpc/platforms/powernv/opal.c | 89 ++++++++++++++++++-------------\n arch/powerpc/platforms/powernv/powernv.h | 2 +\n 4 files changed, 57 insertions(+), 58 deletions(-)", "diff": "diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h\nindex 588fb1c23af9..182dab435aad 100644\n--- a/arch/powerpc/include/asm/opal.h\n+++ b/arch/powerpc/include/asm/opal.h\n@@ -50,7 +50,7 @@ int64_t opal_tpo_write(uint64_t token, uint32_t year_mon_day,\n \t\t uint32_t hour_min);\n int64_t opal_cec_power_down(uint64_t request);\n int64_t opal_cec_reboot(void);\n-int64_t opal_cec_reboot2(uint32_t reboot_type, char *diag);\n+int64_t opal_cec_reboot2(uint32_t reboot_type, const char *diag);\n int64_t opal_read_nvram(uint64_t buffer, uint64_t size, uint64_t offset);\n int64_t opal_write_nvram(uint64_t buffer, uint64_t size, uint64_t offset);\n int64_t opal_handle_interrupt(uint64_t isn, __be64 *outstanding_event_mask);\ndiff --git a/arch/powerpc/platforms/powernv/opal-hmi.c b/arch/powerpc/platforms/powernv/opal-hmi.c\nindex 88f3c61eec95..d78fed728cdf 100644\n--- a/arch/powerpc/platforms/powernv/opal-hmi.c\n+++ b/arch/powerpc/platforms/powernv/opal-hmi.c\n@@ -30,6 +30,8 @@\n #include <asm/cputable.h>\n #include <asm/machdep.h>\n \n+#include \"powernv.h\"\n+\n static int opal_hmi_handler_nb_init;\n struct OpalHmiEvtNode {\n \tstruct list_head list;\n@@ -267,8 +269,6 @@ static void hmi_event_handler(struct work_struct *work)\n \tspin_unlock_irqrestore(&opal_hmi_evt_lock, flags);\n \n \tif (unrecoverable) {\n-\t\tint ret;\n-\n \t\t/* Pull all HMI events from OPAL before we panic. */\n \t\twhile (opal_get_msg(__pa(&msg), sizeof(msg)) == OPAL_SUCCESS) {\n \t\t\tu32 type;\n@@ -284,23 +284,7 @@ static void hmi_event_handler(struct work_struct *work)\n \t\t\tprint_hmi_event_info(hmi_evt);\n \t\t}\n \n-\t\t/*\n-\t\t * Unrecoverable HMI exception. We need to inform BMC/OCC\n-\t\t * about this error so that it can collect relevant data\n-\t\t * for error analysis before rebooting.\n-\t\t */\n-\t\tret = opal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR,\n-\t\t\t\"Unrecoverable HMI exception\");\n-\t\tif (ret == OPAL_UNSUPPORTED) {\n-\t\t\tpr_emerg(\"Reboot type %d not supported\\n\",\n-\t\t\t\t\t\tOPAL_REBOOT_PLATFORM_ERROR);\n-\t\t}\n-\n-\t\t/*\n-\t\t * Fall through and panic if opal_cec_reboot2() returns\n-\t\t * OPAL_UNSUPPORTED.\n-\t\t */\n-\t\tpanic(\"Unrecoverable HMI exception\");\n+\t\tpnv_platform_error_reboot(NULL, \"Unrecoverable HMI exception\");\n \t}\n }\n \ndiff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c\nindex 9b87abb178f0..96436d129684 100644\n--- a/arch/powerpc/platforms/powernv/opal.c\n+++ b/arch/powerpc/platforms/powernv/opal.c\n@@ -25,6 +25,10 @@\n #include <linux/memblock.h>\n #include <linux/kthread.h>\n #include <linux/freezer.h>\n+#include <linux/printk.h>\n+#include <linux/kmsg_dump.h>\n+#include <linux/console.h>\n+#include <linux/sched/debug.h>\n \n #include <asm/machdep.h>\n #include <asm/opal.h>\n@@ -436,10 +440,55 @@ static int opal_recover_mce(struct pt_regs *regs,\n \treturn recovered;\n }\n \n+void pnv_platform_error_reboot(struct pt_regs *regs, const char *msg)\n+{\n+\t/*\n+\t * This is mostly taken from kernel/panic.c, but tries to do\n+\t * relatively minimal work. Don't use delay functions (TB may\n+\t * be broken), don't crash dump (need to set a firmware log),\n+\t * don't run notifiers. We do want to get some information to\n+\t * Linux console.\n+\t */\n+\tconsole_verbose();\n+\tbust_spinlocks(1);\n+\tpr_emerg(\"Hardware platform error: %s\\n\", msg);\n+\tif (regs)\n+\t\tshow_regs(regs);\n+\tsmp_send_stop();\n+\tprintk_safe_flush_on_panic();\n+\tkmsg_dump(KMSG_DUMP_PANIC);\n+\tbust_spinlocks(0);\n+\tdebug_locks_off();\n+\tconsole_flush_on_panic();\n+\n+\t/*\n+\t * Don't bother to shut things down because this will\n+\t * xstop the system.\n+\t */\n+\tif (opal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR, msg)\n+\t\t\t\t\t\t== OPAL_UNSUPPORTED) {\n+\t\tpr_emerg(\"Reboot type %d not supported for %s\\n\",\n+\t\t\t\tOPAL_REBOOT_PLATFORM_ERROR, msg);\n+\t}\n+\n+\t/*\n+\t * We reached here. There can be three possibilities:\n+\t * 1. We are running on a firmware level that do not support\n+\t * opal_cec_reboot2()\n+\t * 2. We are running on a firmware level that do not support\n+\t * OPAL_REBOOT_PLATFORM_ERROR reboot type.\n+\t * 3. We are running on FSP based system that does not need\n+\t * opal to trigger checkstop explicitly for error analysis.\n+\t * The FSP PRD component would have already got notified\n+\t * about this error through other channels.\n+\t */\n+\n+\tppc_md.restart(NULL);\n+}\n+\n int opal_machine_check(struct pt_regs *regs)\n {\n \tstruct machine_check_event evt;\n-\tint ret;\n \n \tif (!get_mce_event(&evt, MCE_EVENT_RELEASE))\n \t\treturn 0;\n@@ -455,43 +504,7 @@ int opal_machine_check(struct pt_regs *regs)\n \tif (opal_recover_mce(regs, &evt))\n \t\treturn 1;\n \n-\t/*\n-\t * Unrecovered machine check, we are heading to panic path.\n-\t *\n-\t * We may have hit this MCE in very early stage of kernel\n-\t * initialization even before opal-prd has started running. If\n-\t * this is the case then this MCE error may go un-noticed or\n-\t * un-analyzed if we go down panic path. We need to inform\n-\t * BMC/OCC about this error so that they can collect relevant\n-\t * data for error analysis before rebooting.\n-\t * Use opal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR) to do so.\n-\t * This function may not return on BMC based system.\n-\t */\n-\tret = opal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR,\n-\t\t\t\"Unrecoverable Machine Check exception\");\n-\tif (ret == OPAL_UNSUPPORTED) {\n-\t\tpr_emerg(\"Reboot type %d not supported\\n\",\n-\t\t\t\t\tOPAL_REBOOT_PLATFORM_ERROR);\n-\t}\n-\n-\t/*\n-\t * We reached here. There can be three possibilities:\n-\t * 1. We are running on a firmware level that do not support\n-\t * opal_cec_reboot2()\n-\t * 2. We are running on a firmware level that do not support\n-\t * OPAL_REBOOT_PLATFORM_ERROR reboot type.\n-\t * 3. We are running on FSP based system that does not need opal\n-\t * to trigger checkstop explicitly for error analysis. The FSP\n-\t * PRD component would have already got notified about this\n-\t * error through other channels.\n-\t *\n-\t * If hardware marked this as an unrecoverable MCE, we are\n-\t * going to panic anyway. Even if it didn't, it's not safe to\n-\t * continue at this point, so we should explicitly panic.\n-\t */\n-\n-\tpanic(\"PowerNV Unrecovered Machine Check\");\n-\treturn 0;\n+\tpnv_platform_error_reboot(regs, \"Unrecoverable Machine Check exception\");\n }\n \n /* Early hmi handler called in real mode. */\ndiff --git a/arch/powerpc/platforms/powernv/powernv.h b/arch/powerpc/platforms/powernv/powernv.h\nindex 6dbc0a1da1f6..a159d48573d7 100644\n--- a/arch/powerpc/platforms/powernv/powernv.h\n+++ b/arch/powerpc/platforms/powernv/powernv.h\n@@ -7,6 +7,8 @@ extern void pnv_smp_init(void);\n static inline void pnv_smp_init(void) { }\n #endif\n \n+extern void pnv_platform_error_reboot(struct pt_regs *regs, const char *msg) __noreturn;\n+\n struct pci_dev;\n \n #ifdef CONFIG_PCI\n", "prefixes": [ "v2", "1/3" ] }