Bug 1992479 - Detecting TSC timer frequencies requires too many privileges
Summary: Detecting TSC timer frequencies requires too many privileges
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.4
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: rc
: 8.5
Assignee: Michal Privoznik
QA Contact: Luyao Huang
URL:
Whiteboard:
Depends On:
Blocks: 1996130
TreeView+ depends on / blocked
 
Reported: 2021-08-11 07:54 UTC by Roman Mohr
Modified: 2021-11-16 09:00 UTC (History)
9 users (show)

Fixed In Version: libvirt-7.6.0-3.module+el8.5.0+12510+80564ecf
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1996130 (view as bug list)
Environment:
Last Closed: 2021-11-16 07:55:01 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Gitlab libvirt libvirt issues 188 0 None None None 2021-08-11 07:54:24 UTC
Red Hat Issue Tracker RHELPLAN-93205 0 None None None 2021-08-11 08:16:11 UTC
Red Hat Product Errata RHBA-2021:4684 0 None None None 2021-11-16 07:55:59 UTC

Description Roman Mohr 2021-08-11 07:54:25 UTC
Description of problem:

CNV runs libvirt with limited permissions. As a consequence libvirt does not have access to files like `/dev/cpu/0/msr` to determine the TSC frequency. A correct fallback was implemented in https://gitlab.com/libvirt/libvirt/-/issues/188 which we will need in CNV 4.9 to allow migrations with the inftsc cpu flag.

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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:

CNV can't detect the TSC frequency correctly.

Expected results:

CNV can detect the TSC frequency correctly.

Additional info:

We need a backport of https://gitlab.com/libvirt/libvirt/-/issues/188.

Comment 1 Roman Mohr 2021-08-11 08:00:34 UTC
Michal it would be great if we could get a backport.

Comment 2 Peter Krempa 2021-08-11 08:26:10 UTC
The commit from upstream issue #188 is:

commit 5df2c49263338da7221f24b3ad67ffd21d88047c
Author: Daniel P. Berrangé <berrange>
Date:   Wed Aug 4 18:05:59 2021 +0100

    util: directly query KVM for TSC scaling support
    
    We currently query the host MSRs to determine if TSC scaling is
    supported. This works OK when running privileged and can open
    the /dev/cpu/0/msr. When unprivileged we fallback to querying
    MSRs from /dev/kvm. This is incorrect because /dev/kvm only
    reports accurate info for MSRs that are valid to use from inside
    a guest.  The TSC scaling support MSR is not, thus we always end
    up reporting lack of TSC scaling when unprivileged.
    
    The solution to this is easy, because KVM can directly report
    whether TSC scaling is available, which matches what QEMU will
    do at startup.
    
    Closes: https://gitlab.com/libvirt/libvirt/-/issues/188
    Reported-by: Roman Mohr <rmohr>
    Reviewed-by: Michal Privoznik <mprivozn>
    Signed-off-by: Daniel P. Berrangé <berrange>

v7.6.0-53-g5df2c49263

Comment 12 Luyao Huang 2021-08-30 08:39:36 UTC
Preverify this bug with rebuild libvirt with patch:
https://mailman-int.corp.redhat.com/archives/rhvirt-patches/2021-August/msg00103.html

Comment 15 Luyao Huang 2021-09-07 02:43:58 UTC
Verify this bug with libvirt-daemon-7.6.0-3.module+el8.5.0+12510+80564ecf.x86_64 with the same steps in bug 1996130 comment 4.

Comment 17 errata-xmlrpc 2021-11-16 07:55:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (virt:av bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4684


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