Re: powerd forgets top CPU frequency ?

From: Ronald Klop <ronald-lists_at_klop.ws>
Date: Sun, 25 Aug 2024 08:38:14 UTC
Van: Poul-Henning Kamp <phk@phk.freebsd.dk>
Datum: zondag, 25 augustus 2024 10:29
Aan: Ronald Klop <ronald-lists@klop.ws>
CC: Bob Bishop <rb@gid.co.uk>, "current@freebsd.org" <current@FreeBSD.org>
Onderwerp: Re: powerd forgets top CPU frequency ?
> 
> --------
> Ronald Klop writes:
> 
> > A bit weird to try to give suggestions knowing how experienced you are in FreeBSD. But here we go,
> 
> I'm not very experienced with how modern CPU's are modulated :-)
> 
> > 1. What does the sysctl about cpu frequencies say. Does that value decrease too?
> > On my machine it is this:
> > # sysctl dev.cpu  | grep freq
> > dev.cpu.0.freq_levels: 1500/-1 600/-1
> > dev.cpu.0.freq: 1500
> 
> Right now:
>     dev.cpu.7.freq_levels: 2803/-1
>     dev.cpu.7.freq: 3103
>     dev.cpu.5.freq_levels: 2803/-1
>     dev.cpu.5.freq: 3103
>     dev.cpu.3.freq_levels: 2803/-1
>     dev.cpu.3.freq: 3103
>     dev.cpu.1.freq_levels: 2803/-1
>     dev.cpu.1.freq: 3103
>     dev.cpu.6.freq_levels: 2803/-1
>     dev.cpu.6.freq: 3103
>     dev.cpu.4.freq_levels: 2803/-1
>     dev.cpu.4.freq: 3103
>     dev.cpu.2.freq_levels: 2803/-1
>     dev.cpu.2.freq: 3103
>     dev.cpu.0.freq_levels: 2803/-1
>     dev.cpu.0.freq: 3103
> 
> > 2. Does https://www.freshports.org/sysutils/powerdxx/ exhibit the same issue? To rule out if it is in the binary or in the kernel.
> 
> Will try.
> 
> > 3. out-of-the-box: are your CPUs similar? So, do both have the same top frequency?
> 
> Yes, it's a: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
> 
> > 4. And powerd(8) mentions a -v option: "Verbose mode.  Messages about power changes will be printed to stdout and powerd will operate in the foreground."
> > Does that print anything useful?
> 
> Yes, that's where I noticed the "gradually run slower and slower"...
> 
> Initially I thought it was some kind of thermal throttling, but leaving the computer
> idle overnight did not lead to automatic recovery, whereas reboots and as far as I
> can tell, restarting powerd does.
> 
> -- 
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> phk@FreeBSD.ORG         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe    
> Never attribute to malice what can adequately be explained by incompetence.
> 
> 
> 


    dev.cpu.7.freq_levels: 2803/-1
    dev.cpu.7.freq: 3103


This is interesting by itself. According to the sysctl the CPU only has 1 frequency to select, which is 2803, but it is running on 3103. Maybe there is some other mechanism which influences the CPU freq on your machine. I hope somebody else can shine some light on this.
Doesn't the output (or source) of powerd give some insight on why it makes the decisions it makes?

Regards,
Ronald.