Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quiet and fast boot #204

Open
wants to merge 16 commits into
base: dasharo
Choose a base branch
from
Open

Quiet and fast boot #204

wants to merge 16 commits into from

Conversation

miczyg1
Copy link
Contributor

@miczyg1 miczyg1 commented Jan 28, 2025

Works like a charm with Windows. The boot time in firmware is reduced from 11.1 seconds (effectively 8.1 seconds if 3second boot timeout is disregarded) to 4.9 seconds. The results may be checked in the Task Manager (Startup tab). Tested on MSI Z690-A DDR4 with RPL CPU.

The same time is achieved with Linux, with a small caveat. If the bootloader is GRUB, it will always try to read keystrokes, which means the console input will be connected by the firmware. However, the time consumed for connecting consoles is shifted to the bootloader itself. Summing it up, for Ubuntu, the boot time is as follows:

  • 11.1 seconds firmware + ~7 seconds loader (fast boot disabled)
  • 4.9 seconds firmware + ~10 seconds loader (fast boot enabled)

There is probably still more things can can be optimized. E.g. if the user ensures that each OS has ESP on the same disk as rootfs, we can skip connecting all storage medias unconditionally. In a case where ubuntu was installed alongside Windows, but on a different disk sharing the ESP, GRUB will fail to find the grub.cfg on the rootfs of the Linux distro.

Another small issue is that the fast boot only works with boot options created by the OS/bootloader. Boot options autodetected and autocreated by the firmware do not work (there seem to be a race conditions between refreshing the boot options and enumerating all devices after rivers are connected to controllers).

Ideas for future improvements:

  1. Leverage MdeModulePkg/Library/BootDiscoveryPolicyUiLib and MdeModulePkg/Universal/BootManagerPolicyDxe to allow some customization of fast boot flow and the boot manager flow in general.

@miczyg1
Copy link
Contributor Author

miczyg1 commented Jan 28, 2025

Still I need to check how big is the impact of connecting storage controllers only vs EfiBootManagerConnectAll.

Also need to test on headless system and a laptop with PS/2

@miczyg1 miczyg1 requested a review from mkopec January 28, 2025 15:36
@pietrushnic
Copy link
Contributor

@miczyg1 looks neat. Congratulations!

@miczyg1
Copy link
Contributor Author

miczyg1 commented Jan 28, 2025

Still I need to check how big is the impact of connecting storage controllers only vs EfiBootManagerConnectAll.

Nah, EfiBootManagerConnectAll makes it over 9s. The autodetected entries are visible with that, but it is not worth it. Maybe we can add some delay to let the drives be enumerated properly. Or maybe I should recursively connect the drivers to drives....

@miczyg1 miczyg1 force-pushed the quiet_fast_boot branch 2 times, most recently from 1b4ee43 to 27e49ef Compare January 28, 2025 16:25
@miczyg1
Copy link
Contributor Author

miczyg1 commented Jan 28, 2025

Still I need to check how big is the impact of connecting storage controllers only vs EfiBootManagerConnectAll.

Nah, EfiBootManagerConnectAll makes it over 9s. The autodetected entries are visible with that, but it is not worth it. Maybe we can add some delay to let the drives be enumerated properly. Or maybe I should recursively connect the drivers to drives....

Recursive connect helped

@miczyg1
Copy link
Contributor Author

miczyg1 commented Jan 30, 2025

Tested on VP6670 and no problems.

@miczyg1
Copy link
Contributor Author

miczyg1 commented Jan 30, 2025

Also tested on NS5x ADL. In Windows the Tasks Manager shows improvement from 7.2 seconds without fast boot to 3.9 seconds with fast boot.

The internal PS/2 keyboard also works in FW when firmware setup is requested from OS, so PS/2 should be fine.

…ions

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
… boot

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
…n fast boot

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
… boot

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
…n fast boot

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Use a depex file containing a NOT gDasharoFastBootPolicyGuid to
prevent loading the module if fast boot is enabled.

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
…heck

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
…boot

Recursively connect drivers to storage devices, so that all protocols
will be installed on the storage handles.

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
… boot

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
…boot

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants