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 1346730 - libvirt will enable perf event which user want disable it
Summary: libvirt will enable perf event which user want disable it
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-15 09:10 UTC by Luyao Huang
Modified: 2016-11-03 18:47 UTC (History)
4 users (show)

Fixed In Version: libvirt-2.0.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:47:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description Luyao Huang 2016-06-15 09:10:21 UTC
Description of problem:

libvirt will enable perf event which user want disable it

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

libvirt-1.3.5-1.el7.x86_64

How reproducible:

100%

Steps to Reproduce:
1. prepare a guest

# virsh perf rhel7.0-rhel
cmt            : disabled
mbmt           : disabled
mbml           : disabled


2. disable and enable different perf event in one cmdline:

# virsh perf rhel7.0-rhel --disable mbml --enable cmt


3. check result:

# virsh perf rhel7.0-rhel
cmt            : enabled
mbmt           : disabled
mbml           : enabled

Actual results:

libvirt will enable a perf event which should be disabled

Expected results:
2 options
1. Reject use --disable and --enable at the same time
2. fix this case

Additional info:

Comment 1 Peter Krempa 2016-06-17 07:50:33 UTC
Fixed upstream:

commit da8285c44a1db7b3ee85920a08dc80a133254c49
Author: Peter Krempa <pkrempa>
Date:   Wed Jun 15 16:07:20 2016 +0200

    qemu: perf: Don't set state of first event for every other event
    
    A bug in the code used the value of the first perf event as state for
    all the mentioned one rather than extracting individual ones.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1346730

Comment 3 yalzhang@redhat.com 2016-07-04 12:40:07 UTC
verified on libvirt-2.0.0-1.el7.x86_64, the result is as expected.

1. guest is shutdown
# virsh dumpxml rhel7.2 | grep /perf -B4
  <perf>
    <event name='cmt' enabled='no'/>
    <event name='mbmt' enabled='no'/>
    <event name='mbml' enabled='no'/>
  </perf>
# virsh perf rhel7.2
cmt            : disabled
mbmt           : disabled
mbml           : disabled

# virsh perf rhel7.2 --disable cmt --enable mbml 

# virsh perf rhel7.2
cmt            : disabled
mbmt           : disabled
mbml           : enabled

# virsh perf rhel7.2 --enable cmt,mbmt

# virsh perf rhel7.2
cmt            : enabled
mbmt           : enabled
mbml           : enabled

# virsh dumpxml rhel7.2 | grep /perf -B4
  <perf>
    <event name='cmt' enabled='yes'/>
    <event name='mbmt' enabled='yes'/>
    <event name='mbml' enabled='yes'/>
  </perf>

Comment 4 yalzhang@redhat.com 2016-07-06 03:37:27 UTC
Unexpected error occur when disable some event which is already disabled while the guest is running.
Test on libvirt-2.0.0-1.el7.x86_64

1.When disable some event which is already disabled, it will report error.

# virsh start rhel7.2
Domain rhel7.2 started

# virsh perf rhel7.2
cmt            : disabled
mbmt           : disabled
mbml           : disabled

# virsh perf rhel7.2 --disable cmt
error: Unable to enable/disable perf events
error: Unable to disable perf event type=0: Bad file descriptor

# virsh perf rhel7.2 --disable mbmt
error: Unable to enable/disable perf events
error: Unable to disable perf event type=1: Bad file descriptor

# virsh perf rhel7.2 --disable mbml
error: Unable to enable/disable perf events
error: Unable to disable perf event type=2: Bad file descriptor

2. When combine enable and disable, the --enable part succeed, but the --disable part report error.

# virsh start rhel7.2
Domain rhel7.2 started

# virsh perf rhel7.2
cmt            : disabled
mbmt           : disabled
mbml           : disabled

# virsh perf rhel7.2 --enable mbmt --disable cmt
error: Unable to enable/disable perf events
error: Unable to disable perf event type=0: Bad file descriptor

# virsh perf rhel7.2
cmt            : disabled
mbmt           : enabled
mbml           : disabled

# virsh perf rhel7.2 --enable mbml --disable cmt
error: Unable to enable/disable perf events
error: Unable to disable perf event type=0: Bad file descriptor

# virsh perf rhel7.2
cmt            : disabled
mbmt           : enabled
mbml           : enabled

Comment 5 yalzhang@redhat.com 2016-07-28 06:50:58 UTC
follow peter's suggestion to move the comment 4 to https://bugzilla.redhat.com/show_bug.cgi?id=1360533#c3

Comment 7 errata-xmlrpc 2016-11-03 18:47:15 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, 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://rhn.redhat.com/errata/RHSA-2016-2577.html


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