xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Question about the XEN platform pci
@ 2016-04-08  8:52 Wu, Bob
  2016-04-11 14:24 ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 12+ messages in thread
From: Wu, Bob @ 2016-04-08  8:52 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 560 bytes --]


Sorry bother, I read the XEN source code recently, and found the XEN platform PCI code under drivers/xen/platform-pci.c,
and I can't fully under this driver's affect, can anybody explain a little for me?

Is the platform PCI driver for PV-split-PCI-driver-model such as the pci-frontend/pci-backend? or for PCI pass-through model? Or for other purpose?
I saw the xenbus_pcifront_driver/ xenbus_xen_pcibk_driver are registered on XENBUS, so I guess the platform-PCI-driver is not for PV PCI driver.

Really thank you for your replay.

Thanks,
Bob


[-- Attachment #1.2: Type: text/html, Size: 3200 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Question about the XEN platform pci
  2016-04-08  8:52 Question about the XEN platform pci Wu, Bob
@ 2016-04-11 14:24 ` Konrad Rzeszutek Wilk
       [not found]   ` <6EB2BCCF7D344449A7542128268C26FF047FD490@MX105CL02.corp.emc.com>
  0 siblings, 1 reply; 12+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-04-11 14:24 UTC (permalink / raw)
  To: Wu, Bob; +Cc: xen-devel

On Fri, Apr 08, 2016 at 08:52:08AM +0000, Wu, Bob wrote:
> 
> Sorry bother, I read the XEN source code recently, and found the XEN platform PCI code under drivers/xen/platform-pci.c,
> and I can't fully under this driver's affect, can anybody explain a little for me?
> 
> Is the platform PCI driver for PV-split-PCI-driver-model such as the pci-frontend/pci-backend? or for PCI pass-through model? Or for other purpose?
> I saw the xenbus_pcifront_driver/ xenbus_xen_pcibk_driver are registered on XENBUS, so I guess the platform-PCI-driver is not for PV PCI driver.
> 

It is for the QEMU driver. To tell QEMU to stop emulating the IDE/network.

> Really thank you for your replay.
> 
> Thanks,
> Bob
> 

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


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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Question about the XEN platform pci
       [not found]   ` <6EB2BCCF7D344449A7542128268C26FF047FD490@MX105CL02.corp.emc.com>
@ 2016-04-12 14:09     ` Konrad Rzeszutek Wilk
  2016-04-12 15:33       ` karim.allah.ahmed
  0 siblings, 1 reply; 12+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-04-12 14:09 UTC (permalink / raw)
  To: Wu, Bob, xen-devel

On Tue, Apr 12, 2016 at 02:19:48AM +0000, Wu, Bob wrote:
> 
> Really thanks for your reply.

Hey!

CC-ing Xen-devel back on. Please do not drop it and please don't
top-post.
> 
> Can you explain a little more?

I am not sure what you want me to explain. Perhaps if you
read http://xenbits.xen.org/docs/unstable/misc/hvm-emulated-unplug.html
it may become clearer?

> Is the xen platform pci driver the only purpose for telling QEMU  that don’t emulate the IDE driver?

And network.
> I think it can be done by a simple way, but don't need use this huge platform driver.

?
> 
> I guess this is for PCI pass through in XEN HVM mode, but don't sure.

No. 
> 
> Thanks,
> Bob
> 
> 
> -----Original Message-----
> From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com] 
> Sent: 2016年4月11日 22:24
> To: Wu, Bob
> Cc: xen-devel@lists.xen.org
> Subject: Re: [Xen-devel] Question about the XEN platform pci
> 
> On Fri, Apr 08, 2016 at 08:52:08AM +0000, Wu, Bob wrote:
> > 
> > Sorry bother, I read the XEN source code recently, and found the XEN 
> > platform PCI code under drivers/xen/platform-pci.c, and I can't fully under this driver's affect, can anybody explain a little for me?
> > 
> > Is the platform PCI driver for PV-split-PCI-driver-model such as the pci-frontend/pci-backend? or for PCI pass-through model? Or for other purpose?
> > I saw the xenbus_pcifront_driver/ xenbus_xen_pcibk_driver are registered on XENBUS, so I guess the platform-PCI-driver is not for PV PCI driver.
> > 
> 
> It is for the QEMU driver. To tell QEMU to stop emulating the IDE/network.
> 
> > Really thank you for your replay.
> > 
> > Thanks,
> > Bob
> > 
> 
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xen.org
> > http://lists.xen.org/xen-devel
> 

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Question about the XEN platform pci
  2016-04-12 14:09     ` Konrad Rzeszutek Wilk
@ 2016-04-12 15:33       ` karim.allah.ahmed
  2016-04-12 15:45         ` Konrad Rzeszutek Wilk
                           ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: karim.allah.ahmed @ 2016-04-12 15:33 UTC (permalink / raw)
  To: Wu, Bob; +Cc: xen-devel

The INTx interrupt of this platform device can be used by Xen in HVM case to
notify the guest of pending events in the event channel. However that's usually
not used in favor of vector callbacks support in Xen where a vector is injected
directly to the vCPU bypassing LAPIC.

(that said, the platform-pci driver in linux is actually broken when vector
callbacks are not used anyway)

I also think that the grant-table lives on this PCI device MMIO BAR (?!)

If you looked at hw/i386/xen/xen_platform.c in QEMU source , you will get a
general idea what this device is supposed todo (like logging to syslog stuff
for example).

That said the platform device is really not fully utilized anyway in Linux.

On Tue, Apr 12, 2016 at 4:09 PM, Konrad Rzeszutek Wilk
<konrad.wilk@oracle.com> wrote:
> On Tue, Apr 12, 2016 at 02:19:48AM +0000, Wu, Bob wrote:
>>
>> Really thanks for your reply.
>
> Hey!
>
> CC-ing Xen-devel back on. Please do not drop it and please don't
> top-post.
>>
>> Can you explain a little more?
>
> I am not sure what you want me to explain. Perhaps if you
> read http://xenbits.xen.org/docs/unstable/misc/hvm-emulated-unplug.html
> it may become clearer?
>
>> Is the xen platform pci driver the only purpose for telling QEMU  that don’t emulate the IDE driver?
>
> And network.
>> I think it can be done by a simple way, but don't need use this huge platform driver.
>
> ?
>>
>> I guess this is for PCI pass through in XEN HVM mode, but don't sure.
>
> No.
>>
>> Thanks,
>> Bob
>>
>>
>> -----Original Message-----
>> From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com]
>> Sent: 2016年4月11日 22:24
>> To: Wu, Bob
>> Cc: xen-devel@lists.xen.org
>> Subject: Re: [Xen-devel] Question about the XEN platform pci
>>
>> On Fri, Apr 08, 2016 at 08:52:08AM +0000, Wu, Bob wrote:
>> >
>> > Sorry bother, I read the XEN source code recently, and found the XEN
>> > platform PCI code under drivers/xen/platform-pci.c, and I can't fully under this driver's affect, can anybody explain a little for me?
>> >
>> > Is the platform PCI driver for PV-split-PCI-driver-model such as the pci-frontend/pci-backend? or for PCI pass-through model? Or for other purpose?
>> > I saw the xenbus_pcifront_driver/ xenbus_xen_pcibk_driver are registered on XENBUS, so I guess the platform-PCI-driver is not for PV PCI driver.
>> >
>>
>> It is for the QEMU driver. To tell QEMU to stop emulating the IDE/network.
>>
>> > Really thank you for your replay.
>> >
>> > Thanks,
>> > Bob
>> >
>>
>> > _______________________________________________
>> > Xen-devel mailing list
>> > Xen-devel@lists.xen.org
>> > http://lists.xen.org/xen-devel
>>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel



