RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2015763 - virsh cpu-stats does not work with cgroup v2.
Summary: virsh cpu-stats does not work with cgroup v2.
Keywords:
Status: CLOSED CANTFIX
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.0
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Pavel Hrdina
QA Contact: Luyao Huang
URL:
Whiteboard:
Depends On: 1796543
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-10-20 03:46 UTC by Hongzhou Liu
Modified: 2021-11-02 10:59 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1796543
Environment:
Last Closed: 2021-11-02 10:58:54 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-100305 0 None None None 2021-10-20 03:46:59 UTC

Description Hongzhou Liu 2021-10-20 03:46:07 UTC
I can reproduce this bug on RHEL9

Version:
Kernel-5.14.0-7.el9.x86_64
libvirt-7.8.0-1.el9.x86_64
qemu-kvm-6.1.0-5.el9.x86_64

1. Prepare a running vm.

# virsh domstate $vm
running

2. Provide cpu statistics information of a domain.
# virsh cpu-stats $vm

Actual results:
error: Failed to retrieve CPU statistics for domain 'rhel9.0-2'
error: Operation not supported: operation 'getCpuacctPercpuUsage' not supported for backend 'cgroup V2'

Additional info:
Before running #virsh cpu-stats $vm the libvirtd’s status is running
After the error happened, I ran #systemctl status libvirtd and it shows libvirtd’s status is dead.


+++ This bug was initially created as a clone of Bug #1796543 +++

Description of problem: 'virsh cpu-stats ...' does not work with cgroup v2. The command fails with the error 'operation 'getCpuacctPercpuUsage' not supported'. On further analysis I see that a function 'getCpuacctPercpuUsage' is not registered in the backend 'virCgroupV2Backend'.


Version-Release number of selected component (if applicable):5.6.0


How reproducible:


Steps to Reproduce:
1. Bring up VMs through QEMU
2. Issue a 'virsh cpu-stats <domain-name>'


Actual results: operation 'getCpuacctPercpuUsage' not supported'


Expected results: Display the CPU-stats per cpu.


Additional info:

--- Additional comment from Pavel Hrdina on 2020-01-30 17:35:37 UTC ---

Unfortunately there is nothing we can do to provide the per-CPU stats.

With cgroups v1 there was cpuacct.usage_percpu file where we could get the data from but with cgroups v2 there is no such interface.
The latest kernel documentation for CPU controller <https://www.kernel.org/doc/html/v5.5/admin-guide/cgroup-v2.html#cpu>.

The only think we can do is to not call that function and return CPU usage stats for all CPUs which we can get from cgroups v2

--- Additional comment from Ramkumar on 2020-01-30 17:45:17 UTC ---

I understand and agree that it would be good to prevent calling the PercpuUsage function and just call the usage stats for all the CPUs. Could this be taken up in a future release?

--- Additional comment from Daniel Berrangé on 2020-02-03 11:34:21 UTC ---

(In reply to Pavel Hrdina from comment #1)
> Unfortunately there is nothing we can do to provide the per-CPU stats.
> 
> With cgroups v1 there was cpuacct.usage_percpu file where we could get the
> data from but with cgroups v2 there is no such interface.
> The latest kernel documentation for CPU controller
> <https://www.kernel.org/doc/html/v5.5/admin-guide/cgroup-v2.html#cpu>.
> 
> The only think we can do is to not call that function and return CPU usage
> stats for all CPUs which we can get from cgroups v2

I wonder what the kernel maintainers recommend as a replacement for this lost functionality, if any ?  eg is there perhaps a non-cgroups based way of getting what we want, or have they decided this info can never be provided to apps ?

--- Additional comment from Satheesh Rajendran on 2020-02-14 12:22:08 UTC ---

Am hitting the same issue too, just adding the env details.

Host kernel: 5.5.0-g7e7c42aa3
Libvirt: libvirt-6.1.0-1.fc31.ppc64le(compiled against, c246cfc4869096b773b697f5af899dbfd776fde7)

Regards,
-Satheesh

Comment 1 Jaroslav Suchanek 2021-10-21 13:20:48 UTC
Pavel would be please check it? If there is really nothing what can be done about, lets close it. Thanks.

Comment 2 Pavel Hrdina 2021-11-02 10:58:54 UTC
As stated in the linked bug this is a feature missing in kernel and there is nothing we can do about it in libvirt.


Note You need to log in before you can comment on or make changes to this bug.