Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 638875

Summary: Assign one VF to guest failed
Product: Red Hat Enterprise Linux 5 Reporter: Min Zhan <mzhan>
Component: libvirtAssignee: Daniel Veillard <veillard>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 5.6CC: dyuan, eblake, jdenemar, llim, mzhan, tyan, virt-maint, xen-maint
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-10-20 11:37:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Min Zhan 2010-09-30 08:17:04 UTC
Description of problem:
Assign one VF to guest failed

Version-Release number of selected component (if applicable):
RHEL5.6-Server-x86_64-kvm
kvm-83-199.el5
kvm-qemu-img-83-199.el5
libvirt-0.8.2-6.el5

How reproducible:
Always

Steps to Reproduce:
1.# lspci|grep 82576
03:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
03:00.1 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
03:10.1 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
03:10.3 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
2.# lspci -n |grep 03:10.3
03:10.3 0200: 8086:10ca (rev 01)
3.# virsh nodedev-dumpxml pci_8086_10ca_0
<device>
  <name>pci_8086_10ca_0</name>
  <parent>pci_8086_3408</parent>
  <driver>
    <name>pci-stub</name>
  </driver>
  <capability type='pci'>
    <domain>0</domain>
    <bus>3</bus>
    <slot>16</slot>
    <function>1</function>
    <product id='0x10ca'>82576 Virtual Function</product>
    <vendor id='0x8086'>Intel Corporation</vendor>
    <capability type='phys_function'>
      <address domain='0x0000' bus='0x03' slot='0x00' function='0x1'/>
    </capability>
  </capability>
</device>
4.Add this VF xml info to guest config xml(guest mig is in shutoff status)
...
          <hostdev mode='subsystem' type='pci'>
            <source>
              <address bus='3' slot='16' function='1'/>
            </source>
          </hostdev>
          ...
5.# virsh nodedev-dettach pci_8086_10ca
6.# virsh start mig
Domain mig started 
7.On guest, check whether VF is already assigned successfully
#lscpi | grep 82576
  
Actual results:
step7:no output

Expected results:
step 7: should display assigned VF information

Additional info:

Comment 1 Min Zhan 2010-10-08 06:31:07 UTC
mig.log:assigned_dev_pci_read_config: pread failed, ret = 0 errno = 0

Comment 2 Jiri Denemark 2010-10-08 11:11:56 UTC
Is selinux in permissive or enforcing mode? If it is enforcing, does anything change when you switch selinux to permissive? If so, could you check what selinux is complaining about in enforcing mode and attach more info about that?

Comment 3 Min Zhan 2010-10-20 05:51:16 UTC
Hi Jiri,

I have tried with permissive mode and enforcing mode. No output when using lspci|grep 82576 in guest.

--------Permissive mode----------

step 7 still has no output in Permissive mode.

# tail -f /var/log/libvirt/qemu/rh55.log
LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin HOME=/ QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -S -M rhel5.4.0 -no-kvm -m 512 -smp 1 -name rh55 -uuid 20e1cb0f-8277-5090-d20f-06d00ff5343b -monitor unix:/var/lib/libvirt/qemu/rh55.monitor,server,nowait -boot c -drive file=/var/lib/libvirt/images/rh5.6.img,if=ide,bus=0,unit=0,format=raw,cache=none -net nic,macaddr=54:52:00:40:75:78,vlan=0 -net tap,fd=18,vlan=0 -serial pty -parallel none -usb -vnc 127.0.0.1:0 -k en-us -vga cirrus -soundhw ac97 -pcidevice host=03:10.1 -balloon virtio 
char device redirected to /dev/pts/3

# tail -f /var/log/messages 
Oct 20 01:39:44 dhcp-66-92-51 dbus: avc:  received setenforce notice (enforcing=0) 
Oct 20 01:40:04 dhcp-66-92-51 libvirtd: 01:40:04.394: warning : SELinuxRestoreSecurityFileLabel:385 : cannot lookup default selinux label for /sys/bus/pci/devices/0000:03:10.1/resource3 


-------------Enforcing mode----------

step 7 still has no output in Enforcing mode.

# tail -f /var/log/libvirt/qemu/rh55.log
LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin HOME=/ QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -S -M rhel5.4.0 -no-kvm -m 512 -smp 1 -name rh55 -uuid 20e1cb0f-8277-5090-d20f-06d00ff5343b -monitor unix:/var/lib/libvirt/qemu/rh55.monitor,server,nowait -boot c -drive file=/var/lib/libvirt/images/rh5.6.img,if=ide,bus=0,unit=0,format=raw,cache=none -net nic,macaddr=54:52:00:40:75:78,vlan=0 -net tap,fd=18,vlan=0 -serial pty -parallel none -usb -vnc 127.0.0.1:0 -k en-us -vga cirrus -soundhw ac97 -pcidevice host=03:10.1 -balloon virtio 
char device redirected to /dev/pts/3

# tail -f /var/log/messages
Oct 20 01:41:18 dhcp-66-92-51 dbus: avc:  received setenforce notice (enforcing=1)

Comment 4 Min Zhan 2010-10-20 05:52:09 UTC
(In reply to comment #3)

Also the Version-Release number of selected component:
RHEL5.6-Server-x86_64-kvm
libvirt-0.8.2-7.el5
kvm-qemu-img-83-205.el5
kvm-83-205.el5

Comment 5 Min Zhan 2010-10-20 10:39:42 UTC
Version-Release number of selected component:
RHEL5.6-Server-x86_64-kvm
libvirt-0.8.2-7.el5
kvm-qemu-img-83-205.el5
kvm-83-205.el5


I have tried in these scenarios about passthrough using kvm type
guest with managed=yes.

- Permissive mode VF passthrough
- Enforcing mode VF passthrough
Works well and VF can be checked in guest.

Comment 6 Jiri Denemark 2010-10-20 11:37:45 UTC
ok, so this is not a bug then since it works