-- 
Karim Allah Ahmed.

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Question about the XEN platform pci
  2016-04-12 15:33       ` karim.allah.ahmed
@ 2016-04-12 15:45         ` Konrad Rzeszutek Wilk
  2016-04-13  7:00           ` karim.allah.ahmed
  2016-04-12 16:05         ` Roger Pau Monné
  2016-04-13  3:59         ` Wu, Bob
  2 siblings, 1 reply; 12+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-04-12 15:45 UTC (permalink / raw)
  To: karim.allah.ahmed; +Cc: xen-devel, Wu, Bob

On Tue, Apr 12, 2016 at 05:33:47PM +0200, karim.allah.ahmed@gmail.com wrote:
> The INTx interrupt of this platform device can be used by Xen in HVM case to
> notify the guest of pending events in the event channel. However that's usually
> not used in favor of vector callbacks support in Xen where a vector is injected
> directly to the vCPU bypassing LAPIC.
> 
> (that said, the platform-pci driver in linux is actually broken when vector
> callbacks are not used anyway)

Oh? Is there an report/bug somewhere?

Thanks!
> 
> I also think that the grant-table lives on this PCI device MMIO BAR (?!)

The area may be usurped for grant-table as the OS won't touch that memory
area (it after all belongs to the device).
> 
> If you looked at hw/i386/xen/xen_platform.c in QEMU source , you will get a
> general idea what this device is supposed todo (like logging to syslog stuff
> for example).
> 
> That said the platform device is really not fully utilized anyway in Linux.
> 
> On Tue, Apr 12, 2016 at 4:09 PM, Konrad Rzeszutek Wilk
> <konrad.wilk@oracle.com> wrote:
> > On Tue, Apr 12, 2016 at 02:19:48AM +0000, Wu, Bob wrote:
> >>
> >> Really thanks for your reply.
> >
> > Hey!
> >
> > CC-ing Xen-devel back on. Please do not drop it and please don't
> > top-post.
> >>
> >> Can you explain a little more?
> >
> > I am not sure what you want me to explain. Perhaps if you
> > read http://xenbits.xen.org/docs/unstable/misc/hvm-emulated-unplug.html
> > it may become clearer?
> >
> >> Is the xen platform pci driver the only purpose for telling QEMU  that don’t emulate the IDE driver?
> >
> > And network.
> >> I think it can be done by a simple way, but don't need use this huge platform driver.
> >
> > ?
> >>
> >> I guess this is for PCI pass through in XEN HVM mode, but don't sure.
> >
> > No.
> >>
> >> Thanks,
> >> Bob
> >>
> >>
> >> -----Original Message-----
> >> From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com]
> >> Sent: 2016年4月11日 22:24
> >> To: Wu, Bob
> >> Cc: xen-devel@lists.xen.org
> >> Subject: Re: [Xen-devel] Question about the XEN platform pci
> >>
> >> On Fri, Apr 08, 2016 at 08:52:08AM +0000, Wu, Bob wrote:
> >> >
> >> > Sorry bother, I read the XEN source code recently, and found the XEN
> >> > platform PCI code under drivers/xen/platform-pci.c, and I can't fully under this driver's affect, can anybody explain a little for me?
> >> >
> >> > Is the platform PCI driver for PV-split-PCI-driver-model such as the pci-frontend/pci-backend? or for PCI pass-through model? Or for other purpose?
> >> > I saw the xenbus_pcifront_driver/ xenbus_xen_pcibk_driver are registered on XENBUS, so I guess the platform-PCI-driver is not for PV PCI driver.
> >> >
> >>
> >> It is for the QEMU driver. To tell QEMU to stop emulating the IDE/network.
> >>
> >> > Really thank you for your replay.
> >> >
> >> > Thanks,
> >> > Bob
> >> >
> >>
> >> > _______________________________________________
> >> > Xen-devel mailing list
> >> > Xen-devel@lists.xen.org
> >> > http://lists.xen.org/xen-devel
> >>
> >
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xen.org
> > http://lists.xen.org/xen-devel
> 
> 
> 
> -- 
> Karim Allah Ahmed.

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Question about the XEN platform pci
  2016-04-12 15:33       ` karim.allah.ahmed
  2016-04-12 15:45         ` Konrad Rzeszutek Wilk
@ 2016-04-12 16:05         ` Roger Pau Monné
  2016-04-13  3:59         ` Wu, Bob
  2 siblings, 0 replies; 12+ messages in thread
From: Roger Pau Monné @ 2016-04-12 16:05 UTC (permalink / raw)
  To: karim.allah.ahmed; +Cc: xen-devel, Wu, Bob

Please don't top post.

On Tue, Apr 12, 2016 at 05:33:47PM +0200, karim.allah.ahmed@gmail.com wrote:
> The INTx interrupt of this platform device can be used by Xen in HVM case to
> notify the guest of pending events in the event channel. However that's usually
> not used in favor of vector callbacks support in Xen where a vector is injected
> directly to the vCPU bypassing LAPIC.
> 
> (that said, the platform-pci driver in linux is actually broken when vector
> callbacks are not used anyway)
> 
> I also think that the grant-table lives on this PCI device MMIO BAR (?!)

Not really, grant table can live anywhere, but it's usually placed there 
because the OS knows there's nothing in this MMIO region.
 
Roger.

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Question about the XEN platform pci
  2016-04-12 15:33       ` karim.allah.ahmed
  2016-04-12 15:45         ` Konrad Rzeszutek Wilk
  2016-04-12 16:05         ` Roger Pau Monné
