Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1346730 - libvirt will enable perf event which user want disable it
libvirt will enable perf event which user want disable it
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.3
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Peter Krempa
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-06-15 05:10 EDT by Luyao Huang
Modified: 2016-11-03 14:47 EDT (History)
4 users (show)

See Also:
Fixed In Version: libvirt-2.0.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-03 14:47:15 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 08:07:06 EDT

  None (edit)
Description Luyao Huang 2016-06-15 05:10:21 EDT
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 03:50:33 EDT
Fixed upstream:

commit da8285c44a1db7b3ee85920a08dc80a133254c49
Author: Peter Krempa <pkrempa@redhat.com>
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 08:40:07 EDT
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-05 23:37:27 EDT
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 02:50:58 EDT
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 14:47:15 EDT
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.