Monday, November 28, 2022

Re: pcengines apu{1,4} can't adjust CPU frequency automatically anymore

On 2022-11-28, Lévai Dániel <leva@ecentrum.hu> wrote:
> Hi all,
>
> I don't know since when, unfortunately, but it seems auto-adjusting CPU frequency doesn't work anymore on my APU1 and an APU4 PCEngines boards (I only have these versions at hand atm).
> They're both running an updated fw at v4.17.0.2.
>
> IIRC `apmd -A' + `sysctl hw.perfpolicy=auto' did the trick earlier, but I'll be honest, I haven't checked this since forever.
>
> APU1 has two and the APU4 has three frequencies to set:
> cpu0: 1000 MHz: speeds: 1000 800 MHz
> cpu0: 998 MHz: speeds: 1000 800 600 MHz
>
> I can manually adjust this with hw.setperf when hw.perfpolicy is 'manual', so setting the frequency actually works, it's just that it can't seems to "detect" load/change when it's set to 'auto'.

One option is to use a diff like below, I'm not sure how much difference
it will make to power consumption on APU though.

It can depend on what the machine is doing too; if it's idle a lot then
it will already be spending a fair bit of time in mwait, reducing the
clock speed either won't help or may even make things use more power
(takes longer to execute code before it can go back in low power mwait
state) - if it's not quite as idle then this probably helps more.

It gives a measurable improvement on my main laptop (partly lower
power use from cpu, partly less power use from the fan because it's on
less often - obviously the latter doesn't help apu :)

If you want to see if it's helping and can't measure power consumption
directly, checking the temperature under normal conditions is probably
not a bad proxy.

Index: kern/sched_bsd.c
===================================================================
RCS file: /cvs/src/sys/kern/sched_bsd.c,v
retrieving revision 1.72
diff -u -p -r1.72 sched_bsd.c
--- kern/sched_bsd.c 14 Aug 2022 01:58:27 -0000 1.72
+++ kern/sched_bsd.c 28 Nov 2022 08:09:47 -0000
@@ -543,7 +543,7 @@ setperf_auto(void *v)
if (cpu_setperf == NULL)
return;

- if (hw_power) {
+ if (0 && hw_power) {
speedup = 1;
goto faster;
}

No comments:

Post a Comment