@ 2016-04-13  3:59         ` Wu, Bob
  2 siblings, 0 replies; 12+ messages in thread
From: Wu, Bob @ 2016-04-13  3:59 UTC (permalink / raw)
  To: karim.allah.ahmed; +Cc: xen-devel


Subject: Re: [Xen-devel] Question about the XEN platform pci

The INTx interrupt of this platform device can be used by Xen in HVM case to notify the guest of pending events in the event channel. However that's usually not used in favor of vector callbacks support in Xen where a vector is injected directly to the vCPU bypassing LAPIC.

(that said, the platform-pci driver in linux is actually broken when vector callbacks are not used anyway)

I also think that the grant-table lives on this PCI device MMIO BAR (?!)

If you looked at hw/i386/xen/xen_platform.c in QEMU source , you will get a general idea what this device is supposed todo (like logging to syslog stuff for example).

That said the platform device is really not fully utilized anyway in Linux.


Yes, the answer is my expected, so the biggest reason of platform PCI still existing in the kernel code is that INTx interrupt or vector callback will need the help of it.
Thanks Karim.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Question about the XEN platform pci
  2016-04-12 15:45         ` Konrad Rzeszutek Wilk
@ 2016-04-13  7:00           ` karim.allah.ahmed
  2016-04-13  7:28             ` Wu, Bob
  2016-04-13  9:55             ` Konrad Rzeszutek Wilk
  0 siblings, 2 replies; 12+ messages in thread
From: karim.allah.ahmed @ 2016-04-13  7:00 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: xen-devel, Wu, Bob

On Tue, Apr 12, 2016 at 5:45 PM, Konrad Rzeszutek Wilk
<konrad.wilk@oracle.com> wrote:
> On Tue, Apr 12, 2016 at 05:33:47PM +0200, karim.allah.ahmed@gmail.com wrote:
>> The INTx interrupt of this platform device can be used by Xen in HVM case to
>> notify the guest of pending events in the event channel. However that's usually
>> not used in favor of vector callbacks support in Xen where a vector is injected
>> directly to the vCPU bypassing LAPIC.
>>
>> (that said, the platform-pci driver in linux is actually broken when vector
>> callbacks are not used anyway)
>
> Oh? Is there an report/bug somewhere?
>

I'm not sure if it's reported as a bug somewhere or not.

I've always assumed that INTx is deperecated and vector callbacks are the one
that's supported that's why I never tried to fix it, in addition I never tried
to reproduce it I just looked at the code and it seemed a little bit off as
explained below.

Mainly xenbus_init is called during postcore_initcall which will eventually try
to read a value from XenStore and will get stuck on read_reply at xenbus
forever since the platform driver is not probed yet and its INTx interrupt
handler is not registered yet which basically means that the guest can not be
notified at this moment of any pending event channels and none of the per-event
handlers will ever be invoked (including the XenStore one) and the reply will
never be picked up by the kernel.

The exact stack where things get stuck during xenbus_init:

-xenbus_init
 -xs_init
  -xs_reset_watches
   -xenbus_scanf
    -xenbus_read
     -xs_single
      -xs_single
       -xs_talkv

> Thanks!
>>
>> I also think that the grant-table lives on this PCI device MMIO BAR (?!)
>
> The area may be usurped for grant-table as the OS won't touch that memory
> area (it after all belongs to the device).
>>
>> If you looked at hw/i386/xen/xen_platform.c in QEMU source , you will get a
>> general idea what this device is supposed todo (like logging to syslog stuff
>> for example).
>>
>> That said the platform device is really not fully utilized anyway in Linux.
>>
>> On Tue, Apr 12, 2016 at 4:09 PM, Konrad Rzeszutek Wilk
>> <konrad.wilk@oracle.com> wrote:
>> > On Tue, Apr 12, 2016 at 02:19:48AM +0000, Wu, Bob wrote:
>> >>
>> >> Really thanks for your reply.
>> >
>> > Hey!
>> >
>> > CC-ing Xen-devel back on. Please do not drop it and please don't
>> > top-post.
>> >>
>> >> Can you explain a little more?
>> >
>> > I am not sure what you want me to explain. Perhaps if you
>> > read http://xenbits.xen.org/docs/unstable/misc/hvm-emulated-unplug.html
>> > it may become clearer?
>> >
>> >> Is the xen platform pci driver the only purpose for telling QEMU  that don’t emulate the IDE driver?
>> >
>> > And network.
>> >> I think it can be done by a simple way, but don't need use this huge platform driver.
>> >
>> > ?
>> >>
>> >> I guess this is for PCI pass through in XEN HVM mode, but don't sure.
>> >
>> > No.
>> >>
>> >> Thanks,
>> >> Bob
>> >>
>> >>
>> >> -----Original Message-----
>> >> From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com]
>> >> Sent: 2016年4月11日 22:24
>> >> To: Wu, Bob
>> >> Cc: xen-devel@lists.xen.org
>> >> Subject: Re: [Xen-devel] Question about the XEN platform pci
>> >>
>> >> On Fri, Apr 08, 2016 at 08:52:08AM +0000, Wu, Bob wrote:
>> >> >
>> >> > Sorry bother, I read the XEN source code recently, and found the XEN
>> >> > platform PCI code under drivers/xen/platform-pci.c, and I can't fully under this driver's affect, can anybody explain a little for me?
>> >> >
>> >> > Is the platform PCI driver for PV-split-PCI-driver-model such as the pci-frontend/pci-backend? or for PCI pass-through model? Or for other purpose?
>> >> > I saw the xenbus_pcifront_driver/ xenbus_xen_pcibk_driver are registered on XENBUS, so I guess the platform-PCI-driver is not for PV PCI driver.
>> >> >
>> >>
>> >> It is for the QEMU driver. To tell QEMU to stop emulating the IDE/network.
>> >>
>> >> > Really thank you for your replay.
>> >> >
>> >> > Thanks,
>> >> > Bob
>> >> >
>> >>
>> >> > _______________________________________________
>> >> > Xen-devel mailing list
>> >> > Xen-devel@lists.xen.org
>> >> > http://lists.xen.org/xen-devel
>> >>
>> >
>> > _______________________________________________
>> > Xen-devel mailing list
>> > Xen-devel@lists.xen.org
>> > http://lists.xen.org/xen-devel
>>
>>
>>
>> --
>> Karim Allah Ahmed.



-- 
Karim Allah Ahmed.

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Question about the XEN platform pci
  2016-04-13  7:00           ` karim.allah.ahmed
