Bug 249889 - [cpufreq] does not seem to fully support AMD Ryzen 9 4900H
Summary: [cpufreq] does not seem to fully support AMD Ryzen 9 4900H
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-25 15:04 UTC by florian.millet
Modified: 2022-04-06 12:38 UTC (History)
2 users (show)

See Also:


Attachments
dmesg output (14.68 KB, text/plain)
2020-09-25 15:04 UTC, florian.millet
no flags Details
devinfo -v output (13.17 KB, text/plain)
2020-09-25 15:04 UTC, florian.millet
no flags Details
pciconf -lv output (10.06 KB, text/plain)
2020-09-25 15:04 UTC, florian.millet
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description florian.millet 2020-09-25 15:04:06 UTC
Created attachment 218282 [details]
dmesg output

Hello everyone,

It would seems that FreeBSD cpufreq driver does not yet fully support AMD Ryzen 9 4900H processor.
When doing a sysctl dev.cpu.0 on a FreeBSD current at svn revision r366130 it shows :

root@laptop:~ # sysctl dev.cpu.0
dev.cpu.0.temperature: 51.0C
dev.cpu.0.cx_method: C1/hlt C2/io C3/io
dev.cpu.0.cx_usage_counters: 17638 0 929634
dev.cpu.0.cx_usage: 1.86% 0.00% 98.13% last 7510us
dev.cpu.0.cx_lowest: C8
dev.cpu.0.cx_supported: C1/1/1 C2/2/400 C3/3/350
dev.cpu.0.freq_levels: 3300/4021 1700/1615 1400/1277
dev.cpu.0.freq: 1400
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=ACPI0007 _UID=1 _CID=none
dev.cpu.0.%location: handle=\_SB_.PLTF.P000
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU
root@laptop:~ #

You can see that the cpu can go from 1400 Mhz to 3300 Mhz but it is supposed to be capable to boost to 4400 Mhz (AMD specifications can be found here : https://www.amd.com/en/products/apu/amd-ryzen-9-4900h).

during the boot I can see that cpufreq detects something :
hwpstate0: <Cool`n'Quiet 2.0> on cpu0

Is turbo mode implemented for Ryzen Zen 2 3rd gen CPUs ?
Comment 1 florian.millet 2020-09-25 15:04:29 UTC
Created attachment 218283 [details]
devinfo -v output
Comment 2 florian.millet 2020-09-25 15:04:44 UTC
Created attachment 218284 [details]
pciconf -lv output
Comment 3 Conrad Meyer freebsd_committer freebsd_triage 2020-09-25 20:09:11 UTC
I don't think turboboost corresponds directly to P-states.  My understanding is that turboboost/CPB can happen automatically any time the processor is in P0 (the nominal 3300 MHz state).

This is the same as on Zen+ and Zen1.

The hwpstate0 / Cool'n'Quiet driver is just the one that provides P-state control:

    dev.cpu.0.freq_levels: 3300/4021 1700/1615 1400/1277
Comment 4 Conrad Meyer freebsd_committer freebsd_triage 2020-09-25 20:10:47 UTC
(In other words, I don't think there's a boost bug here.  We don't have a great way of *showing* the current boost frequency of CPU cores — I think we just show the current P-state's nominal frequency — but the cores should be boosting normally while in P0.)
Comment 5 florian.millet 2020-09-25 21:18:35 UTC
Do I have a way  to make absolutely sure that frequency can go to 4400 ?
I tried to set debug.cpufreq.verbose but it only shows 3300
Comment 6 Alan Somers freebsd_committer freebsd_triage 2021-03-26 00:14:21 UTC
I don't think the CPU actually reports its true running speed.  But you can measure it like this while heavily loading the CPUs.

pmcstat -s unhalted-core-cycles -w 1
Comment 7 Catalin 2022-04-06 12:38:58 UTC
Hello.

I have a Zotac machine with AMD Ryzen 3 3200U.

Max. Boost Clock Up to 3.5GHz
Base Clock 2.6GHz


The CPU should have a turbo boost up to 3.5 Ghz but not going over 2600 using stress-ng.

[2.6.0-RELEASE][root@pfSense.home.arpa]/root: /usr/local/bin/stress-ng --metrics-brief --cpu 0 --timeout 1h
stress-ng: info:  [11438] setting to a 3600 second (1 hour, 0.00 secs) run per stressor
stress-ng: info:  [11438] dispatching hogs: 4 cpu
^Cstress-ng: info:  [11438] successful run completed in 45.30s
stress-ng: info:  [11438] stressor       bogo ops real time  usr time  sys time   bogo ops/s     bogo ops/s
stress-ng: info:  [11438]                           (secs)    (secs)    (secs)   (real time) (usr+sys time)
stress-ng: info:  [11438] cpu              187426     45.29    179.48      0.00      4138.10        1044.25


[2.6.0-RELEASE][root@pfSense.home.arpa]/root: sysctl dev.cpu.0.freq
dev.cpu.0.freq: 1400
[2.6.0-RELEASE][root@pfSense.home.arpa]/root: sysctl dev.cpu.0.freq
dev.cpu.0.freq: 2600
[2.6.0-RELEASE][root@pfSense.home.arpa]/root: sysctl dev.cpu.0.freq
dev.cpu.0.freq: 2600
[2.6.0-RELEASE][root@pfSense.home.arpa]/root: sysctl dev.cpu.0.freq
dev.cpu.0.freq: 2600


[2.6.0-RELEASE][root@pfSense.home.arpa]/root: sysctl dev.cpu.0
dev.cpu.0.temperature: 48.0C
dev.cpu.0.cx_method: C1/hlt C2/io
dev.cpu.0.cx_usage_counters: 2805206 0
dev.cpu.0.cx_usage: 100.00% 0.00% last 30372us
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_supported: C1/1/1 C2/2/400
dev.cpu.0.freq_levels: 2600/3168 1700/1615 1400/1277
dev.cpu.0.freq: 1700
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=none _UID=0 _CID=none
dev.cpu.0.%location: handle=\_PR_.P000
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU

regards