Bug 1346723
| Summary: | some bugs in function which used to parse perf event xml element | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Luyao Huang <lhuang> |
| Component: | libvirt | Assignee: | Peter Krempa <pkrempa> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.3 | CC: | fjin, pkrempa, rbalakri, yalzhang |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| 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 18:47:04 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Fixed upstream:
commit 23690e1d74b3551eecb69e2187ed4089238a9838
Author: Peter Krempa <pkrempa>
Date: Wed Jun 15 16:33:20 2016 +0200
conf: Fix perf event parser
The parser was totaly broken. Fix it by rewriting it. Add tests so that
it doesn't happen.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1346723
commit c22dad33c2b5e8a93d540715604784032783734f
Author: Peter Krempa <pkrempa>
Date: Wed Jun 15 16:31:19 2016 +0200
docs: Add at least some docs and fix schema entry for perf events
There was no documentation at all for the XML part. I added at least
some. The 2.0.0 introduction date is deliberate as the parser for the
XML is broken.
The schema file was missing entries for 'mbml' and 'mbmt'.
Hi Peter,
Test on libvirt-2.0.0-1.el7.x86_64, the 'mbmt' and 'mbml' pass the xml validate. But the guest can not start with a mbmt or mbml set to enable, If there is any restriction?
# virsh dumpxml rhel7.2 | grep /perf -B4
<perf>
<event name='cmt' enabled='no'/>
<event name='mbmt' enabled='yes'/>
<event name='mbml' enabled='no'/>
</perf>
# virsh start rhel7.2
error: Failed to start domain rhel7.2
error: Unable to open perf type=26 for pid=24570: Invalid argument
# virsh perf rhel7.2 --enable mbml --disable cmt,mbmt
# virsh perf rhel7.2
cmt : disabled
mbmt : disabled
mbml : enabled
# virsh start rhel7.2
error: Failed to start domain rhel7.2
error: Unable to open perf type=26 for pid=24633: Invalid argument
# virsh perf rhel7.2 --enable cmt --disable mbml,mbmt
# virsh start rhel7.2
Domain rhel7.2 started
# virsh perf rhel7.2 --enable cmt,mbml --disable mbmt
error: Unable to enable/disable perf events
error: Unable to open perf type=26 for pid=24713: Invalid argument
Sorry, Commet 3 is test on a machine with CPU E5-2620 v3, which do not support mbm and just support cmt. I will reserve a machine with E5-2600 v4 CPU and retest this bug. Hi Peter, Could you please help to confirm if below results is expected? 1. After restart libvirtd, the perf.cmt, perf.mbmt and perf.mbml may be '0' # virsh domstats rhel7.2 --perf Domain: 'rhel7.2' perf.cmt=19087360 perf.mbmt=77168640 perf.mbml=67788800 # service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service # service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service # virsh domstats rhel7.2 --perf Domain: 'rhel7.2' perf.cmt=122880 perf.mbmt=122880 perf.mbml=0 2. Besides, if the host do not support the cmt, mbm, the error message when start the guest is just like comment 3. If we can update the error message to something more clearly, such as "mbml/cmt/mbmt is not supported by the host CPU"? Test on a machine with cpu "Intel(R) Xeon(R) CPU E5-2640 v4". Both cmt, mbmt and mbml can be parsed correctly and pass xml validate. Add below lines in the guest's xml <perf> <event name='cmt' enabled='yes'/> <event name='mbmt' enabled='yes'/> <event name='mbml' enabled='yes'/> </perf> # virsh edit rhel7.2 Domain rhel7.2 XML configuration not changed. # virsh dumpxml rhel7.2 | grep /perf -B4 <perf> <event name='cmt' enabled='yes'/> <event name='mbmt' enabled='yes'/> <event name='mbml' enabled='yes'/> </perf> # virsh start rhel7.2 Domain rhel7.2 started # virsh perf rhel7.2 cmt : enabled mbmt : enabled mbml : enabled # service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service # virsh list Id Name State ---------------------------------------------------- 20 rhel7.2 running # virsh domstats rhel7.2 --perf Domain: 'rhel7.2' perf.cmt=81920 perf.mbmt=819200 perf.mbml=450560 (In reply to yalzhang from comment #5) > Hi Peter, > Could you please help to confirm if below results is expected? > > 1. After restart libvirtd, the perf.cmt, perf.mbmt and perf.mbml may be '0' > # virsh domstats rhel7.2 --perf > Domain: 'rhel7.2' > perf.cmt=19087360 > perf.mbmt=77168640 > perf.mbml=67788800 > # service libvirtd restart > Redirecting to /bin/systemctl restart libvirtd.service > # service libvirtd restart > Redirecting to /bin/systemctl restart libvirtd.service > # virsh domstats rhel7.2 --perf > Domain: 'rhel7.2' > perf.cmt=122880 > perf.mbmt=122880 > perf.mbml=0 I unfortunately don't really know how that is supposed to work. > 2. Besides, if the host do not support the cmt, mbm, the error message when > start the guest is just like comment 3. If we can update the error message > to something more clearly, such as "mbml/cmt/mbmt is not supported by the > host CPU"? It might be worth to do so. As that isn't a critical issue I'd suggest you file a new bug for this since otherwise I'll probably forget about it. (In reply to Peter Krempa from comment #6) > (In reply to yalzhang from comment #5) > > Hi Peter, > > Could you please help to confirm if below results is expected? > > > > 1. After restart libvirtd, the perf.cmt, perf.mbmt and perf.mbml may be '0' > > 2. Besides, if the host do not support the cmt, mbm, the error message when > > start the guest is just like comment 3. If we can update the error message > > to something more clearly, such as "mbml/cmt/mbmt is not supported by the > > host CPU"? > > It might be worth to do so. As that isn't a critical issue I'd suggest you > file a new bug for this since otherwise I'll probably forget about it. File a bug Bug 1360533 - The error message need to improve when enable a perf event on a host which do not support it 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 |
Description of problem: some bugs in function which used to parse perf event xml element Version-Release number of selected component (if applicable): libvirt-1.3.5-1.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. use perf cmd to set 2 event and restart libvirtd, guest will disappear: # virsh perf rhel7.0-rhel cmt : enabled mbmt : disabled mbml : enabled # service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service # virsh dumpxml rhel7.0-rhel error: failed to get domain 'rhel7.0-rhel' error: Domain not found: no domain with matching name 'rhel7.0-rhel' log: internal error: A domain definition can have no more than one event node with name no 2. add mbml event in guest xml, the xml will fail xml validate check: # virsh edit rhel7.0-rhel add this <perf> <event name='mbml' enabled='yes'/> </perf> error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng Extra element perf in interleave Element domain failed to validate content Failed. Try again? [y,n,i,f,?]: 3. add mbml event in guest xml and libvirt will parse it as cmt: # virsh edit rhel7.0-rhel --skip-validate add this <perf> <event name='mbml' enabled='yes'/> </perf> Domain rhel7.0-rhel XML configuration edited. # virsh dumpxml rhel7.0-rhel --inactive |grep -1 perf </pm> <perf> <event name='cmt' enabled='yes'/> </perf> <devices> 4. the output error not correct when enable 2 event in guest: # virsh perf rhel7.0-rhel cmt : enabled mbmt : disabled mbml : enabled # virsh start rhel7.0-rhel error: Failed to start domain rhel7.0-rhel error: internal error: A domain definition can have no more than one event node with name no ^ ~~~~~~~ i think should be the event name Actual results: check the steps Expected results: 1. guest still exist 2. fix schema 3. fix it 4. report error like this: A domain definition can have no more than one event node with name cmt Additional info: In virDomainPerfEventDefParseXML(): if (perf->events[VIR_PERF_EVENT_CMT] != VIR_TRISTATE_BOOL_ABSENT) { virReportError(VIR_ERR_INTERNAL_ERROR, _("A domain definition can have no more than " "one event node with name %s"), virTristateBoolTypeToString(name_type)); goto cleanup; } perf->events[VIR_PERF_EVENT_CMT] = enabled_type; libvirt will always update enable info to cmt event this cause the problem 1 and 3. Also libvirt should use virPerfEventTypeToString to format event name this cause problem 4 there is no schema update code in commit 90b9995d1 and this cause problem 2 <element name="event"> <attribute name="name"> <choice> <value>cmt</value> </choice> </attribute> <attribute name="enabled"> <ref name="virYesNo"/> </attribute> </element>