@ 2016-04-13  7:28             ` Wu, Bob
  2016-04-13  8:31               ` karim.allah.ahmed
  2016-04-13  9:55             ` Konrad Rzeszutek Wilk
  1 sibling, 1 reply; 12+ messages in thread
From: Wu, Bob @ 2016-04-13  7:28 UTC (permalink / raw)
  To: karim.allah.ahmed, Konrad Rzeszutek Wilk; +Cc: xen-devel


From: karim.allah.ahmed@gmail.com [mailto:karim.allah.ahmed@gmail.com] 
Sent: 2016年4月13日 15:00
To: Konrad Rzeszutek Wilk
Cc: Wu, Bob; xen-devel@lists.xenproject.org
Subject: Re: [Xen-devel] Question about the XEN platform pci

On Tue, Apr 12, 2016 at 5:45 PM, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
> On Tue, Apr 12, 2016 at 05:33:47PM +0200, karim.allah.ahmed@gmail.com wrote:
>> The INTx interrupt of this platform device can be used by Xen in HVM 
>> case to notify the guest of pending events in the event channel. 
>> However that's usually not used in favor of vector callbacks support 
>> in Xen where a vector is injected directly to the vCPU bypassing LAPIC.
>>
>> (that said, the platform-pci driver in linux is actually broken when 
>> vector callbacks are not used anyway)
>
> Oh? Is there an report/bug somewhere?
>

I'm not sure if it's reported as a bug somewhere or not.

I've always assumed that INTx is deperecated and vector callbacks are the one that's supported that's why I never tried to fix it, in addition I never tried to reproduce it I just looked at the code and it seemed a little bit off as explained below.

Mainly xenbus_init is called during postcore_initcall which will eventually try to read a value from XenStore and will get stuck on read_reply at xenbus forever since the platform driver is not probed yet and its INTx interrupt handler is not registered yet which basically means that the guest can not be notified at this moment of any pending event channels and none of the per-event handlers will ever be invoked (including the XenStore one) and the reply will never be picked up by the kernel.

The exact stack where things get stuck during xenbus_init:

-xenbus_init
 -xs_init
  -xs_reset_watches
   -xenbus_scanf
    -xenbus_read
     -xs_single
      -xs_single
       -xs_talkv

> Thanks!
>>
>> I also think that the grant-table lives on this PCI device MMIO BAR 
>> (?!)
>
> The area may be usurped for grant-table as the OS won't touch that 
> memory area (it after all belongs to the device).
>>
>> If you looked at hw/i386/xen/xen_platform.c in QEMU source , you will 
>> get a general idea what this device is supposed todo (like logging to 
>> syslog stuff for example).
>>
>> >>
>> >> -----Original Message-----
>> >> From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com]
>> >> Sent: 2016年4月11日 22:24
>> >> To: Wu, Bob
>> >> Cc: xen-devel@lists.xen.org
>> >> Subject: Re: [Xen-devel] Question about the XEN platform pci
>> >>
>> >> On Fri, Apr 08, 2016 at 08:52:08AM +0000, Wu, Bob wrote:
>> >> >
>> >> > Sorry bother, I read the XEN source code recently, and found the 
>> >> > XEN platform PCI code under drivers/xen/platform-pci.c, and I can't fully under this driver's affect, can anybody explain a little for me?
>> >> >
>> >> > Is the platform PCI driver for PV-split-PCI-driver-model such as the pci-frontend/pci-backend? or for PCI pass-through model? Or for other purpose?
>> >> > I saw the xenbus_pcifront_driver/ xenbus_xen_pcibk_driver are registered on XENBUS, so I guess the platform-PCI-driver is not for PV PCI driver.
>> >> >
>> >>
>> >> It is for the QEMU driver. To tell QEMU to stop emulating the IDE/network.
>> >>
>> >> > Really thank you for your replay.
>> >> >
>> >> > Thanks,
>> >> > Bob
>> >> >

Hi, Karim,

I still have one more question, can you share your understanding?
The PCI platform driver just register a pci driver on pci bus, but when the real device attaching occur?
I mean who trigger the real device attach behavior? The QEMU or others? I there any piece of code can indicate it?

Thanks,
Bob
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Question about the XEN platform pci
  2016-04-13  7:28             ` Wu, Bob
@ 2016-04-13  8:31               ` karim.allah.ahmed
  0 siblings, 0 replies; 12+ messages in thread
From: karim.allah.ahmed @ 2016-04-13  8:31 UTC (permalink / raw)
  To: Wu, Bob; +Cc: xen-devel

On Wed, Apr 13, 2016 at 9:28 AM, Wu, Bob <Bob.Wu@emc.com> wrote:
>
> From: karim.allah.ahmed@gmail.com [mailto:karim.allah.ahmed@gmail.com]
> Sent: 2016年4月13日 15:00
> To: Konrad Rzeszutek Wilk
> Cc: Wu, Bob; xen-devel@lists.xenproject.org
> Subject: Re: [Xen-devel] Question about the XEN platform pci
>
> On Tue, Apr 12, 2016 at 5:45 PM, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
>> On Tue, Apr 12, 2016 at 05:33:47PM +0200, karim.allah.ahmed@gmail.com wrote:
>>> The INTx interrupt of this platform device can be used by Xen in HVM
>>> case to notify the guest of pending events in the event channel.
>>> However that's usually not used in favor of vector callbacks support
>>> in Xen where a vector is injected directly to the vCPU bypassing LAPIC.
>>>
>>> (that said, the platform-pci driver in linux is actually broken when
>>> vector callbacks are not used anyway)
>>
>> Oh? Is there an report/bug somewhere?
>>
>
> I'm not sure if it's reported as a bug somewhere or not.
>
> I've always assumed that INTx is deperecated and vector callbacks are the one that's supported that's why I never tried to fix it, in addition I never tried to reproduce it I just looked at the code and it seemed a little bit off as explained below.
>
> Mainly xenbus_init is called during postcore_initcall which will eventually try to read a value from XenStore and will get stuck on read_reply at xenbus forever since the platform driver is not probed yet and its INTx interrupt handler is not registered yet which basically means that the guest can not be notified at this moment of any pending event channels and none of the per-event handlers will ever be invoked (including the XenStore one) and the reply will never be picked up by the kernel.
>
> The exact stack where things get stuck during xenbus_init:
>
> -xenbus_init
>  -xs_init
>   -xs_reset_watches
>    -xenbus_scanf
>     -xenbus_read
>      -xs_single
>       -xs_single
>        -xs_talkv
>
>> Thanks!
>>>
>>> I also think that the grant-table lives on this PCI device MMIO BAR
>>> (?!)
>>
>> The area may be usurped for grant-table as the OS won't touch that
>> memory area (it after all belongs to the device).
>>>
>>> If you looked at hw/i386/xen/xen_platform.c in QEMU source , you will
>>> get a general idea what this device is supposed todo (like logging to
>>> syslog stuff for example).
>>>
>>> >>
>>> >> -----Original Message-----
>>> >> From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com]
>>> >> Sent: 2016年4月11日 22:24
>>> >> To: Wu, Bob
>>> >> Cc: xen-devel@lists.xen.org
>>> >> Subject: Re: [Xen-devel] Question about the XEN platform pci
>>> >>
>>> >> On Fri, Apr 08, 2016 at 08:52:08AM +0000, Wu, Bob wrote:
>>> >> >
>>> >> > Sorry bother, I read the XEN source code recently, and found the
>>> >> > XEN platform PCI code under drivers/xen/platform-pci.c, and I can't fully under this driver's affect, can anybody explain a little for me?
>>> >> >
>>> >> > Is the platform PCI driver for PV-split-PCI-driver-model such as the pci-frontend/pci-backend? or for PCI pass-through model? Or for other purpose?
>>> >> > I saw the xenbus_pcifront_driver/ xenbus_xen_pcibk_driver are registered on XENBUS, so I guess the platform-PCI-driver is not for PV PCI driver.
>>> >> >
>>> >>
>>> >> It is for the QEMU driver. To tell QEMU to stop emulating the IDE/network.
>>> >>
>>> >> > Really thank you for your replay.
>>> >> >
>>> >> > Thanks,
>>> >> > Bob
>>> >> >
>
> Hi, Karim,
>
> I still have one more question, can you share your understanding?
> The PCI platform driver just register a pci driver on pci bus, but when the real device attaching occur?
> I mean who trigger the real device attach behavior? The QEMU or others? I there any piece of code can indicate it?

This Xen PCI device is a normal PCI device that's emulated by QEMU
and the kernel will just find it while scanning the PCI bus during the
boot process so the driver will just get probed at some point during
boot = It's not hot-plugged.

(Information about PCI devices can be guessed from scanning the
 host bridge or through ACPI tables)

>
> Thanks,
> Bob



-- 
Karim Allah Ahmed.

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Question about the XEN platform pci
  2016-04-13  7:00           ` karim.allah.ahmed
  2016-04-13  7:28             ` Wu, Bob
@ 2016-04-13  9:55             ` Konrad Rzeszutek Wilk
  2016-04-15  5:47               ` karim.allah.ahmed
  1 sibling, 1 reply; 12+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-04-13  9:55 UTC (permalink / raw)
  To: karim.allah.ahmed; +Cc: xen-devel, Wu, Bob

On Wed, Apr 13, 2016 at 09:00:18AM +0200, karim.allah.ahmed@gmail.com wrote:
> On Tue, Apr 12, 2016 at 5:45 PM, Konrad Rzeszutek Wilk
> <konrad.wilk@oracle.com> wrote:
> > On Tue, Apr 12, 2016 at 05:33:47PM +0200, karim.allah.ahmed@gmail.com wrote:
> >> The INTx interrupt of this platform device can be used by Xen in HVM case to
> >> notify the guest of pending events in the event channel. However that's usually
> >> not used in favor of vector callbacks support in Xen where a vector is injected
> >> directly to the vCPU bypassing LAPIC.
> >>
> >> (that said, the platform-pci driver in linux is actually broken when vector
> >> callbacks are not used anyway)
> >
> > Oh? Is there an report/bug somewhere?
> >
> 
> I'm not sure if it's reported as a bug somewhere or not.
> 
> I've always assumed that INTx is deperecated and vector callbacks are the one
> that's supported that's why I never tried to fix it, in addition I never tried
> to reproduce it I just looked at the code and it seemed a little bit off as
> explained below.
> 
> Mainly xenbus_init is called during postcore_initcall which will eventually try
> to read a value from XenStore and will get stuck on read_reply at xenbus
> forever since the platform driver is not probed yet and its INTx interrupt
> handler is not registered yet which basically means that the guest can not be
> notified at this moment of any pending event channels and none of the per-event
> handlers will ever be invoked (including the XenStore one) and the reply will
> never be picked up by the kernel.

Argh, well that is not good. Also - thanks for reporting this.

No simple ideas come to my mind on how this can be fixed - unless we
move the xenbus_init and its driver past the platform-pci init?

Or if platform-pci init code ends up being called earlier?

> 
> The exact stack where things get stuck during xenbus_init:
> 
> -xenbus_init
>  -xs_init
>   -xs_reset_watches
>    -xenbus_scanf
>     -xenbus_read
>      -xs_single
>       -xs_single
>        -xs_talkv
> 
> > Thanks!
> >>
> >> I also think that the grant-table lives on this PCI device MMIO BAR (?!)
> >
> > The area may be usurped for grant-table as the OS won't touch that memory
> > area (it after all belongs to the device).
> >>
> >> If you looked at hw/i386/xen/xen_platform.c in QEMU source , you will get a
> >> general idea what this device is supposed todo (like logging to syslog stuff
> >> for example).
> >>
> >> That said the platform device is really not fully utilized anyway in Linux.
> >>
> >> On Tue, Apr 12, 2016 at 4:09 PM, Konrad Rzeszutek Wilk
> >> <konrad.wilk@oracle.com> wrote:
> >> > On Tue, Apr 12, 2016 at 02:19:48AM +0000, Wu, Bob wrote:
> >> >>
> >> >> Really thanks for your reply.
> >> >
> >> > Hey!
> >> >
> >> > CC-ing Xen-devel back on. Please do not drop it and please don't
> >> > top-post.
> >> >>
> >> >> Can you explain a little more?
> >> >
> >> > I am not sure what you want me to explain. Perhaps if you
> >> > read http://xenbits.xen.org/docs/unstable/misc/hvm-emulated-unplug.html
> >> > it may become clearer?
> >> >
> >> >> Is the xen platform pci driver the only purpose for telling QEMU  that don’t emulate the IDE driver?
> >> >
> >> > And network.
> >> >> I think it can be done by a simple way, but don't need use this huge platform driver.
> >> >
> >> > ?
> >> >>
> >> >> I guess this is for PCI pass through in XEN HVM mode, but don't sure.
> >> >
> >> > No.
> >> >>
> >> >> Thanks,
> >> >> Bob
> >> >>
> >> >>
> >> >> -----Original Message-----
> >> >> From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com]
> >> >> Sent: 2016年4月11日 22:24
> >> >> To: Wu, Bob
> >> >> Cc: xen-devel@lists.xen.org
> >> >> Subject: Re: [Xen-devel] Question about the XEN platform pci
> >> >>
> >> >> On Fri, Apr 08, 2016 at 08:52:08AM +0000, Wu, Bob wrote:
> >> >> >
> >> >> > Sorry bother, I read the XEN source code recently, and found the XEN
> >> >> > platform PCI code under drivers/xen/platform-pci.c, and I can't fully under this driver's affect, can anybody explain a little for me?
> >> >> >
> >> >> > Is the platform PCI driver for PV-split-PCI-driver-model such as the pci-frontend/pci-backend? or for PCI pass-through model? Or for other purpose?
> >> >> > I saw the xenbus_pcifront_driver/ xenbus_xen_pcibk_driver are registered on XENBUS, so I guess the platform-PCI-driver is not for PV PCI driver.
> >> >> >
> >> >>
> >> >> It is for the QEMU driver. To tell QEMU to stop emulating the IDE/network.
> >> >>
> >> >> > Really thank you for your replay.
> >> >> >
> >> >> > Thanks,
> >> >> > Bob
> >> >> >
> >> >>
> >> >> > _______________________________________________
> >> >> > Xen-devel mailing list
> >> >> > Xen-devel@lists.xen.org
> >> >> > http://lists.xen.org/xen-devel
> >> >>
> >> >
> >> > _______________________________________________
> >> > Xen-devel mailing list
> >> > Xen-devel@lists.xen.org
> >> > http://lists.xen.org/xen-devel
> >>
> >>
> >>
> >> --
> >> Karim Allah Ahmed.
> 
> 
> 
> -- 
> Karim Allah Ahmed.

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Question about the XEN platform pci
  2016-04-13  9:55             ` Konrad Rzeszutek Wilk
