On Mon, Jun 27, 2022 at 11:01:31PM +0200, Stefan Hagen wrote:
> Hi,
>
> acpitz(4) implements passive cooling, which starts throttling the CPU to
> keep it under the temperature reported by the _PSV trip point.
>
> https://uefi.org/specs/ACPI/6.4/11_Thermal_Management/thermal-control.html
>
> The specs (1.1.5.1) leave the decision to activate passive cooling to
> the OS. It is a way to limit noise and heat rather than to protect the
> CPU (for which _HOT and _CRT are the better trip points).
>
> I would like to restrict passive cooling to the AUTO perfpolicy.
>
> For low (apm -L) and high (apm -H) it doesn't make much sense, because
> - low is setting a low pstate anyway
> - high is probably never set with the intention to have a cool and
> quiet machine.
>
> Compiling a kernel with apm -H before diff:
> 4m52.32s real 21m02.62s user 4m47.00s system
>
> Compiling a kernel with apm -H after diff:
> 2m42.65s real 11m36.07s user 2m36.83s system
>
> OK? Comments?
>
> Best Regards,
> Stefan
Shouldn't this also take into consideration hw.power as well? If it
doesn't make sense for perfpolicy=high then it probably doesn't for
perfpolicy=auto when on AC power?
>
> Index: sys/dev/acpi/acpitz.c
> ===================================================================
> RCS file: /home/cvs/src/sys/dev/acpi/acpitz.c,v
> retrieving revision 1.58
> diff -u -p -r1.58 acpitz.c
> --- sys/dev/acpi/acpitz.c 6 Apr 2022 18:59:27 -0000 1.58
> +++ sys/dev/acpi/acpitz.c 27 Jun 2022 19:25:55 -0000
> @@ -90,6 +90,7 @@ void (*acpitz_cpu_setperf)(int);
> int acpitz_perflevel = -1;
> extern void (*cpu_setperf)(int);
> extern int perflevel;
> +extern int perfpolicy;
> #define PERFSTEP 10
>
> #define ACPITZ_TRIPS (1L << 0)
> @@ -381,7 +382,7 @@ acpitz_refresh(void *arg)
> sc->sc_tc1, sc->sc_tc2, sc->sc_psv);
>
> nperf = acpitz_perflevel;
> - if (sc->sc_psv <= sc->sc_tmp) {
> + if (sc->sc_psv <= sc->sc_tmp && perfpolicy == 1) {
> /* Passive cooling enabled */
> dnprintf(1, "%s: enabling passive %d %d\n",
> DEVNAME(sc), sc->sc_tmp, sc->sc_psv);
>
>