Bug 612008

Summary: Reattach NIC to host lead to host reboot
Product: Red Hat Enterprise Linux 6 Reporter: juzhang <juzhang>
Component: kernelAssignee: Don Dutile (Red Hat) <ddutile>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: medium Docs Contact:
Priority: high    
Version: 6.0CC: lihuang, michen, ndai
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-11 14:01:14 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 juzhang 2010-07-07 02:32:04 UTC
Description of problem:
First attach physical pass-though guest(vm), then reattach NIC to host lead to host reboot.

Version-Release number of selected component (if applicable):
#rpm -q qemu-kvm
qemu-kvm-0.12.1.2-2.90.el6.x86_64
#uname -r
2.6.32-37.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Unbind device from host kernel driver (PCI device 28:00.0)
1.1 lspci | grep Ethernet
lspci | grep Ethernet
01:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5764M Gigabit
Ethernet PCIe (rev 10)
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)
28:00.0 Ethernet controller: Intel Corporation 82572EI Gigabit Ethernet
Controller (Copper) (rev 06)
1.2. #lspci -n | grep 28:00.0
28:00.0 0200: 8086:10b9 (rev 06)
1.3 echo "8086 10b9" >/sys/bus/pci/drivers/pci-stub/new_id
1.4 echo 0000:28:00.0 >/sys/bus/pci/devices/0000\:28\:00.0/driver/unbind
1.5 echo 0000:28:00.0 >/sys/bus/pci/drivers/pci-stub/bind
2.boot guest
#/usr/libexec/qemu-kvm -m 4G -smp 4 -drive
file=/root/zhangjunyi/rhel6.32.raw,if=none,id=drive-virtio-disk0,boot=on,cache=none,format=raw
-device virtio-blk-pci,bus=pci.0,drive=drive-virtio-disk0,id=virtio-disk0
-netdev tap,id=hostnet0,vhost=on -device
virtio-net-pci,netdev=hostnet0,id=net0,mac=22:11:22:45:66:97 -device
virtio-balloon-pci -cpu qemu64,+sse2,+x2apic -monitor stdio -vnc :10 -qmp
tcp:0:4445,server,nowait -drive
file=/root/zhangjunyi/boot.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw
-device ide-drive,drive=drive-ide0-1-0 -boot c

3. hot-plug pass-through device
(qemu) device_add pci-assign,host=28:00.0,id=zjy
4.after step3, device was hot-plug successful.
(qemu) info pc
 Bus  0, device   0, function 0:
    Host bridge: PCI device 8086:1237
      id ""
  Bus  0, device   1, function 0:
    ISA bridge: PCI device 8086:7000
      id ""
  Bus  0, device   1, function 1:
    IDE controller: PCI device 8086:7010
      BAR4: I/O at 0xc000 [0xc00f].
      id ""
  Bus  0, device   1, function 3:
    Bridge: PCI device 8086:7113
      IRQ 9.
      id ""
  Bus  0, device   2, function 0:
    VGA controller: PCI device 1013:00b8
      BAR0: 32 bit prefetchable memory at 0xf0000000 [0xf1ffffff].
      BAR1: 32 bit memory at 0xf2000000 [0xf2000fff].
      BAR6: 32 bit memory at 0xffffffffffffffff [0x0000fffe].
      id ""
  Bus  0, device   3, function 0:
    SCSI controller: PCI device 1af4:1001
      IRQ 11.
      BAR0: I/O at 0xc040 [0xc07f].
      BAR1: 32 bit memory at 0xf2020000 [0xf2020fff].
      id "virtio-disk0"
  Bus  0, device   4, function 0:
    Ethernet controller: PCI device 1af4:1000
      IRQ 11.
      BAR0: I/O at 0xc080 [0xc09f].
      BAR1: 32 bit memory at 0xf2021000 [0xf2021fff].
      BAR6: 32 bit memory at 0xffffffffffffffff [0x0000fffe].
      id "net0"
  Bus  0, device   5, function 0:
    RAM controller: PCI device 1af4:1002
      IRQ 10.
      BAR0: I/O at 0xc0a0 [0xc0bf].
      id ""
  Bus  0, device   6, function 0:
    Ethernet controller: PCI device 8086:10b9
      IRQ 3.
      BAR0: 32 bit memory at 0xe0000000 [0xe001ffff].
      BAR1: 32 bit memory at 0xe0020000 [0xe003ffff].
      BAR2: I/O at 0x1000 [0x101f].
      BAR6: 32 bit prefetchable memory at 0xffffffffffffffff [0x0001fffe].
      id "zjy"