@ 2016-04-15  5:47               ` karim.allah.ahmed
  0 siblings, 0 replies; 12+ messages in thread
From: karim.allah.ahmed @ 2016-04-15  5:47 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: xen-devel, Wu, Bob

On Wed, Apr 13, 2016 at 11:55 AM, Konrad Rzeszutek Wilk
<konrad.wilk@oracle.com> wrote:
> On Wed, Apr 13, 2016 at 09:00:18AM +0200, karim.allah.ahmed@gmail.com wrote:
>> On Tue, Apr 12, 2016 at 5:45 PM, Konrad Rzeszutek Wilk
>> <konrad.wilk@oracle.com> wrote:
>> > On Tue, Apr 12, 2016 at 05:33:47PM +0200, karim.allah.ahmed@gmail.com wrote:
>> >> The INTx interrupt of this platform device can be used by Xen in HVM case to
>> >> notify the guest of pending events in the event channel. However that's usually
>> >> not used in favor of vector callbacks support in Xen where a vector is injected
>> >> directly to the vCPU bypassing LAPIC.
>> >>
>> >> (that said, the platform-pci driver in linux is actually broken when vector
>> >> callbacks are not used anyway)
>> >
>> > Oh? Is there an report/bug somewhere?
>> >
>>
>> I'm not sure if it's reported as a bug somewhere or not.
>>
>> I've always assumed that INTx is deperecated and vector callbacks are the one
>> that's supported that's why I never tried to fix it, in addition I never tried
>> to reproduce it I just looked at the code and it seemed a little bit off as
>> explained below.
>>
>> Mainly xenbus_init is called during postcore_initcall which will eventually try
>> to read a value from XenStore and will get stuck on read_reply at xenbus
>> forever since the platform driver is not probed yet and its INTx interrupt
>> handler is not registered yet which basically means that the guest can not be
>> notified at this moment of any pending event channels and none of the per-event
>> handlers will ever be invoked (including the XenStore one) and the reply will
>> never be picked up by the kernel.
>
> Argh, well that is not good. Also - thanks for reporting this.
>
> No simple ideas come to my mind on how this can be fixed - unless we
> move the xenbus_init and its driver past the platform-pci init?
>
> Or if platform-pci init code ends up being called earlier?
>

Let me test a few alternatives and send a patch to fix that first.

>>
>> The exact stack where things get stuck during xenbus_init:
>>
>> -xenbus_init
>>  -xs_init
>>   -xs_reset_watches
>>    -xenbus_scanf
>>     -xenbus_read
>>      -xs_single
>>       -xs_single
>>        -xs_talkv
>>
>> > Thanks!
>> >>
>> >> I also think that the grant-table lives on this PCI device MMIO BAR (?!)
>> >
>> > The area may be usurped for grant-table as the OS won't touch that memory
>> > area (it after all belongs to the device).
>> >>
>> >> If you looked at hw/i386/xen/xen_platform.c in QEMU source , you will get a
>> >> general idea what this device is supposed todo (like logging to syslog stuff
>> >> for example).
>> >>
>> >> That said the platform device is really not fully utilized anyway in Linux.
>> >>
>> >> On Tue, Apr 12, 2016 at 4:09 PM, Konrad Rzeszutek Wilk
>> >> <konrad.wilk@oracle.com> wrote:
>> >> > On Tue, Apr 12, 2016 at 02:19:48AM +0000, Wu, Bob wrote:
>> >> >>
>> >> >> Really thanks for your reply.
>> >> >
>> >> > Hey!
>> >> >
>> >> > CC-ing Xen-devel back on. Please do not drop it and please don't
>> >> > top-post.
>> >> >>
>> >> >> Can you explain a little more?
>> >> >
>> >> > I am not sure what you want me to explain. Perhaps if you
>> >> > read http://xenbits.xen.org/docs/unstable/misc/hvm-emulated-unplug.html
>> >> > it may become clearer?
>> >> >
>> >> >> Is the xen platform pci driver the only purpose for telling QEMU  that don’t emulate the IDE driver?
>> >> >
>> >> > And network.
>> >> >> I think it can be done by a simple way, but don't need use this huge platform driver.
>> >> >
>> >> > ?
>> >> >>
>> >> >> I guess this is for PCI pass through in XEN HVM mode, but don't sure.
>> >> >
>> >> > No.
>> >> >>
>> >> >> Thanks,
>> >> >> Bob
>> >> >>
>> >> >>
>> >> >> -----Original Message-----
>> >> >> From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com]
>> >> >> Sent: 2016年4月11日 22:24
>> >> >> To: Wu, Bob
>> >> >> Cc: xen-devel@lists.xen.org
>> >> >> Subject: Re: [Xen-devel] Question about the XEN platform pci
>> >> >>
>> >> >> On Fri, Apr 08, 2016 at 08:52:08AM +0000, Wu, Bob wrote:
>> >> >> >
>> >> >> > Sorry bother, I read the XEN source code recently, and found the XEN
>> >> >> > platform PCI code under drivers/xen/platform-pci.c, and I can't fully under this driver's affect, can anybody explain a little for me?
>> >> >> >
>> >> >> > Is the platform PCI driver for PV-split-PCI-driver-model such as the pci-frontend/pci-backend? or for PCI pass-through model? Or for other purpose?
>> >> >> > I saw the xenbus_pcifront_driver/ xenbus_xen_pcibk_driver are registered on XENBUS, so I guess the platform-PCI-driver is not for PV PCI driver.
>> >> >> >
>> >> >>
>> >> >> It is for the QEMU driver. To tell QEMU to stop emulating the IDE/network.
>> >> >>
>> >> >> > Really thank you for your replay.
>> >> >> >
>> >> >> > Thanks,
>> >> >> > Bob
>> >> >> >
>> >> >>
>> >> >> > _______________________________________________
>> >> >> > Xen-devel mailing list
>> >> >> > Xen-devel@lists.xen.org
>> >> >> > http://lists.xen.org/xen-devel
>> >> >>
>> >> >
>> >> > _______________________________________________
>> >> > Xen-devel mailing list
>> >> > Xen-devel@lists.xen.org
>> >> > http://lists.xen.org/xen-devel
>> >>
>> >>
>> >>
>> >> --
>> >> Karim Allah Ahmed.
>>
>>
>>
>> --
>> Karim Allah Ahmed.



-- 
Karim Allah Ahmed.

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-04-15  5:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-08  8:52 Question about the XEN platform pci Wu, Bob
2016-04-11 14:24 ` Konrad Rzeszutek Wilk
     [not found]   ` <6EB2BCCF7D344449A7542128268C26FF047FD490@MX105CL02.corp.emc.com>
2016-04-12 14:09     ` Konrad Rzeszutek Wilk
2016-04-12 15:33       ` karim.allah.ahmed
2016-04-12 15:45         ` Konrad Rzeszutek Wilk
2016-04-13  7:00           ` karim.allah.ahmed
2016-04-13  7:28             ` Wu, Bob
2016-04-13  8:31               ` karim.allah.ahmed
2016-04-13  9:55             ` Konrad Rzeszutek Wilk
2016-04-15  5:47               ` karim.allah.ahmed
2016-04-12 16:05         ` Roger Pau Monné
2016-04-13  3:59         ` Wu, Bob

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).