From 1b83bb93b8d8465bb7a9243fcb106981290ba6bc Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 17 May 2022 16:54:01 +0000 Subject: [PATCH] ppc64le: make ofdisk_retries optional Resolves: #2070725 Signed-off-by: Robbie Harwood --- 0231-make-ofdisk_retries-optional.patch | 45 +++++++++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 +++- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 0231-make-ofdisk_retries-optional.patch diff --git a/0231-make-ofdisk_retries-optional.patch b/0231-make-ofdisk_retries-optional.patch new file mode 100644 index 0000000..ac0bb44 --- /dev/null +++ b/0231-make-ofdisk_retries-optional.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Diego Domingos +Date: Thu, 24 Mar 2022 13:14:42 -0400 +Subject: [PATCH] make ofdisk_retries optional + +The feature Retry on Fail added to GRUB can cause a LPM to take +longer if the SAN is slow. + +When a LPM to external site occur, the path of the disk can change +and thus the disk search function on grub can take some time since +it is used as a hint. This can cause the Retry on Fail feature to +try to access the disk 20x times (since this is hardcoded number) +and, if the SAN is slow, the boot time can increase a lot. +In some situations not acceptable. + +The following patch enables a configuration at user space of the +maximum number of retries we want for this feature. + +The variable ofdisk_retries should be set using grub2-editenv +and will be checked by retry function. If the variable is not set, +so the default number of retries will be used instead. + +(cherry picked from commit 4c5c7563f45a6410667ca08bcbfac4ab79d7de31) +--- + include/grub/ieee1275/ofdisk.h | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/include/grub/ieee1275/ofdisk.h b/include/grub/ieee1275/ofdisk.h +index 7d2d540930..0074d55eee 100644 +--- a/include/grub/ieee1275/ofdisk.h ++++ b/include/grub/ieee1275/ofdisk.h +@@ -25,7 +25,12 @@ extern void grub_ofdisk_fini (void); + #define MAX_RETRIES 20 + + +-#define RETRY_IEEE1275_OFDISK_OPEN(device, last_ihandle) unsigned retry_i=0;for(retry_i=0; retry_i < MAX_RETRIES; retry_i++){ \ ++#define RETRY_IEEE1275_OFDISK_OPEN(device, last_ihandle) \ ++ unsigned max_retries = MAX_RETRIES; \ ++ if(grub_env_get("ofdisk_retries") != NULL) \ ++ max_retries = grub_strtoul(grub_env_get("ofdisk_retries"), 0, 10)+1; \ ++ grub_dprintf("ofdisk","MAX_RETRIES set to %u\n",max_retries); \ ++ unsigned retry_i=0;for(retry_i=0; retry_i < max_retries; retry_i++){ \ + if(!grub_ieee1275_open(device, last_ihandle)) \ + break; \ + grub_dprintf("ofdisk","Opening disk %s failed. Retrying...\n",device); } diff --git a/grub.patches b/grub.patches index 60477c2..7239000 100644 --- a/grub.patches +++ b/grub.patches @@ -228,3 +228,4 @@ Patch0227: 0227-efi-new-connectefi-command.patch Patch0228: 0228-powerpc-do-CAS-in-a-more-compatible-way.patch Patch0229: 0229-powerpc-prefix-detection-support-device-names-with-c.patch Patch0230: 0230-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch +Patch0231: 0231-make-ofdisk_retries-optional.patch diff --git a/grub2.spec b/grub2.spec index 0a8701f..758ee50 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 30%{?dist} +Release: 32%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue May 17 2022 Robbie Harwood - 2.06-32 +- ppc64le: make ofdisk_retries optional +- Resolves: #2070725 + * Wed May 04 2022 Robbie Harwood - 2.06-30 - ppc64le: CAS improvements, prefix detection, and vTPM support - Resolves: #2068281