CPU C-states
-
Hello,
One of the homelab platforms I'm running XCP-ng on, is a AMD 7950X.
I recently noticed, that in Ubuntu Linux 24.04, PowerTop reports C-states C1-C3 (see screenshot).
However, in XCP-ng 8.3, the command « xenpm get-cpuidle-states » only reports C0 and C1.I've tried adding « cpuidle » to the Xen image boot parameters in Grub-efi.cfg which doesn't seem to make any difference to the output of the get-cpuidle-states command. Looking at the output of « xe host-dmesg » I am not sure what to look for; the lines referenced in an Xen documentation page do not seem to be present in the output on XCP-ng.
As this is a homelab project, I wish to reduce power consumption as much as is technically feasible and leverage the supported C-states (unless latency from switching to/out of C3 would be killing performance).
-
Power management is a fairly complex thing in Xen. Adding @TeddyAstie in the loop if you have ideas.
-
@FrankAtHome Here's output on one of my XCP 8.3 servers that shows C0 to C4:
# xenpm get-cpuidle-states 0 All C-states allowed cpu id : 0 total C-states : 5 idle time(ms) : 1854395327 C0 : transition [ 827366196] residency [ 26328742 ms] C1 : transition [ 464493378] residency [ 40172860 ms] C2 : transition [ 97685021] residency [ 43104018 ms] C3 : transition [ 13728657] residency [ 12613910 ms] C4 : transition [ 251459140] residency [ 1755416981 ms] pc2 : [ 462155589 ms] pc3 : [ 17985256 ms] pc6 : [ 781427622 ms] cc3 : [ 10502718 ms] cc6 : [ 1685502286 ms] -
ok that's interesting.
Which CPU is this on? AMD ? Intel ?
Did you specify any boot parameters in grub to unlock these C-States ? -
@FrankAtHome The server is a HP DL360 G8 Intel Xeon CPU E5-2680v2.
Same hardware/bios config as the other servers running XCP 8.2, so, nothing special setup. I'm not sure if it even has C5/C6 states available. It's an enterprise server, you don't want it to sleep.
Here's the output from a desktop HP Elitedesk 800 G3 Intel Core i7-7700 running XCP 8.3, again, nothing special setup. Now with more C-states!
# xenpm get-cpuidle-states 0 All C-states allowed cpu id : 0 total C-states : 7 idle time(ms) : 276484 C0 : transition [ 277556] residency [ 16869 ms] C1 : transition [ 197012] residency [ 9993 ms] C2 : transition [ 23581] residency [ 11105 ms] C3 : transition [ 2943] residency [ 2094 ms] C4 : transition [ 8525] residency [ 8576 ms] C5 : transition [ 5493] residency [ 17883 ms] C6 : transition [ 40001] residency [ 224993 ms] cc3 : [ 1946 ms] cc6 : [ 7945 ms] cc7 : [ 238808 ms] -
@FrankAtHome
I looked in to this as well a while back and the conclusion i came to, is that the newer AMD power management functions are not supported properly in the old kernel used by XCP-NG (And maybe xen?).
A lot of work seems to have been done in the 6.x kernel series on this.I get the same on my 7900 - only C0 and C1

I tried booting it on a Ubuntu 24.04 live cd and power consumption was easily 15% lower at idle. -
@redakula said in CPU C-states:
@FrankAtHome
I looked in to this as well a while back and the conclusion i came to, is that the newer AMD power management functions are not supported properly in the old kernel used by XCP-NG (And maybe xen?).
A lot of work seems to have been done in the 6.x kernel series on this.I get the same on my 7900 - only C0 and C1

I tried booting it on a Ubuntu 24.04 live cd and power consumption was easily 15% lower at idle.that sounds plausible as explanation.
I guess I will have to patiently await XCP-ng 6 branch and any improvements this may bring on AMD systems.
-
It's very likely in Xen itself since a part of the power management is done there. Another topic to bring during the Xen Winter Meetup @TeddyAstie

-
@olivierlambert bit of a lazarus moment on this thread, but was there any progress on this?
We're seeing the same thing on Ryzen 9 7950X hosts (ASRock Rack AM5 boards), and we have a like-for-like comparison that might help narrow it down.
On XCP-ng 8.3 (Xen 4.17.6-9), xenpm get-cpuidle-states shows only C0/C1 ("All C-states allowed", total C-states : 2) on all three of our 7950X hosts. That includes one on a different board and one that's completely idle, so it isn't load- or board-specific.
The same CPU on the same board family, running plain Debian 12 with Xen 4.17.5 (dom0 kernel 6.1), shows C0–C3 (total C-states : 4). So the firmware is exposing the deeper states, and Xen can use them. They just never reach Xen on XCP-ng.
On the XCP-ng hosts, dom0 does log xen_acpi_processor: Uploading Xen processor PM info at boot, so the upload happens, but Xen only ends up with C1. Our guess is the 4.19 dom0 kernel's _CST handling: AMD's FFH-style C-state entries were only supported in later kernels. We haven't verified that, though.
Is this known on your side, and is a fix or backport planned? Happy to collect more data: xenpm output, ACPI table dumps, or a test kernel.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login