Bug 256836 - powerd: Enable by default on Raspberry Pi images
Summary: powerd: Enable by default on Raspberry Pi images
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 13.0-RELEASE
Hardware: arm64 Any
: --- Affects Many People
Assignee: Mike Karels
URL:
Keywords: feature, needs-patch, performance
Depends on:
Blocks:
 
Reported: 2021-06-25 19:18 UTC by Vincent Milum Jr
Modified: 2024-02-11 21:26 UTC (History)
8 users (show)

See Also:
karels: mfc-stable14+
karels: mfc-stable13+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vincent Milum Jr 2021-06-25 19:18:17 UTC
During a normal installer process, the installer asks if a number of services should be enabled by default. On the Raspberry Pi pre-built image, this is a pre-installed system where these configuration options are never presented.

By default, the Raspberry Pi 4 is locked to only 600 MHz unless powerd is running.

There is currently no obvious way to know that the performance of this board is being limited without digging into sysctl. This could lead users to assume that "FreeBSD is unoptimized and slow" compared to other OSes.

Right now, the only note I'm aware of about this particular issue is at the very bottom of a Wiki page. This isn't a good end-user experience to have to hunt down this information, especially if they don't even know what to look for to begin with.

https://wiki.freebsd.org/arm/Raspberry%20Pi#RPI4

Because of these, I believe that powerd should be enabled by default in the Raspberry Pi specific images that are generated.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2021-06-26 01:54:53 UTC
@Reporter Can this change proposal be interpreted as 'installer: Show service screen to ARM and/or RPi build/image users ' as in, is this relevent, useful or valuable to users for services beyond powerd either at present or in the future?
Comment 2 Vincent Milum Jr 2021-06-26 02:48:52 UTC
It might be nice to show part of the installer process during "first boot"

In regards to powerd specifically though, the Raspberry Pi 4 is severally limited in compute power without it running, since it defaults to ~1/3rd its rated clock speed. This has a significant end-user impact.

But yeah, right now, no "installer" is displayed at all for the Raspberry Pi, since it is a pre-built image. If we could at least get some sort of message on boot, or an interactive menu on first-boot, that would at least be a start (plus allowing for other service configurations too)
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2021-06-26 02:55:27 UTC
(In reply to Vincent Milum Jr from comment #2)

Thanks Vincent. Could you please create a separate issue for 'installer: Enable service configuration on <relevent arch/build scription>" and See Also: this issue

Can/should this be addressed in supported stable/* branches, and/or enabled for next patch levels of existing releases?
Comment 4 Daniel Engberg freebsd_committer freebsd_triage 2021-06-28 22:41:44 UTC
As much as I understand the intention I think we should try to keep all platforms and/or arches as consistent as possible. Similar topic has been up for discussion regarding kernel configuration between aarch64 and amd64 primarily.
Comment 5 Vincent Milum Jr 2021-06-29 00:44:50 UTC
This wouldn't be a kernel config change though. This is a single-line addition to the rc.conf specific to the Raspberry Pi pre-built image, which also has other Raspberry Pi specific customizations (like u-boot).

Normally I'd agree to keep everything as close to the same as possible, but in the case of the Raspberry Pi image specifically, the hardware is severely limited in performance without this. That's not a good experience for end-users trying out FreeBSD for the first time (a common use case for the Raspberry Pi).

We're used to x86 systems that default to a high-power state unless powerd is enabled. Raspberry Pi is acting in the opposite fashion, defaulting to a lower-power state. If we want things to be consistent, then enabling powerd seems more like a requirement then to bring the system more in-line with x86 default expectations.
Comment 6 dfr 2023-05-12 07:00:38 UTC
I just got bitten by this while trying to improve the performance of my pi400 by overclocking and only discovered the requirement for powerd when I tried to check to see if the overclock config was correct. IMO, powerd should be enabled by default for the same reasons as the OP.
Comment 7 Vincent Milum Jr 2023-05-15 21:39:02 UTC
At this point with how important power management is on ALL systems, I really believe this should now be default on -all- FreeBSD images.
Comment 8 Mark Millard 2023-08-09 07:21:42 UTC
(In reply to dfr from comment #6)

FYI: If you can tolerate a fixed frequency, there is
(some context shown as well):

# sysctl dev.bcm2835_cpufreq.0.freq_settings
dev.bcm2835_cpufreq.0.freq_settings: 1500/-1 600/-1

(1500 MHz and 600 MHz)

I'll note that settings in the RPi*'s config.txt can
change that list of possibilities (via presenting
different device tree details via the firmware
adjusting the tree to match). The RPI* firmware
version used also can change the default for that
list.

# sysctl hw.cpufreq.arm_freq
hw.cpufreq.arm_freq: 600000000

# sysctl hw.cpufreq.arm_freq=1500000000
hw.cpufreq.arm_freq: 600000000 -> 1500000000

/etc/sysctl.conf can be used to set the figure.

Systems that do not support cpufreq (and, so, do not
support powerd) can sometimes be handled similarly
(but using the appropriate naming).

This note is not about if powerd should vs. should-not
be enabled by default if there is no one interested in
being the one to make the implementation change. Just
think of this note as documenting a workaround given
how things are.

I normally use a fixed frequency, but I normally
do all the control from config.txt instead of from
FreeBSD.
Comment 9 Minsoo Choo 2023-12-21 02:08:53 UTC
<https://reviews.freebsd.org/D43141>

This can be solved by creating a separate ISO for RPI4
Comment 10 Vincent Milum Jr 2023-12-21 02:42:17 UTC
(In reply to Minsoo Choo from comment #9)

The Raspberry Pi ALREADY has a separate dedicated image, that's exactly what this is about.
Comment 11 Mike Karels freebsd_committer freebsd_triage 2024-01-01 22:06:48 UTC
The current 64-bit RPI image is shared by multiple models, including 3B+ and 4B.  However, the RPi 3B+ can benefit from enabling powerd as well, as can derivatives of the 4B.  I don't see any reason not to enable powerd on the current RPI image.
Comment 12 commit-hook freebsd_committer freebsd_triage 2024-01-05 19:41:56 UTC
A commit in branch main references this bug:

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

commit 4347ef60501f2a55ad31f7532ad903b81f3af18f
Author:     Mike Karels <karels@FreeBSD.org>
AuthorDate: 2024-01-05 19:41:24 +0000
Commit:     Mike Karels <karels@FreeBSD.org>
CommitDate: 2024-01-05 19:41:24 +0000

    arm64/RPI: enable powerd by default on arm64-aarch64-RPI images

    Most 64-bit Raspberry Pi models have a variable processor clock
    speed that defaults to a slow speed (e.g. 600 MHz for a nominal
    1.5 GHz clock).  This results in everything running slowly unless
    or until powerd is started, and FreeBSD is then thought to be slow.
    Enable powerd by default in /etc/rc.conf on the arm64-aarch64-RPI
    images.  Tested on Raspberry Pi 3B+ and 4B so far.

    PR:             256836
    MFC after:      1 month
    Reviewed by:    rgrimes
    Differential Revision:  https://reviews.freebsd.org/D43296

 release/arm64/RPI.conf | 1 +
 release/tools/arm.subr | 3 +++
 2 files changed, 4 insertions(+)
Comment 13 Mark Millard 2024-01-06 02:48:07 UTC
I'll note that:

https://lists.freebsd.org/archives/freebsd-arm/2023-December/003467.html

is a report of needing to disable powerd to get reliability for some
tip / sshd use. (I expect tip-to-serial-console from one RPi* to
another is the actual issue but more evidence gathering is needed.)
Comment 14 Mark Millard 2024-01-06 02:56:12 UTC
(In reply to Mark Millard from comment #13)

Bad reference to the tip/ssh vs. powerpd issue: trying again . . .

https://lists.freebsd.org/archives/freebsd-arm/2024-January/003478.html
Comment 15 Mike Karels freebsd_committer freebsd_triage 2024-01-06 13:36:33 UTC
(In reply to Mark Millard from comment #14)
I think this is a case that will require hand configuration to get acceptable results in any case, and is a fairly rare case.  I tested a serial console over a period of about a day, and saw nothing strange (although there was little console output).  I even saw changes in CPU speed while doing output, which didn't seem to get scrambled.
Comment 16 Mark Millard 2024-01-08 07:07:15 UTC
(In reply to Mike Karels from comment #15)

It may be worth a note mentioning the subject area
with the issue once it is isolated: avoiding unnecessary
surprises that are messy to track down to a specific type of
context.

I do not take the issue as an indication to avoid powerd
by default. (It should be easy and clear how to disable,
which appears to be the case.) It is just a messier
context than one would hope.
Comment 17 Mark Millard 2024-01-10 01:15:30 UTC
(In reply to Mark Millard from comment #16)

Bob P. has reported getting a failure when no systems were
running powerd . It may be that powerd only contributes
some to how frequently the issue happens during buildworld
and such activities that produce a heavy load. But it is
now known to not be required to be involved.

So: no need for a note for the issue.
Comment 18 commit-hook freebsd_committer freebsd_triage 2024-01-30 20:11:01 UTC
A commit in branch stable/14 references this bug:

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

commit 0c6e3bfd13621cfa2dbc432b08cbfb3dcf012d87
Author:     Mike Karels <karels@FreeBSD.org>
AuthorDate: 2024-01-05 19:41:24 +0000
Commit:     Mike Karels <karels@FreeBSD.org>
CommitDate: 2024-01-30 20:10:00 +0000

    arm64/RPI: enable powerd by default on arm64-aarch64-RPI images

    Most 64-bit Raspberry Pi models have a variable processor clock
    speed that defaults to a slow speed (e.g. 600 MHz for a nominal
    1.5 GHz clock).  This results in everything running slowly unless
    or until powerd is started, and FreeBSD is then thought to be slow.
    Enable powerd by default in /etc/rc.conf on the arm64-aarch64-RPI
    images.  Tested on Raspberry Pi 3B+ and 4B so far.

    PR:             256836
    Reviewed by:    rgrimes
    Differential Revision:  https://reviews.freebsd.org/D43296

    (cherry picked from commit 4347ef60501f2a55ad31f7532ad903b81f3af18f)

 release/arm64/RPI.conf | 1 +
 release/tools/arm.subr | 3 +++
 2 files changed, 4 insertions(+)
Comment 19 commit-hook freebsd_committer freebsd_triage 2024-01-30 20:12:04 UTC
A commit in branch stable/13 references this bug:

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

commit e889b5a892b63e5868ffbcbf82f55cbe79dda5ac
Author:     Mike Karels <karels@FreeBSD.org>
AuthorDate: 2024-01-05 19:41:24 +0000
Commit:     Mike Karels <karels@FreeBSD.org>
CommitDate: 2024-01-30 20:10:56 +0000

    arm64/RPI: enable powerd by default on arm64-aarch64-RPI images

    Most 64-bit Raspberry Pi models have a variable processor clock
    speed that defaults to a slow speed (e.g. 600 MHz for a nominal
    1.5 GHz clock).  This results in everything running slowly unless
    or until powerd is started, and FreeBSD is then thought to be slow.
    Enable powerd by default in /etc/rc.conf on the arm64-aarch64-RPI
    images.  Tested on Raspberry Pi 3B+ and 4B so far.

    PR:             256836
    Reviewed by:    rgrimes
    Differential Revision:  https://reviews.freebsd.org/D43296

    (cherry picked from commit 4347ef60501f2a55ad31f7532ad903b81f3af18f)

 release/arm64/RPI.conf | 1 +
 release/tools/arm.subr | 3 +++
 2 files changed, 4 insertions(+)
Comment 20 Mike Karels freebsd_committer freebsd_triage 2024-02-11 21:26:33 UTC
This has been done on main, stable/14, and stable/13.  stable/12 is EOL.