Bug 829040

Summary: Fix KVM device assignment bridge test
Product: Red Hat Enterprise Linux 5 Reporter: Alex Williamson <alex.williamson>
Component: kvmAssignee: Alex Williamson <alex.williamson>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.9CC: chayang, juzhang, knoel, michen, minovotn, mkenneth, pmatouse, qzhang, rhod, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: kvm-83-256.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 829031 Environment:
Last Closed: 2013-01-08 07:00:22 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:
Bug Depends On: 829031    
Bug Blocks:    

Comment 1 RHEL Program Management 2012-06-06 13:40:10 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 9 RHEL Program Management 2012-07-02 13:07:39 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 15 Qunfang Zhang 2012-07-13 08:43:38 UTC
Find a pci bridge that implements BAR resources:
]# lspci -v -s 03:00.0
03:00.0 PCI bridge: PLX Technology, Inc. PEX 8624 24-lane, 6-Port PCI Express Gen 2 (5.0 GT/s) Switch [ExpressLane] (rev bb) (prog-if 00 [Normal decode])
	Flags: bus master, fast devsel, latency 0
	Memory at ef2e0000 (32-bit, non-prefetchable) [size=128K]
	Bus: primary=03, secondary=04, subordinate=08, sec-latency=0
	I/O behind bridge: 0000f000-0000ffff
	Memory behind bridge: ef000000-ef1fffff
	Capabilities: [40] Power Management version 3
	Capabilities: [48] MSI: Enable+ Count=1/4 Maskable+ 64bit+
	Capabilities: [68] Express Upstream Port, MSI 00
	Capabilities: [a4] Subsystem: PLX Technology, Inc. PEX 8624 24-lane, 6-Port PCI Express Gen 2 (5.0 GT/s) Switch [ExpressLane]
	Capabilities: [100] Vendor Specific Information: ID=ffff Rev=15 Len=008 <?>
	Capabilities: [fb4] Advanced Error Reporting
	Capabilities: [138] Power Budgeting <?>
	Capabilities: [148] Virtual Channel
	Capabilities: [950] Vendor Specific Information: ID=0001 Rev=0 Len=010 <?>
	Kernel driver in use: pcieport-driver
	Kernel modules: shpchp

=====================
Reproduction:
kernel-2.6.18-308.el5
kvm-83-249.el5

Result:
The bridge can be assigned and host kernel panic!

# ./kvm-assignment-test 0000:03:00.0
Testing assignment without IOMMU, this should fail: failed (OK) -1 (Invalid argument)
Testing resource permissions:
  /sys/bus/pci/devices/0000:03:00.0/resource0: OK
Testing assignment with IOMMU, this should work: worked


====================
Verification:
kernel-2.6.18-326.el5
kvm-83-256.el5

Result:
The bridge can not be assigned.

# ./kvm-assignment-test  0000:03:00.0
Testing assignment without IOMMU, this should fail: failed (OK) -1 (Invalid argument)
Testing resource permissions:
  /sys/bus/pci/devices/0000:03:00.0/resource0: OK
Testing assignment with IOMMU, this should work: failed -1 (Operation not permitted)


Hi, Alex
Could you help have a look, is this expected?

Comment 16 Alex Williamson 2012-07-16 03:18:16 UTC
(In reply to comment #15)
> Verification:
> kernel-2.6.18-326.el5
> kvm-83-256.el5
> 
> Result:
> The bridge can not be assigned.
> 
> # ./kvm-assignment-test  0000:03:00.0
> Testing assignment without IOMMU, this should fail: failed (OK) -1 (Invalid
> argument)
> Testing resource permissions:
>   /sys/bus/pci/devices/0000:03:00.0/resource0: OK
> Testing assignment with IOMMU, this should work: failed -1 (Operation not
> permitted)
> 
> 
> Hi, Alex
> Could you help have a look, is this expected?

The test program doesn't look to see what type of device is being assigned, only the resource permissions.  Since we know this is exactly the kind of device we're trying to disallow, we can disregard that the test program thinks it should work and look only at the actual result.  I think this is therefore verified.  Thanks.

Comment 17 Qunfang Zhang 2012-07-16 03:22:13 UTC
Thanks for Alex's confirmation, setting to verified according to above comment 15 and comment 16.

Comment 19 errata-xmlrpc 2013-01-08 07:00:22 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.

http://rhn.redhat.com/errata/RHBA-2013-0007.html