From patchwork Mon Feb 17 01:02:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 1238919 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48LQh869nyz9sRJ for ; Mon, 17 Feb 2020 12:02:48 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=lgvOQgzB; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48LQh85mMnzDqC5 for ; Mon, 17 Feb 2020 12:02:48 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::642; helo=mail-pl1-x642.google.com; envelope-from=oohall@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=lgvOQgzB; dkim-atps=neutral Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) (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 48LQh064dTzDq8W for ; Mon, 17 Feb 2020 12:02:40 +1100 (AEDT) Received: by mail-pl1-x642.google.com with SMTP id ay11so6036174plb.0 for ; Sun, 16 Feb 2020 17:02:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JT5jtHXomcTXUnnGbjlj+i/H67KTT6fwHb24aqJCORE=; b=lgvOQgzB86HsVmdorGDSG6ucdn6JEW+4i9KVbFlS6tOXsHrfLw7rfy82579MXR9RS0 U2TnqZ0CSbjmXux5F2MsxNyIneuTMYcLLHSfb/8RZjac3m/UUDn2OjylMom6/WMJfqcp H9PiD4Px5VUngvn1RXgewwehsInTCUcITZhCsH+8rlcuRMN7IF5FxZQUerLXX/g0CRoC 3E5eiq4IZNaT5AAn4qjw4AuCnfwzPCOTj38I4bYNa3BULadssu9qdSwV8rG/J9eAUkQH ecrJrIq+PGAipg+cH0axP04oPZkCzqkOjNMDTtlY56WjA0bNssPlBzBfIKcnjQnooNlg U0Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JT5jtHXomcTXUnnGbjlj+i/H67KTT6fwHb24aqJCORE=; b=oU4p5IZpnC9I45U9gpB0M+go+EhR/yZmE/AU0fL/CuyziOXN0Qe+1de/PYqbqCekka mive6Zj6Oj4Q/R4eKeb2O7i4g3/Fnutil0a/ZTYpwXaSIRZ0qbUfbC0toOWgoVzrBFrr Q/CyibUKPY2n01B27tud5mAAXx55JpeIRw9NYPFEzjAJYTIdXxfnGzkgjLQn45GS7ATK E8U5enqZN3LAB0PB1HkiluBKjNR84vybLxwwMkiW4Orgb2esiEkimIaW04E7De7Q2wOy qkPfw5G8bCcnkQqnvBFuKOK8r5CN71CbDhjk1rSqR6rj3Hg1lJ7jE/8OE6OEvnv5k8di FPuA== X-Gm-Message-State: APjAAAUuB84H++58FhGDe4csKDPqasvlvxguFM+UaDYSEsHqENu1GxXO PWN34k3Mj8daS3FzuhoH1jrzz/kF X-Google-Smtp-Source: APXvYqwWWn4MgF3r9pK/5zpBxOQ1QtwTGpVgAavFjPKQJxQpyeTCyfSBMv7lsKkwvdTBxciePi+k7w== X-Received: by 2002:a17:90a:8a98:: with SMTP id x24mr17787908pjn.113.1581901356594; Sun, 16 Feb 2020 17:02:36 -0800 (PST) Received: from wafer.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id i11sm14600061pjg.0.2020.02.16.17.02.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Feb 2020 17:02:36 -0800 (PST) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Mon, 17 Feb 2020 12:02:23 +1100 Message-Id: <20200217010224.26285-1-oohall@gmail.com> X-Mailer: git-send-email 2.21.1 MIME-Version: 1.0 Subject: [Skiboot] [PATCH 1/2] core/platform: Add an explicit fast-reboot type X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" The OPAL_CEC_REBOOT2 OPAL call allows a specific type of reboot to be requested. We can use this to allow the OS to request a fast-reboot explicitly rather than relying on nvram hacks to change the default behaviour. Signed-off-by: Oliver O'Halloran --- core/platform.c | 4 ++++ include/opal-api.h | 1 + 2 files changed, 5 insertions(+) diff --git a/core/platform.c b/core/platform.c index 97bc7cb6fa1e..99cf5c985399 100644 --- a/core/platform.c +++ b/core/platform.c @@ -116,6 +116,10 @@ static int64_t opal_cec_reboot2(uint32_t reboot_type, char *diag) opal_cec_reboot(); for (;;); break; + case OPAL_REBOOT_FAST: + prlog(PR_NOTICE, "Reboot: Fast reboot requested by OS\n"); + fast_reboot(); + break; default: prlog(PR_NOTICE, "OPAL: Unsupported reboot request %d\n", reboot_type); return OPAL_UNSUPPORTED; diff --git a/include/opal-api.h b/include/opal-api.h index 5b07dea1321b..e425d79f209a 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -1135,6 +1135,7 @@ enum { OPAL_REBOOT_PLATFORM_ERROR, OPAL_REBOOT_FULL_IPL, OPAL_REBOOT_MPIPL, + OPAL_REBOOT_FAST, }; /* Argument to OPAL_PCI_TCE_KILL */ From patchwork Mon Feb 17 01:02:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 1238920 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48LQhS3jkRz9sRJ for ; Mon, 17 Feb 2020 12:03:04 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=P8N5HQE8; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48LQhS3621zDqdD for ; Mon, 17 Feb 2020 12:03:04 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::443; helo=mail-pf1-x443.google.com; envelope-from=oohall@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=P8N5HQE8; dkim-atps=neutral Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) (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 48LQh330QnzDq63 for ; Mon, 17 Feb 2020 12:02:43 +1100 (AEDT) Received: by mail-pf1-x443.google.com with SMTP id k29so7929836pfp.13 for ; Sun, 16 Feb 2020 17:02:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jkhqHVenxM51MIeas/uivbbYXfpm0hZtfrHFeNTBuHw=; b=P8N5HQE8XrujLDNNcjqVSmLIEu5OzDMAGtQFHrl8UH9fZACqjjHKhBi8doyO+cuXgE PPlMBDzPBbTe8SQxIniJjo9/p+BWCZIHYHSN8PYeKuWfYD0qDNQ/CkSRglyrkvEqk/FG FvxFMnE5+h5A3yC+FW7Oa9JTfTSfgIKK2oQbTeydGWhnDBhjfVHzLZH6a0gyVOcVl+EG Uu5Sa+5zsZIHWZh2soCLS8Pau+9WfnSJeGADngvw03IsnZaamBdP7WXyPJrsSEFghQyx 1HI8UQisxq9EU8slCPyIeCpgQehs3Epz8cnasdE93HoHJWNwKVunxJs1MbZIPWxYCcoY OWtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jkhqHVenxM51MIeas/uivbbYXfpm0hZtfrHFeNTBuHw=; b=rOO0yOtULdQrRL268bOkT+USAKPUQlhA7Uah2zZqfRzUFbgB6W9fR/qYw0R3JpPPpF FtC7KBYXehiexAld/YihuDnuO6mVD1ORZjUuYs/mujjxWrKU//kEtRD8jNd4UQLycUn/ 4JqhdA4U6Z0BwMbZF9DPjB/RJ93bwmyUzPray2vNaaGj1hnt/ks2EWbbJhnK0jTW8/Gm XNvckyWlFp1xczFBk1NrqY2HBHV6DSvJp2HQdcUdv46kd1Y8EzuES3OzLg6H/rPjEw/L qcVZWtIQNe9Cx1ANnTg3wDKQwcAc0HEi8nmi19Nn4HbS/VRc5xtOY+p4auSlFjIevWTe 21Ww== X-Gm-Message-State: APjAAAW11G9eIWnZxqmTGij33y8V5kuYiJyEgqHsmxcK7/xRgP9cF9d8 FrN+5tjN9oUvjqQR0ACrFgov3ZbW X-Google-Smtp-Source: APXvYqx7FbmSjZbqM4GIrN5AfK9KzXWbnsxi+0GU7/YwnbSIEsqEowFZl7z8MQaw3JdtFyhXRkYX6A== X-Received: by 2002:a63:ba03:: with SMTP id k3mr15910952pgf.52.1581901360251; Sun, 16 Feb 2020 17:02:40 -0800 (PST) Received: from wafer.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id i11sm14600061pjg.0.2020.02.16.17.02.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Feb 2020 17:02:39 -0800 (PST) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Mon, 17 Feb 2020 12:02:24 +1100 Message-Id: <20200217010224.26285-2-oohall@gmail.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200217010224.26285-1-oohall@gmail.com> References: <20200217010224.26285-1-oohall@gmail.com> MIME-Version: 1.0 Subject: [Skiboot] [PATCH 2/2] core/fast-reset: Do not enable by default X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Fast reboot started life as a debug hack and it escaped into the wild when Stewart enabled it by default. There was some reasons for this, but the main one is that a full reboot takes somewhere between one and five minutes. For those of us who spend all day rebooting their POWER systems this is great, but the utility for end users has always been pretty questionable. Rebooting a system should be a fairly infrequent activity in the field with the main reasons for doing one being: 1) Kernel updates, 2) Misbehaving hardware Although 1) can be performed by kexec we have found that it fails due to 2) occasionally. The reason for 2) is usually hardware getting itself into a bad state. The universal fix for that type of hardware problem is turning the hardware off and back on again so it's preferable that a reboot actually does that. This patch refactors the reboot handling OPAL calls so that fast-reboot is only used by default when explicitly enabled, or manually invoked. This allows developers to continue to use fast-reboot without expecting users deal with its quirks (and understand how a "normal" reboot, fast-reboot and MPIPL differ). This has two user visible changes: 1. Full reboot is now the default. In order to get fast-reboot as the default the nvram option needs to be set: nvram -p ibm,skiboot --update-config fast-reset=1 2. The nvram option to force a fast-reboot even when some part of skiboot has called disable_fast_reboot() has changed from 'fast-reset=im-feeling-lucky' to 'force-fast-reset=1' because it's impossible to actually use that 'feature' if fast-reboot is off by default. nvram -p ibm,skiboot --update-config force-fast-reset=1 Cc: Stewart Smith Signed-off-by: Oliver O'Halloran --- While we're here should we change it so that the nvram option is fast-reboot rather than fast-reset? It's called fast-reboot everywhere *except* the nvram flag and it always screws me up. --- core/fast-reboot.c | 2 +- core/platform.c | 43 ++++++++++++++++++++++++------------------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/core/fast-reboot.c b/core/fast-reboot.c index 410acfe637ce..b60ddf3c4322 100644 --- a/core/fast-reboot.c +++ b/core/fast-reboot.c @@ -118,7 +118,7 @@ void fast_reboot(void) } if (fast_reboot_disabled && - nvram_query_eq_dangerous("fast-reset", "im-feeling-lucky")) { + nvram_query_eq_dangerous("force-fast-reset", "1")) { /* Do fast reboot even if it's been disabled */ prlog(PR_NOTICE, "RESET: Ignoring fast reboot disabled: %s\n", fast_reboot_disabled); diff --git a/core/platform.c b/core/platform.c index 99cf5c985399..853b4a4acc3f 100644 --- a/core/platform.c +++ b/core/platform.c @@ -48,25 +48,10 @@ static int64_t opal_cec_power_down(uint64_t request) } opal_call(OPAL_CEC_POWER_DOWN, opal_cec_power_down, 1); -static int64_t opal_cec_reboot(void) +static int64_t full_reboot(void) { prlog(PR_NOTICE, "OPAL: Reboot request...\n"); - opal_quiesce(QUIESCE_HOLD, -1); - - if (proc_gen == proc_gen_p8) { - /* - * Bugs in P8 mean fast reboot isn't 100% reliable when cores - * are busy, so only attempt if explicitly *enabled*. - */ - if (nvram_query_eq_safe("fast-reset", "1")) - fast_reboot(); - - } else if (!nvram_query_eq_safe("fast-reset", "0")) { - /* Try fast-reset unless explicitly disabled */ - fast_reboot(); - } - console_complete_flush(); if (platform.cec_reboot) @@ -74,6 +59,26 @@ static int64_t opal_cec_reboot(void) return OPAL_SUCCESS; } + +static int64_t opal_cec_reboot(void) +{ + opal_quiesce(QUIESCE_HOLD, -1); + + /* + * Fast-reset was enabled by default for a long time in an attempt to + * make it more stable by exercising it more frequently. This resulted + * in a fair amount of pain due to mis-behaving hardware and confusion + * about what a "reset" is supposed to do exactly. Additionally, + * secure variables require a full reboot to work at all. + * + * Due to all that fast-reset should only be used if it's explicitly + * enabled. It started life as a debug hack and should remain one. + */ + if (nvram_query_eq_safe("fast-reset", "1")) + fast_reboot(); + + return full_reboot(); +} opal_call(OPAL_CEC_REBOOT, opal_cec_reboot, 0); static int64_t opal_cec_reboot2(uint32_t reboot_type, char *diag) @@ -105,15 +110,15 @@ static int64_t opal_cec_reboot2(uint32_t reboot_type, char *diag) console_complete_flush(); return xscom_trigger_xstop(); case OPAL_REBOOT_FULL_IPL: - disable_fast_reboot("full IPL reboot requested"); - return opal_cec_reboot(); + prlog(PR_NOTICE, "Reboot: Full reboot requested"); + return full_reboot(); case OPAL_REBOOT_MPIPL: prlog(PR_NOTICE, "Reboot: OS reported error. Performing MPIPL\n"); console_complete_flush(); if (platform.terminate) platform.terminate("OS reported error. Performing MPIPL\n"); else - opal_cec_reboot(); + full_reboot(); for (;;); break; case OPAL_REBOOT_FAST: