Re: [Xen-devel] xl pci-attach silently fails the first time

2014-12-04 Thread Ian Campbell
On Wed, 2014-12-03 at 21:31 -0400, Konrad Rzeszutek Wilk wrote:
 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.


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] xl pci-attach silently fails the first time

2014-12-04 Thread Konrad Rzeszutek Wilk
On Dec 4, 2014 4:29 AM, Ian Campbell ian.campb...@citrix.com wrote:

 On Wed, 2014-12-03 at 21:31 -0400, Konrad Rzeszutek Wilk wrote:
  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.

 Ian.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] xl pci-attach silently fails the first time

2014-12-03 Thread Olaf Hering
On Tue, Dec 02, Konrad Rzeszutek Wilk wrote:

 On Tue, Dec 02, 2014 at 04:46:52PM +0100, Olaf Hering wrote:
  On Mon, Dec 01, Konrad Rzeszutek Wilk wrote:
  
   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.

  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

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] xl pci-attach silently fails the first time

2014-12-03 Thread Olaf Hering
On Wed, Dec 03, Olaf Hering wrote:

 On Tue, Dec 02, Konrad Rzeszutek Wilk wrote:
  On Tue, Dec 02, 2014 at 04:46:52PM +0100, Olaf Hering wrote:
   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

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] xl pci-attach silently fails the first time

2014-12-02 Thread Olaf Hering
On Mon, Dec 01, Sander Eikelenboom wrote:

 Monday, December 1, 2014, 3:34:09 PM, you wrote:
  actually be a workaround for the double pci-attach bug.
 Don't know about that bug.

You just replied to it. ;-)

Olaf

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] xl pci-attach silently fails the first time

2014-12-02 Thread Olaf Hering
On Mon, Dec 01, Konrad Rzeszutek Wilk wrote:

 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

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] xl pci-attach silently fails the first time

2014-12-02 Thread Konrad Rzeszutek Wilk
On Tue, Dec 02, 2014 at 04:46:52PM +0100, Olaf Hering wrote:
 On Mon, Dec 01, Konrad Rzeszutek Wilk wrote:
 
  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.

 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.
 
 Olaf

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] xl pci-attach silently fails the first time

2014-12-01 Thread Olaf Hering

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
: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 :01:10.0
# xl pci-list domU
Vdev Device
04.0 :01:10.0

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


Olaf

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] xl pci-attach silently fails the first time

2014-12-01 Thread Olaf Hering
On Mon, Dec 01, Olaf Hering wrote:

 # xl pci-assignable-add 01:10.0
 # xl pci-assignable-list
 :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)

 ## detach from domU console
 # xl pci-attach domU :01:10.0
 # xl pci-list domU
 Vdev Device
 04.0 :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)

 ## detach from domU console
 # xl pci-detach domU :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

 # xl pci-attach domU :01:10.0
 # xl pci-list domU
 Vdev Device
 04.0 :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

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] xl pci-attach silently fails the first time

2014-12-01 Thread Olaf Hering
On Mon, Dec 01, Ian Campbell wrote:

 On Mon, 2014-12-01 at 15:34 +0100, Olaf Hering wrote:
  On Mon, Dec 01, Sander Eikelenboom wrote:
   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.
 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

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel