Skip to contentSkip to conversation

xl pci-attach silently fails the first time

DISCUSSION Olaf Hering 5 participants 18 messages Dec 1, 2014 – Dec 4, 2014

lore
Share & tools
lore
#0 lore raw

I tried to attach a PCI device (IGB Virtual Function) to a HVM guest. To actually get it assigned its required to run pci-attach/pci-detach/pci-attach because it does not show up right away. Did anyone noticed this bug already, is there a fix? There is no error reported in dom0 dmesg, xl dmesg or qemu logfiles.

My domU.cfg looks like this:
name="domU"
memory=512
builder="hvm"
vif=['',]
disk=[ 'file:/SLE-12-Server-DVD-x86_64-GM-DVD1.iso,hda:cdrom' ] serial="pty"

# xl pci-assignable-add 01:10.0
# xl pci-assignable-list
0000:01:10.0
# xl create -f domU.cfg
# xl console domU
## lspci gives just emulated PCI devices
## detach from domU console
# xl pci-attach domU 0000:01:10.0
# xl pci-list domU
Vdev Device
04.0 0000:01:10.0
# xl console domU
## lspci gives just emulated PCI devices
## detach from domU console
# xl pci-detach domU 0000:01:10.0
# xl pci-attach domU 0000:01:10.0
# xl pci-list domU
Vdev Device
04.0 0000:01:10.0
# xl console domU
## lspci shows now also the assigned host device

Olaf

#1 lore raw
Quoted 6 lines · Olaf Hering
# xl pci-assignable-add 01:10.0
# xl pci-assignable-list
0000:01:10.0
# xl create -f domU.cfg
# xl console domU
## lspci gives just emulated PCI devices

ttyS0:Rescue:~ # lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
00:03.0 VGA compatible controller: Cirrus Logic GD 5446
00:04.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8100/8101L/8139 PCI Fast Ethernet Adapter (rev ff)

Quoted 8 lines

## detach from domU console

# xl pci-attach domU 0000:01:10.0
# xl pci-list domU
Vdev Device
04.0 0000:01:10.0
# xl console domU
## lspci gives just emulated PCI devices

ttyS0:Rescue:~ # lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
00:03.0 VGA compatible controller: Cirrus Logic GD 5446
00:04.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8100/8101L/8139 PCI Fast Ethernet Adapter (rev 01)

Quoted 2 lines

## detach from domU console

# xl pci-detach domU 0000:01:10.0

Now lspci shows that the emulated network card is gone. ttyS0:Rescue:~ # lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02) 00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] 00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] 00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03) 00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01) 00:03.0 VGA compatible controller: Cirrus Logic GD 5446

Quoted 6 lines
# xl pci-attach domU 0000:01:10.0
# xl pci-list domU
Vdev Device
04.0 0000:01:10.0
# xl console domU
## lspci shows now also the assigned host device

So the actual bug is that the very first time after pci-attach the guests "00:04.0" PCI device is (most likely) replaced with the host PCI device. Just the guest does not notice that "00:04.0" was actually already gone after unplug.

I wonder why the unplug code in xen_platform.c does just a qdev_free() instead of a real pci-detach kind of thing. I'm sure this could be done at least for emulated network cards.

Olaf

#2 lore raw
Quoted 1 line · Olaf Hering
Quoted 1 line
# xl pci-attach domU 0000:01:10.0

"xl pci-attach -h" mentions [Virtual Slot], but the code does not seem to handle an additional parameter, pciattach() ignores *vs.

What is the "Virtual Slot", why is it ignored?

Olaf

#3 lore raw
Quoted 8 lines · you
Quoted 1 line · Olaf Hering
Quoted 1 line
# xl pci-attach domU 0000:01:10.0

"xl pci-attach -h" mentions [Virtual Slot], but the code does not seem to handle an additional parameter, pciattach() ignores *vs.

What is the "Virtual Slot", why is it ignored?

Hmm the wiki also still mentions it: http://wiki.xen.org/wiki/Xen_PCI_Passthrough

It was the ability with xend + qemu-trad to be able to specify the slot to use in the guest for the pci device.

See docs/misc/vtd.txt .. that seems it has never been updated :-)

(together with passing through a multifunction devices as multifunction inside the guest this hasn't got implemented in neither libxl and qemu-xen.)

--
Sander

Quoted 1 line

From docs/misc/vtd.txt:

VTd device hotplug:
-------------------

2 virtual PCI slots (6~7) are reserved in HVM guest to support VTd hotplug. If you have more VTd devices, only 2 of them can support hotplug. Usage is simple:

1. List the VTd device by dom. You can see a VTd device 0:2:0.0 is inserted in the HVM domain's PCI slot 6. '''lspci''' inside the guest should see the same.

[root@vt-vtd ~]# xm pci-list HVMDomainVtd
VSlt domain bus slot func
0x6 0x0 0x02 0x00 0x0

2. Detach the device from the guest by the physical BDF. Then HVM guest will receive a virtual PCI hot removal event to detach the physical device

        [root@vt-vtd ~]# xm pci-detach HVMDomainVtd 0:2:0.0

3. Attach a PCI device to the guest by the physical BDF and desired virtual slot(optional). Following command would insert the physical device into guest's virtual slot 7

        [root@vt-vtd ~]# xm pci-attach HVMDomainVtd 0:2:0.0 7

    To specify options for the device, use -o or --options=. Following command would disable MSI-INTx translation for the device

        [root@vt-vtd ~]# xm pci-attach -o msitranslate=0 0:2:0.0 7
Quoted 1 line

Olaf

#4 lore raw
Quoted 9 lines · Sander Eikelenboom

Hmm the wiki also still mentions it: http://wiki.xen.org/wiki/Xen_PCI_Passthrough

It was the ability with xend + qemu-trad to be able to specify the slot to use in the guest for the pci device.

See docs/misc/vtd.txt .. that seems it has never been updated :-)

(together with passing through a multifunction devices as multifunction inside the guest this hasn't got implemented in neither libxl and qemu-xen.)

So this looks like we a lost feature in libxl. Not sure if that would actually be a workaround for the double pci-attach bug.

Olaf

#5 lore raw
Quoted 7 lines · Olaf Hering
Quoted 5 lines · Sander Eikelenboom

Hmm the wiki also still mentions it: http://wiki.xen.org/wiki/Xen_PCI_Passthrough

It was the ability with xend + qemu-trad to be able to specify the slot to use in the guest for the pci device.

Quoted 6 lines
Quoted 4 lines

See docs/misc/vtd.txt .. that seems it has never been updated :-)

(together with passing through a multifunction devices as multifunction inside the guest this hasn't got implemented in neither libxl and qemu-xen.)

So this looks like we a lost feature in libxl.

See http://bugs.xenproject.org/xen/bug/22 (I think that's what that is)

Ian.

#6 lore raw
Quoted 7 lines · Ian Campbell
Quoted 6 lines · Olaf Hering
Quoted 5 lines · Sander Eikelenboom

Hmm the wiki also still mentions it: http://wiki.xen.org/wiki/Xen_PCI_Passthrough

It was the ability with xend + qemu-trad to be able to specify the slot to use in the guest for the pci device.

Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

See docs/misc/vtd.txt .. that seems it has never been updated :-)

(together with passing through a multifunction devices as multifunction inside the guest this hasn't got implemented in neither libxl and qemu-xen.)

So this looks like we a lost feature in libxl.

See http://bugs.xenproject.org/xen/bug/22 (I think that's what that is)

Yes, the virtual function part is covered by #22. Thanks.

Olaf

#7 lore raw
In reply to Olaf Hering
Quoted 7 lines · you
Quoted 5 lines · Sander Eikelenboom

Hmm the wiki also still mentions it: http://wiki.xen.org/wiki/Xen_PCI_Passthrough

It was the ability with xend + qemu-trad to be able to specify the slot to use in the guest for the pci device.

Quoted 6 lines
Quoted 4 lines

See docs/misc/vtd.txt .. that seems it has never been updated :-)

(together with passing through a multifunction devices as multifunction inside the guest this hasn't got implemented in neither libxl and qemu-xen.)

So this looks like we a lost feature in libxl.

Yes, they are on the bug list though for quite some time :-). see http://bugs.xenproject.org/xen/bug/22
Although the multifuction part missing is only slightly noted there.

(a fix would need a part libxl and for HVM's at least part qemu-xen (since qemu-xen doesn't have the option implemented that qemu-trad has for the slot and multifunction assignment))

Quoted 1 line

actually be a workaround for the double pci-attach bug.

Don't know about that bug.

--
Sander

Quoted 1 line

Olaf

#9 lore raw
In reply to Olaf Hering
Quoted 56 lines · Olaf Hering
Quoted 6 lines · Olaf Hering
# xl pci-assignable-add 01:10.0
# xl pci-assignable-list
0000:01:10.0
# xl create -f domU.cfg
# xl console domU
## lspci gives just emulated PCI devices

ttyS0:Rescue:~ # lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
00:03.0 VGA compatible controller: Cirrus Logic GD 5446
00:04.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8100/8101L/8139 PCI Fast Ethernet Adapter (rev ff)

Quoted 8 lines

## detach from domU console

# xl pci-attach domU 0000:01:10.0
# xl pci-list domU
Vdev Device
04.0 0000:01:10.0
# xl console domU
## lspci gives just emulated PCI devices

ttyS0:Rescue:~ # lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
00:03.0 VGA compatible controller: Cirrus Logic GD 5446
00:04.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8100/8101L/8139 PCI Fast Ethernet Adapter (rev 01)

Quoted 2 lines

## detach from domU console

# xl pci-detach domU 0000:01:10.0

Now lspci shows that the emulated network card is gone.

ttyS0:Rescue:~ # lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02) 00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] 00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] 00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03) 00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01) 00:03.0 VGA compatible controller: Cirrus Logic GD 5446

Quoted 6 lines
# xl pci-attach domU 0000:01:10.0
# xl pci-list domU
Vdev Device
04.0 0000:01:10.0
# xl console domU
## lspci shows now also the assigned host device
Quoted 3 lines

So the actual bug is that the very first time after pci-attach the guests "00:04.0" PCI device is (most likely) replaced with the host PCI device. Just the guest does not notice that "00:04.0" was actually already gone after unplug.

That is odd - I see any device 'hot-plugged' being added at 00:05 and further.

Quoted 11 lines

I wonder why the unplug code in xen_platform.c does just a qdev_free() instead of a real pci-detach kind of thing. I'm sure this could be done at least for emulated network cards.

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#10 lore raw
Quoted 1 line · Konrad Rzeszutek Wilk

That is odd - I see any device 'hot-plugged' being added at 00:05 and further.

Does this by any chance depend on the guest?! I mean, how is the guest notified that a PCI device is gone (by unplug)? Maybe the pvops case just happens to work because the unplug happens early, perhaps before PCI discovery?!

Olaf

#8 lore raw
In reply to Sander Eikelenboom
Quoted 3 lines · Sander Eikelenboom
Quoted 1 line · you

actually be a workaround for the double pci-attach bug.

Don't know about that bug.

You just replied to it. ;-)

Olaf

#11 lore raw
In reply to Olaf Hering
Quoted 5 lines · Olaf Hering
Quoted 1 line · Konrad Rzeszutek Wilk

That is odd - I see any device 'hot-plugged' being added at 00:05 and further.

Does this by any chance depend on the guest?! I mean, how is the guest

I doubt it.

Quoted 3 lines

notified that a PCI device is gone (by unplug)? Maybe the pvops case just happens to work because the unplug happens early, perhaps before PCI discovery?!

ACPI hotplug. And it does work after PCI discovery.

Quoted 2 lines

Olaf

#12 lore raw
Quoted 8 lines · Konrad Rzeszutek Wilk
Quoted 5 lines · Olaf Hering
Quoted 1 line · Konrad Rzeszutek Wilk

That is odd - I see any device 'hot-plugged' being added at 00:05 and further.

Does this by any chance depend on the guest?! I mean, how is the guest

I doubt it.

Something is different here, likely just the non-pvops guest kernel.

Quoted 5 lines
Quoted 3 lines

notified that a PCI device is gone (by unplug)? Maybe the pvops case just happens to work because the unplug happens early, perhaps before PCI discovery?!

ACPI hotplug. And it does work after PCI discovery.

In a pvops kernel, is the emulated but unplugged PCI hardware still listed with lspci?

Olaf

#13 lore raw
Quoted 5 lines · Olaf Hering
Quoted 3 lines · Konrad Rzeszutek Wilk
Quoted 1 line · Olaf Hering

On Mon, Dec 01, Konrad Rzeszutek Wilk wrote:

ACPI hotplug. And it does work after PCI discovery.

In a pvops kernel, is the emulated but unplugged PCI hardware still listed with lspci?

It is not. So thats why it happens to work.

So how would I trigger an ACPI hotplug event within qemus unplug code?

Olaf

#14 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 57 lines · Konrad Rzeszutek Wilk
Quoted 56 lines · Olaf Hering
Quoted 6 lines · Olaf Hering
# xl pci-assignable-add 01:10.0
# xl pci-assignable-list
0000:01:10.0
# xl create -f domU.cfg
# xl console domU
## lspci gives just emulated PCI devices

ttyS0:Rescue:~ # lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
00:03.0 VGA compatible controller: Cirrus Logic GD 5446
00:04.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8100/8101L/8139 PCI Fast Ethernet Adapter (rev ff)

Quoted 8 lines

## detach from domU console

# xl pci-attach domU 0000:01:10.0
# xl pci-list domU
Vdev Device
04.0 0000:01:10.0
# xl console domU
## lspci gives just emulated PCI devices

ttyS0:Rescue:~ # lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
00:03.0 VGA compatible controller: Cirrus Logic GD 5446
00:04.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8100/8101L/8139 PCI Fast Ethernet Adapter (rev 01)

Quoted 2 lines

## detach from domU console

# xl pci-detach domU 0000:01:10.0

Now lspci shows that the emulated network card is gone.

ttyS0:Rescue:~ # lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02) 00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] 00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] 00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03) 00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01) 00:03.0 VGA compatible controller: Cirrus Logic GD 5446

Quoted 6 lines
# xl pci-attach domU 0000:01:10.0
# xl pci-list domU
Vdev Device
04.0 0000:01:10.0
# xl console domU
## lspci shows now also the assigned host device
Quoted 5 lines
Quoted 3 lines

So the actual bug is that the very first time after pci-attach the guests "00:04.0" PCI device is (most likely) replaced with the host PCI device. Just the guest does not notice that "00:04.0" was actually already gone after unplug.

That is odd - I see any device 'hot-plugged' being added at 00:05 and further.

I have to apologize. The reason it works for me is because the emulated device gets unplugged quite early:

# lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 Class ff80: XenSource, Inc. Xen Platform Device (rev 01)
00:03.0 VGA compatible controller: Cirrus Logic GD 5446

[and here I run 'xl pci-attach USB 00:1a.0]

# [ 30.609802] hpet1: lost 1589 rtc interrupts

[   30.672030] hpet1: lost 2200 rtc interrupts
[   30.672030] hpet1: lost 2201 rtc interrupts
[   30.672030] hpet1: lost 2200 rtc interrupts
[   30.899341] pci 0000:00:04.0: [8086:1c2d] type 00 class 0x0c0320

And the other test I have been running is when the guest is booted with an PCI device (and then unplugged):

# lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 01)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Class ff80: XenSource, Inc. Xen Platform Device (rev 01)
00:05.0 USB Controller: Intel Corporation Cougar Point USB Enhanced Host Controller #2 (rev 04)

But oddly enough when I do 'pci-detach' and then 'pci-attach' I get:
lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02) 00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] 00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] 00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 01)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Class ff80: XenSource, Inc. Xen Platform Device (rev 01)
00:04.0 USB Controller: Intel Corporation Cougar Point USB Enhanced Host Controller #2 (rev 04)

so something is busted as you surmised

And it looks to be busted in two cases - I see the 'hpet1' issues and the guest then crashes!

Quoted 17 lines
Quoted 6 lines

I wonder why the unplug code in xen_platform.c does just a qdev_free() instead of a real pci-detach kind of thing. I'm sure this could be done at least for emulated network cards.

Quoted 6 lines

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#15 lore raw
Quoted 105 lines · Konrad Rzeszutek Wilk
Quoted 57 lines · Konrad Rzeszutek Wilk
Quoted 56 lines · Olaf Hering
Quoted 6 lines · Olaf Hering
# xl pci-assignable-add 01:10.0
# xl pci-assignable-list
0000:01:10.0
# xl create -f domU.cfg
# xl console domU
## lspci gives just emulated PCI devices

ttyS0:Rescue:~ # lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
00:03.0 VGA compatible controller: Cirrus Logic GD 5446
00:04.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8100/8101L/8139 PCI Fast Ethernet Adapter (rev ff)

Quoted 8 lines

## detach from domU console

# xl pci-attach domU 0000:01:10.0
# xl pci-list domU
Vdev Device
04.0 0000:01:10.0
# xl console domU
## lspci gives just emulated PCI devices

ttyS0:Rescue:~ # lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
00:03.0 VGA compatible controller: Cirrus Logic GD 5446
00:04.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8100/8101L/8139 PCI Fast Ethernet Adapter (rev 01)

Quoted 2 lines

## detach from domU console

# xl pci-detach domU 0000:01:10.0

Now lspci shows that the emulated network card is gone.

ttyS0:Rescue:~ # lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02) 00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] 00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] 00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03) 00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01) 00:03.0 VGA compatible controller: Cirrus Logic GD 5446

Quoted 6 lines
# xl pci-attach domU 0000:01:10.0
# xl pci-list domU
Vdev Device
04.0 0000:01:10.0
# xl console domU
## lspci shows now also the assigned host device
Quoted 5 lines
Quoted 3 lines

So the actual bug is that the very first time after pci-attach the guests "00:04.0" PCI device is (most likely) replaced with the host PCI device. Just the guest does not notice that "00:04.0" was actually already gone after unplug.

That is odd - I see any device 'hot-plugged' being added at 00:05 and further.

I have to apologize. The reason it works for me is because the emulated device gets unplugged quite early:

# lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 Class ff80: XenSource, Inc. Xen Platform Device (rev 01)
00:03.0 VGA compatible controller: Cirrus Logic GD 5446

[and here I run 'xl pci-attach USB 00:1a.0]

# [ 30.609802] hpet1: lost 1589 rtc interrupts

[   30.672030] hpet1: lost 2200 rtc interrupts
[   30.672030] hpet1: lost 2201 rtc interrupts
[   30.672030] hpet1: lost 2200 rtc interrupts
[   30.899341] pci 0000:00:04.0: [8086:1c2d] type 00 class 0x0c0320

And the other test I have been running is when the guest is booted with an PCI device (and then unplugged):

# lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 01)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Class ff80: XenSource, Inc. Xen Platform Device (rev 01)
00:05.0 USB Controller: Intel Corporation Cougar Point USB Enhanced Host Controller #2 (rev 04)

But oddly enough when I do 'pci-detach' and then 'pci-attach' I get:
lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02) 00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] 00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] 00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 01)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Class ff80: XenSource, Inc. Xen Platform Device (rev 01)
00:04.0 USB Controller: Intel Corporation Cougar Point USB Enhanced Host Controller #2 (rev 04)

Quoted 4 lines

so something is busted as you surmised

And it looks to be busted in two cases - I see the 'hpet1' issues and the guest then crashes!

But that only shows up on this particular machine. If I use VFs and unplug/plug it works OK.

#16 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 1 line · Konrad Rzeszutek Wilk

so something is busted as you surmised

I haven't been following closely, so this may be completely unrelated to the issue under discussion, but doesn't in-HVM-guest hotplug require a guest side driver to be loaded? I recall in the dim and distant past having to manually load some sort of foo_hp.ko.

Ian.

#17 lore raw
Quoted 9 lines · Ian Campbell
Quoted 1 line · Konrad Rzeszutek Wilk

so something is busted as you surmised

I haven't been following closely, so this may be completely unrelated to the issue under discussion, but doesn't in-HVM-guest hotplug require a guest side driver to be loaded? I recall in the dim and distant past having to manually load some sort of foo_hp.ko.

The ACPI PCI hotplug machinery does all of that nicely.

As mentioned - it works nicely - except that the BDF that is chosen is at an wrong slot. In the 'xend' days in recall this working nicely and sticking the PF at slot 5 and beyond. Though I have no clue how it dealt with multiple emulated NICs and such.

Quoted 2 lines

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel