Bug 289007 - Slow boot on AMD Framework 13/16 with FreeBSD main
Summary: Slow boot on AMD Framework 13/16 with FreeBSD main
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 15.0-CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Toomas Soome
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2025-08-22 16:14 UTC by Joseph Mingrone
Modified: 2025-12-15 13:31 UTC (History)
6 users (show)

See Also:
linimon: mfc-stable14?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Mingrone freebsd_committer freebsd_triage 2025-08-22 16:14:40 UTC
Framework 16 owners are experiencing very slow boots when running FreeBSD main.  FreeBSD 14.3 on the same laptop boots normally.

Videos:
Normal 14.3 boot: https://photos.app.goo.gl/TVKaocuWc12xCpgFA
Slow main boot:   https://photos.app.goo.gl/ijs3vd3wcjZTa1He8

I tried replacing the bootloader on a 14.3 install image with one built from main, but the 14.3 image still booted quickly.

At BSDCan, some people reported that the AMD Framework 13 had the problem, but it was fixed.  Another Framework 13 user said his system still boots slowly with a recent main snapshot.

I'll add more information here as I learn more.

Comment 20 from bug 254381 seems to be the same issue.
Comment 1 Shawn Webb 2025-08-22 19:52:35 UTC
I'm impacted by this as well. I've chatted briefly with Kyle Evans about it on an IRC channel, so he's at least aware of the problem. I was planning on trying to bisect the bad commit this weekend if I had the time.
Comment 2 crest 2025-08-26 09:31:57 UTC
That looks like the Framebuffer is completely uncached instead of write combining. Could this be a problem with the ACPI tables for the framebuffer memory region?
Comment 3 Ed Maste freebsd_committer freebsd_triage 2025-08-26 16:43:34 UTC
(In reply to Joseph Mingrone from comment #0)

Interestingly the slowness is in the loader, the boot proceeds at normal speed once the kernel starts.

When you say you tried the 14.3 loader, I presume you mean you swapped just the loader binary itself; can you try starting with main but replacing everything under /boot other than the kernel subdir with 14.3?
Comment 4 Joseph Mingrone freebsd_committer freebsd_triage 2025-08-26 20:15:30 UTC
I discussed the issue with tsoome on IRC.

The slowness is partly related to the larger font sizes introduced in main.  Adding screen.font="16x32" to /boot/loader.conf makes the boot menu and everything afterwards display much faster.  However, everything before the boot loader still renders very slowly.  This is fast with 14.3, so something else is at play.  tsoome suggested the early slowness may depend on whether the loader uses gop->blt() or its own blt() implementation.  I tried setting gop.blt=off in /boot/loader.conf, but it didn't make a difference.

Relevant excerpts from the IRC discussion:
<tsoome_> I have pretty good idea why and how to make it better, need to take time to make it happen.
<tsoome_> The problem with WC optimized memory is that you want to put large chunks of data on screen. Current implementation is putting chars one by one, the vt driver does use timer based screen draw - it renders glyphs to cache and flushes the changed region(s) based on timer.
<tsoome_> the initial implementation was "good enough" till larger font appeared some months ago, 32x64x4 is 8k data to be copied to draw one glyph and in some systems it is not good enough any more...
Comment 5 Joseph Mingrone freebsd_committer freebsd_triage 2025-08-26 20:21:24 UTC
(In reply to Ed Maste from comment #3)

> Interestingly the slowness is in the loader, the boot proceeds at normal speed once the kernel starts.

That's right.  I copied a loader binary from 15 to a 14.3 install image.

> can you try starting with main but replacing everything under /boot other than the kernel subdir with 14.3?

I'll try that tonight.
Comment 6 Joseph Mingrone freebsd_committer freebsd_triage 2025-08-27 00:16:42 UTC
(In reply to Joseph Mingrone from comment #5)
Using a 15 installer image, but replacing /boot with that from 14.3 (excluding /boot/kernel/), makes everything render fast again.
Comment 7 Joseph Mingrone freebsd_committer freebsd_triage 2025-09-05 19:43:04 UTC
After some exhilarating bisecting, I determined that 1ec2c8b2f364cc8294ba06d64a167bca4b1b6bbb is the culprit.

https://reviews.freebsd.org/D52402
Comment 8 commit-hook freebsd_committer freebsd_triage 2025-09-06 03:37:19 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=5e82eeccd252e96370e8b73603b609622497000c

commit 5e82eeccd252e96370e8b73603b609622497000c
Author:     Joseph Mingrone <jrm@FreeBSD.org>
AuthorDate: 2025-09-05 19:50:39 +0000
Commit:     Joseph Mingrone <jrm@FreeBSD.org>
CommitDate: 2025-09-06 03:34:55 +0000

    stand: Remove Spleen 32x64 fonts from INDEX

    The Spleen 32x64 fonts cause some systems such as the AMD Framework 16
    to boot extremely slowly.  Adding screen.font="16x32" to
    /boot/loader.conf is a partial workaround, but text displayed before the
    boot menu still takes ~30 seconds to render on that laptop.  With this
    change, the same text renders immediately.

    By leaving the font files in place but removing them from the INDEX,
    users who want to use them can still load them manually.  Once pending
    work is committed to allow normal booting with these fonts, they can be
    added back to the INDEX.

    PR:             289007
    Reviewed by:    emaste, kevans, tsoome, ziaee
    Fixes:          1ec2c8b2f364 (stand: Enable Spleen 32x64 font in the bootloader)
    Sponsored by:   The FreeBSD Foundation

 stand/fonts/INDEX.fonts | 3 ---
 1 file changed, 3 deletions(-)
Comment 9 commit-hook freebsd_committer freebsd_triage 2025-09-11 02:09:29 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=f834384fdad98c60b47ac182f2e8863c4384bc58

commit f834384fdad98c60b47ac182f2e8863c4384bc58
Author:     Joseph Mingrone <jrm@FreeBSD.org>
AuthorDate: 2025-09-05 19:50:39 +0000
Commit:     Joseph Mingrone <jrm@FreeBSD.org>
CommitDate: 2025-09-11 02:05:50 +0000

    stand: Remove Spleen 32x64 fonts from INDEX

    The Spleen 32x64 fonts cause some systems such as the AMD Framework 16
    to boot extremely slowly.  Adding screen.font="16x32" to
    /boot/loader.conf is a partial workaround, but text displayed before the
    boot menu still takes ~30 seconds to render on that laptop.  With this
    change, the same text renders immediately.

    By leaving the font files in place but removing them from the INDEX,
    users who want to use them can still load them manually.  Once pending
    work is committed to allow normal booting with these fonts, they can be
    added back to the INDEX.

    PR:             289007
    Reviewed by:    emaste, kevans, tsoome, ziaee
    Fixes:          1ec2c8b2f364 (stand: Enable Spleen 32x64 font in the bootloader)
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D52402

    (cherry picked from commit 5e82eeccd252e96370e8b73603b609622497000c)

 stand/fonts/INDEX.fonts | 3 ---
 1 file changed, 3 deletions(-)
Comment 10 Bjoern A. Zeeb freebsd_committer freebsd_triage 2025-09-11 14:19:03 UTC
So I rebuilt my f.w16 yesterday from main;  I do boot w/o beastie, just command line bits from loader (beastie_disable="YES" in loader.conf).

I did update my loader in the EFI partition.

I am still not able to scroll fast on the loader command line;  typing show it quickly fills the screen and then you can get a tea as it scrolls the lines up.

Is that supposedly the same issue or something different?
Comment 11 Joseph Mingrone freebsd_committer freebsd_triage 2025-11-09 22:21:40 UTC
(In reply to Bjoern A. Zeeb from comment #10)
Bjoern,

I was able to reproduce the problem you reported.  I observe the same slow behaviour when I select the "Escape to loader prompt" option in the menu to the left of Beastie (or Orb), and then press '?' to list all the commands.  I guess this is enough text to trigger the underlying problem, just like the larger fonts did.
Comment 12 Bjoern A. Zeeb freebsd_committer freebsd_triage 2025-11-10 10:59:27 UTC
(In reply to Joseph Mingrone from comment #11)

Great (well not but good it's not just me) and it seems it is a seemingly simple enough test case for someone to work on this issue.