NetBSD Problem Report #59932

From john@klos.com  Tue Jan 20 00:58:22 2026
Return-Path: <john@klos.com>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.netbsd.org", Issuer "R13" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id A8CA41A923D
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 20 Jan 2026 00:58:22 +0000 (UTC)
Message-Id: <202601200058.60K0wCSt021184@bunny.zia.io>
Date: Tue, 20 Jan 2026 00:58:12 GMT
From: john@ziaspace.com
Reply-To: john@ziaspace.com
To: gnats-bugs@NetBSD.org
Subject: Setting CPU frequencies on Zen 3 systems is problematic
X-Send-Pr-Version: 3.95
X-From4GNATS: "john@ziaspace.com via gnats" <gnats-admin@NetBSD.org>

>Number:         59932
>Category:       kern
>Synopsis:       Setting CPU frequencies on Zen 3 systems is problematic
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 20 01:00:00 +0000 2026
>Last-Modified:  Tue Jan 20 14:40:01 +0000 2026
>Originator:     John Klos
>Release:        NetBSD 11.0_BETA
>Organization:

>Environment:


System: NetBSD bunny.zia.io 11.0_BETA NetBSD 11.0_BETA (BUNNY) #0: Wed Oct 15 11:51:33 UTC 2025 john@bunny.zia.io:/usr/obj-amd64/sys/arch/amd64/compile/BUNNY amd64
Architecture: x86_64
Machine: amd64
>Description:

On multiple Zen 3 systems (Ryzen 5500, 5700X):

sysctl -a | grep freq
machdep.dmi.processor-frequency = 3400 MHz
machdep.tsc_freq = 3393633000
machdep.cpu.frequency.target = 3400
machdep.cpu.frequency.current = 3400
machdep.cpu.frequency.available = 3400 2800 2200

Changing the frequency works. However, after setting frequency.target to 3401 (which is 3400, with turbo clocking enabled, IIRC), all future attempts to set the clock fail:

sysctl -w machdep.cpu.frequency.target=3400
sysctl: machdep.cpu.frequency.target: Device not configured
sysctl -w machdep.cpu.frequency.target=2200
sysctl: machdep.cpu.frequency.target: Device not configured

On each attempt to change CPU frequency, the kernel prints:

[ 2823136.558871] acpicpu0: autoconfiguration error: failed to get frequency (err 22)
[ 2823141.718910] acpicpu1: autoconfiguration error: failed to get frequency (err 22)

After a while, "target" goes away:

sysctl -a | grep freq
machdep.dmi.processor-frequency = 3400 MHz
machdep.tsc_freq = 3393633000
machdep.cpu.frequency.available = 3400 2800 2200

This doesn't happen on a Bulldozer, nor on a Ryzen 7900, nor on a Ryzen 9700X.
This happens with NetBSD 10 and NetBSD 11/amd64.

>How-To-Repeat:

sysctl -w machdep.cpu.frequency.target=2200
sysctl -w machdep.cpu.frequency.target=3400
(works)

sysctl -w machdep.cpu.frequency.target=3401
(also works)
sysctl -w machdep.cpu.frequency.target=3400
(doesn't work, nor does any future attempts to change the target)
>Fix:


>Audit-Trail:
From: Emmanuel Nyarko <emmankoko519@gmail.com>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: kern/59932: Setting CPU frequencies on Zen 3 systems is
 problematic
Date: Tue, 20 Jan 2026 14:35:43 +0000

 Hi,

 > On multiple Zen 3 systems (Ryzen 5500, 5700X):
 >=20
 > sysctl -a | grep freq
 > machdep.dmi.processor-frequency =3D 3400 MHz
 > machdep.tsc_freq =3D 3393633000
 > machdep.cpu.frequency.target =3D 3400
 > machdep.cpu.frequency.current =3D 3400
 > machdep.cpu.frequency.available =3D 3400 2800 2200
 >=20
 > Changing the frequency works. However, after setting frequency.target =
 to 3401 (which is 3400, with turbo clocking enabled, IIRC), all future =
 attempts to set the clock fail:
 >=20
 > sysctl -w machdep.cpu.frequency.target=3D3400
 > sysctl: machdep.cpu.frequency.target: Device not configured
 > sysctl -w machdep.cpu.frequency.target=3D2200
 > sysctl: machdep.cpu.frequency.target: Device not configured
 >=20
 > On each attempt to change CPU frequency, the kernel prints:
 >=20
 > [ 2823136.558871] acpicpu0: autoconfiguration error: failed to get =
 frequency (err 22)
 > [ 2823141.718910] acpicpu1: autoconfiguration error: failed to get =
 frequency (err 22)

 from source inspection, returning an EINVAL seems like this particular =
 machine uses a=20
 Fixed Hardware address space ACPI type and has no support for AMD =
 =E2=80=9CVID/FID=E2=80=9D algorithm=20
 for intermediate dynamic adjustments of Pstates. so it matches to an =
 invalid status address (0) for the unknown=20
 Pstate that you are trying to change to (3401).=20

 https://www.netbsd.org/docs/guide/en/chap-power.html

 you can =E2=80=9Cusually" verify that if your reported frequencies end =
 in 1. looks like this man page reveals a=20
 software layer aid to that but seems to be inneficient as compared to =
 hardware support.=20

 can you check dmesg to see if P state FIDVID flag is seen on acpicpu ? =
 and maybe compare to the other machines ?
 If it lacks the support, maybe you simply can=E2=80=99t do that due to =
 hardware limitation.

 NB: this is just by source inspection. hope it helps.



 Emmanuel





>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.