Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
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:


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@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 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.