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 1337033 - kvm_stat AttributeError: 'ArchPPC' object has no attribute 'exit_reasons'
Summary: kvm_stat AttributeError: 'ArchPPC' object has no attribute 'exit_reasons'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.3
Hardware: ppc64le
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Laurent Vivier
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-05-18 05:47 UTC by mazhang
Modified: 2016-11-07 21:10 UTC (History)
8 users (show)

Fixed In Version: qemu-kvm-rhev-2.6.0-5.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-07 21:10:16 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2673 0 normal SHIPPED_LIVE qemu-kvm-rhev bug fix and enhancement update 2016-11-08 01:06:13 UTC

Description mazhang 2016-05-18 05:47:55 UTC
Description of problem:


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

Host:
qemu-kvm-tools-rhev-2.6.0-2.el7.ppc64le

How reproducible:
100%

Steps to Reproduce:

# kvm_stat 
Traceback (most recent call last):
  File "/usr/bin/kvm_stat", line 825, in <module>
    main()
  File "/usr/bin/kvm_stat", line 813, in main
    providers = get_providers(options)
  File "/usr/bin/kvm_stat", line 778, in get_providers
    providers.append(TracepointProvider())
  File "/usr/bin/kvm_stat", line 416, in __init__
    self.filters = get_filters()
  File "/usr/bin/kvm_stat", line 315, in get_filters
    if ARCH.exit_reasons:
AttributeError: 'ArchPPC' object has no attribute 'exit_reasons'

Actual results:


Expected results:
Work fine

Additional info:

Comment 2 Laurent Vivier 2016-05-19 14:36:49 UTC
kvm_stat is broken upstream since:

commit 639ce1831082084af80290c79f06a5794a3caa0b
Author: Janosch Frank <frankja.ibm.com>
Date:   Mon Jan 11 16:17:39 2016 +0100

    scripts/kvm/kvm_stat: Introduce main function
    
    The main function should be the main location for initialization and
    helps encapsulating variables into a scope. This way they don't have
    to be global and might be mistaken for local ones.
    
    As the providers variable is scoped now it can't be accessed from
    within the Stats class. Hence, the global access to the variable was
    changed to a local one.
    
    Reviewed-by: Jason J. Herne <jjherne.ibm.com>
    Signed-off-by: Janosch Frank <frankja.ibm.com>
    Message-Id: <1452525484-32309-10-git-send-email-frankja.ibm.com>
    Signed-off-by: Paolo Bonzini <pbonzini>

But this not the same error:

...
  File "./scripts/kvm/kvm_stat", line 375, in reset
    fcntl.ioctl(self.fd, IOCTL_NUMBERS['RESET'], 0)
IOError: [Errno 25] Inappropriate ioctl for device


The problem with the exit_reasons apperas later with:

commit 068294a1cac4798e4554d9c9848c7c1b31d28713
Author: Janosch Frank <frankja.ibm.com>
Date:   Mon Jan 11 16:17:55 2016 +0100

    scripts/kvm/kvm_stat: Group arch specific data
    
    Using global variables and multiple initialization functions for arch
    specific data makes the code hard to read. By grouping them in the
    Arch classes we encapsulate and initialize them in one place.
    
    Signed-off-by: Janosch Frank <frankja.ibm.com>
    Message-Id: <1452525484-32309-26-git-send-email-frankja.ibm.com>
    Signed-off-by: Paolo Bonzini <pbonzini>

Comment 3 Laurent Vivier 2016-05-19 15:52:23 UTC
commit 639ce18 wants to enable by default tracepoint provider without managing error case. So it does not introduce the bug but only reveal a bug in tracepoint provider.

The bug was introduced by:

commit fc116efad0aadb2f8a49d51240bddbfe21b631a0
Author: Wei Huang <wei>
Date:   Fri Jan 23 15:56:04 2015 -0500

    kvm_stat: Add RESET support for perf event ioctl
    
    While running kvm_stat using tracepoint on ARM64 hardware (e.g. "kvm_stat
    -1 -t"), the initial values of some kvm_userspace_exit counters were found
    to be very suspecious. For instance the tracing tool showed that S390_TSCH
    was called many times on ARM64 machine, which apparently was wrong.
    
    This patch adds RESET ioctl support for perf monitoring. Before calling
    ioctl to enable a perf event, this patch resets the counter first. With
    this patch, the init counter values become correct on ARM64 hardware.
    
    Example:
    
    ==== before patch ====
    kvm_userspace_exit(S390_SIEIC)      1426         0
    kvm_userspace_exit(S390_TSCH)       339         0
    
    ==== after patch ====
    kvm_userspace_exit(S390_SIEIC)         0         0
    kvm_userspace_exit(S390_TSCH)         0         0
    
    Signed-off-by: Wei Huang <wei>

Comment 4 Laurent Vivier 2016-05-20 08:32:51 UTC
The problem with RESET on POWER is the ioctl command number is not the good one for POWER.

Comment 5 Laurent Vivier 2016-05-20 08:57:33 UTC
Patches sent upstream:

- to fix 'exit_reasons':
  http://patchwork.ozlabs.org/patch/624386/

- to fix event queue RESET:
  http://patchwork.ozlabs.org/patch/624421/

Comment 6 mazhang 2016-05-23 06:17:40 UTC
Since qemu-kvm-tools-rhev-2.5.0-4.el7.ppc64le doesn't has this problem, set this bug as Regression.

Comment 8 Laurent Vivier 2016-05-23 14:11:58 UTC
The fix that will be applied upstream will be:

http://patchwork.ozlabs.org/patch/611965/

Comment 9 David Gibson 2016-06-01 04:58:37 UTC
Hrm.  Laurent's fix doesn't appear to have gone upstream, and now kvm_stat has been removed entirely from the qemu tree (because it's in the kernel tree).

Since we're basing on qemu-2.6, I think we should keep to kvm_stat in qemu, rather than the kernel.  So, it looks like we might need to carry this as a downstream only patch.

Laurent, does that sound reasonable?

Comment 10 Laurent Vivier 2016-06-01 07:33:51 UTC
(In reply to David Gibson from comment #9)
> Hrm.  Laurent's fix doesn't appear to have gone upstream, and now kvm_stat
> has been removed entirely from the qemu tree (because it's in the kernel
> tree).
> 
> Since we're basing on qemu-2.6, I think we should keep to kvm_stat in qemu,
> rather than the kernel.  So, it looks like we might need to carry this as a
> downstream only patch.
> 
> Laurent, does that sound reasonable?

Paolo has sent me an email saying he will take the patch from someone else sent in April (but it is the same fix):

http://patchwork.ozlabs.org/patch/611965/

I was waiting this patch been applied upstream in qemu or linux kvm_stat to backport it in qemu kvm_stat (to keep them in sync).

Paolo, any comment?

Comment 11 Laurent Vivier 2016-06-01 13:57:55 UTC
I've found the commit in linux repo, I'm backporting it to qemu.

Comment 12 Miroslav Rezanina 2016-06-06 10:51:03 UTC
Fix included in qemu-kvm-rhev-2.6.0-5.el7

Comment 14 mazhang 2016-06-08 09:16:26 UTC
Verify this bug on qemu-kvm-tools-rhev-2.6.0-5.el7.ppc64le

kvm_stat work well.

kvm statistics - summary

 Event                                        Total Current
 kvm_userspace_exit                          209133   10268
 kvm_ppc_instr                                  952       0


This bug has been fixed.

Comment 17 errata-xmlrpc 2016-11-07 21:10:16 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/RHBA-2016-2673.html


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