5.In host,Reset device to host kernel driver
#echo "8086 10b9" > /sys/bus/pci/devices/0000\:28\:00.0/driver/new_id
#echo 0000:28:00.0 > /sys/bus/pci/drivers/pci-stub/unbind
#echo 0000:28:00.0 > /sys/bus/pci/drivers/e1000e/bind
-bash: echo: write error: No such device
6.Hot plug-out physical NIC card 
(qemu) device_del zjy
7.After step6,physical was hot-plug out successful
8.In host,Reset device to host kernel driver again
#echo 0000:28:00.0 > /sys/bus/pci/drivers/e1000e/bind

Actual results:
After step8,host rebooted without any hints and  failed to boot up.


Expected results:
Anyway,can't cause host reboot.

Additional info:
Reattach NIC to host successful if do the following steps:
1.boot guest
#/usr/libexec/qemu-kvm -m 4G -smp 4 -drive
file=/root/zhangjunyi/rhel6.32.raw,if=none,id=drive-virtio-disk0,boot=on,cache=none,format=raw
-device virtio-blk-pci,bus=pci.0,drive=drive-virtio-disk0,id=virtio-disk0
-netdev tap,id=hostnet0,vhost=on -device
virtio-net-pci,netdev=hostnet0,id=net0,mac=22:11:22:45:66:97 -device
virtio-balloon-pci -cpu qemu64,+sse2,+x2apic -monitor stdio -vnc :10 -qmp
tcp:0:4445,server,nowait -drive
file=/root/zhangjunyi/boot.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw
-device ide-drive,drive=drive-ide0-1-0 -boot c
2. hot-plug pass-through device
(qemu) device_add pci-assign,host=28:00.0,id=zjy
3.after step2, device was hot-plug successful.
(qemu) info pci
 Bus  0, device   0, function 0:
    Host bridge: PCI device 8086:1237
      id ""
  Bus  0, device   1, function 0:
    ISA bridge: PCI device 8086:7000
      id ""
  Bus  0, device   1, function 1:
    IDE controller: PCI device 8086:7010
      BAR4: I/O at 0xc000 [0xc00f].
      id ""
  Bus  0, device   1, function 3:
    Bridge: PCI device 8086:7113
      IRQ 9.
      id ""
  Bus  0, device   2, function 0:
    VGA controller: PCI device 1013:00b8
      BAR0: 32 bit prefetchable memory at 0xf0000000 [0xf1ffffff].
      BAR1: 32 bit memory at 0xf2000000 [0xf2000fff].
      BAR6: 32 bit memory at 0xffffffffffffffff [0x0000fffe].
      id ""
  Bus  0, device   3, function 0:
    SCSI controller: PCI device 1af4:1001
      IRQ 11.
      BAR0: I/O at 0xc040 [0xc07f].
      BAR1: 32 bit memory at 0xf2020000 [0xf2020fff].
      id "virtio-disk0"
  Bus  0, device   4, function 0:
    Ethernet controller: PCI device 1af4:1000
      IRQ 11.
      BAR0: I/O at 0xc080 [0xc09f].
      BAR1: 32 bit memory at 0xf2021000 [0xf2021fff].
      BAR6: 32 bit memory at 0xffffffffffffffff [0x0000fffe].
      id "net0"
  Bus  0, device   5, function 0:
    RAM controller: PCI device 1af4:1002
      IRQ 10.
      BAR0: I/O at 0xc0a0 [0xc0bf].
      id ""
  Bus  0, device   6, function 0:
    Ethernet controller: PCI device 8086:10b9
      IRQ 3.
      BAR0: 32 bit memory at 0xe0000000 [0xe001ffff].
      BAR1: 32 bit memory at 0xe0020000 [0xe003ffff].
      BAR2: I/O at 0x1000 [0x101f].
      BAR6: 32 bit prefetchable memory at 0xffffffffffffffff [0x0001fffe].
      id "zjy"
4.Hot plug-out physical NIC card 
(qemu) device_del zjy
5.After step4,physical was hot-plug out successful
6.In host,Reset device to host kernel driver
#echo "8086 10b9" > /sys/bus/pci/devices/0000\:28\:00.0/driver/new_id
#echo 0000:28:00.0 > /sys/bus/pci/drivers/pci-stub/unbind
#echo 0000:28:00.0 > /sys/bus/pci/drivers/e1000e/bind

Comment 2 RHEL Program Management 2010-07-15 15:17:02 UTC
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release. It has
been denied for the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **