[SeaBIOS] [PATCH] boot: add config option for fast device init

Gerd Hoffmann posted 1 patch 5 months, 4 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/seabios tags/patchew/20210323141836.865691-1-kraxel@redhat.com
src/boot.c  |  2 ++
src/Kconfig | 10 ++++++++++
2 files changed, 12 insertions(+)

[SeaBIOS] [PATCH] boot: add config option for fast device init

Posted by Gerd Hoffmann 5 months, 4 weeks ago
Add a config option for fast device init (i.e. skip non-bootable
devices).  This optimization breaks boot in some rare configurations,
specifically in case the boot loader needs access to secondary disks.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 src/boot.c  |  2 ++
 src/Kconfig | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/src/boot.c b/src/boot.c
index 1effd802ce06..771d2382e38f 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -299,6 +299,8 @@ u8 is_bootprio_strict(void)
 {
     static int prio_halt = -2;
 
+    if (!CONFIG_BOOT_FAST_INIT)
+        return 0;
     if (prio_halt == -2)
         prio_halt = find_prio("HALT");
     return prio_halt >= 0;
diff --git a/src/Kconfig b/src/Kconfig
index 3a8ffa15fded..6b750a41b42c 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -72,6 +72,16 @@ endchoice
         help
             Support controlling of the boot order via the fw_cfg/CBFS
             "bootorder" file.
+    config BOOT_FAST_INIT
+        depends on BOOTORDER
+        bool "Fast boot device init"
+        default y
+        help
+            Skip initialization for devices without bootindex.  Speeds
+            up boot and reduced memory footprint, but may cause boot
+            problems in case the bootloader needs access to secondary
+            disks.
+
     config HOST_BIOS_GEOMETRY
         depends on BOOT
         bool "Boot device bios geometry override"
-- 
2.30.2

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org

[SeaBIOS] Re: [PATCH] boot: add config option for fast device init

Posted by Paul Menzel 5 months, 4 weeks ago
Dear Gerd,


On 2021-03-23 15:18, Gerd Hoffmann wrote:
> Add a config option for fast device init (i.e. skip non-bootable
> devices).  This optimization breaks boot in some rare configurations,
> specifically in case the boot loader needs access to secondary disks.

Thank you for the patch. Could you please elaborate and describe your
test setup and how much the boot time is decreased?

> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  src/boot.c  |  2 ++
>  src/Kconfig | 10 ++++++++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/src/boot.c b/src/boot.c
> index 1effd802ce06..771d2382e38f 100644
> --- a/src/boot.c
> +++ b/src/boot.c
> @@ -299,6 +299,8 @@ u8 is_bootprio_strict(void)
>  {
>      static int prio_halt = -2;
>  
> +    if (!CONFIG_BOOT_FAST_INIT)

Maybe print a debug message?

> +        return 0;
>      if (prio_halt == -2)
>          prio_halt = find_prio("HALT");
>      return prio_halt >= 0;
> diff --git a/src/Kconfig b/src/Kconfig
> index 3a8ffa15fded..6b750a41b42c 100644
> --- a/src/Kconfig
> +++ b/src/Kconfig
> @@ -72,6 +72,16 @@ endchoice
>          help
>              Support controlling of the boot order via the fw_cfg/CBFS
>              "bootorder" file.
> +    config BOOT_FAST_INIT
> +        depends on BOOTORDER
> +        bool "Fast boot device init"
> +        default y
> +        help
> +            Skip initialization for devices without bootindex.  Speeds
> +            up boot and reduced memory footprint, but may cause boot
> +            problems in case the bootloader needs access to secondary
> +            disks.
> +
>      config HOST_BIOS_GEOMETRY
>          depends on BOOT
>          bool "Boot device bios geometry override"

The diff looks good.


Kind regards,

Paul
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org

[SeaBIOS] Re: [PATCH] boot: add config option for fast device init

Posted by Gerd Hoffmann 5 months, 3 weeks ago
On Tue, Mar 23, 2021 at 04:31:41PM +0100, Paul Menzel wrote:
> Dear Gerd,
> 
> 
> On 2021-03-23 15:18, Gerd Hoffmann wrote:
> > Add a config option for fast device init (i.e. skip non-bootable
> > devices).  This optimization breaks boot in some rare configurations,
> > specifically in case the boot loader needs access to secondary disks.
> 
> Thank you for the patch. Could you please elaborate and describe your
> test setup and how much the boot time is decreased?

Have no numbers.

Note that optimization is already in 1.14 and this only adds a config
option to turn it *off*.

take care,
  Gerd

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org

[SeaBIOS] Re: [PATCH] boot: add config option for fast device init

Posted by Kevin O'Connor 5 months, 2 weeks ago
On Fri, Mar 26, 2021 at 09:52:49AM +0100, Gerd Hoffmann wrote:
> On Tue, Mar 23, 2021 at 04:31:41PM +0100, Paul Menzel wrote:
> > Dear Gerd,
> > 
> > 
> > On 2021-03-23 15:18, Gerd Hoffmann wrote:
> > > Add a config option for fast device init (i.e. skip non-bootable
> > > devices).  This optimization breaks boot in some rare configurations,
> > > specifically in case the boot loader needs access to secondary disks.
> > 
> > Thank you for the patch. Could you please elaborate and describe your
> > test setup and how much the boot time is decreased?
> 
> Have no numbers.
> 
> Note that optimization is already in 1.14 and this only adds a config
> option to turn it *off*.

Unfortunately, I missed the initial email due to seabios mailing list
problems a few weeks ago.

What's the reason to add a config option for this setting?  We
typically make these choices at runtime using settings from fwcfg.

Cheers,
-Kevin
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org

[SeaBIOS] Re: [PATCH] boot: add config option for fast device init

Posted by Gerd Hoffmann 5 months, 1 week ago
  Hi,

> > > > Add a config option for fast device init (i.e. skip non-bootable
> > > > devices).  This optimization breaks boot in some rare configurations,
> > > > specifically in case the boot loader needs access to secondary disks.
> 
> Unfortunately, I missed the initial email due to seabios mailing list
> problems a few weeks ago.

Quote above is the commit message, actual patch below.

> What's the reason to add a config option for this setting?  We
> typically make these choices at runtime using settings from fwcfg.

Well, there is a fwcfg setting already.  Skipping non-bootable devices
happens only in case there is a HALT line in the fw_cfg bootorder file,
which translates to "-boot strict={on,off}" on the qemu command line.

Problem is that libvirt runs qemu with strict=on and provides no way to
request strict=off instead.  Fixing that is on the way, but it'll take
some time as it affects not only libvirt itself but also the management
apps using libvirt.

So this patch allows to handles the reported regressions with a compile
time switch for the time being.  If you don't like it, fine, we can
also carry the patch downstream for a while until libvirt & co are
fixed, it should only be needed temporarily after all.

I suspect we are not the only ones running into this though, so it might
be useful to have that upstream too ...

take care,
  Gerd

------------------------------ cut here -------------------------
diff --git a/src/boot.c b/src/boot.c
index 1effd802ce06..771d2382e38f 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -299,6 +299,8 @@ u8 is_bootprio_strict(void)
 {
     static int prio_halt = -2;
 
+    if (!CONFIG_BOOT_FAST_INIT)
+        return 0;
     if (prio_halt == -2)
         prio_halt = find_prio("HALT");
     return prio_halt >= 0;
diff --git a/src/Kconfig b/src/Kconfig
index 3a8ffa15fded..6b750a41b42c 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -72,6 +72,16 @@ endchoice
         help
             Support controlling of the boot order via the fw_cfg/CBFS
             "bootorder" file.
+    config BOOT_FAST_INIT
+        depends on BOOTORDER
+        bool "Fast boot device init"
+        default y
+        help
+            Skip initialization for devices without bootindex.  Speeds
+            up boot and reduced memory footprint, but may cause boot
+            problems in case the bootloader needs access to secondary
+            disks.
+
     config HOST_BIOS_GEOMETRY
         depends on BOOT
         bool "Boot device bios geometry override"

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org