Re: [PATCH] msi-x: let drivers retry when not enough vectors

2009-05-07 Thread Michael Ellerman
On Fri, 2009-05-08 at 09:25 +0930, Rusty Russell wrote: > On Thu, 7 May 2009 07:49:53 pm Sheng Yang wrote: > > On Thursday 07 May 2009 17:53:02 Matthew Wilcox wrote: > > > Here's a good example. Let's suppose you have a driver which supports > > > two different models of cards, one has 16 MSI-X in

Re: [PATCH] msi-x: let drivers retry when not enough vectors

2009-05-07 Thread Rusty Russell
On Thu, 7 May 2009 07:49:53 pm Sheng Yang wrote: > On Thursday 07 May 2009 17:53:02 Matthew Wilcox wrote: > > Here's a good example. Let's suppose you have a driver which supports > > two different models of cards, one has 16 MSI-X interrupts, the other > > has 10. You can call pci_enable_msix()

Re: [Xen-devel] [patch xen.git xen-tip/master] xen: fix xenbus frontend build

2009-05-07 Thread M A Young
On Tue, 5 May 2009, Randy Dunlap wrote: > From: Randy Dunlap > > When a driver kconfig symbol =m and it selects another symbol, > that other symbol will also be =m (unless something else > causes it to be =y), so when XEN_BLKDEV_FRONTEND=m and/or > XEN_NETDEV_FRONTEND=m, then XEN_XENBUS_FRONTEND=

Re: [PATCH] msi-x: let drivers retry when not enough vectors

2009-05-07 Thread Michael Ellerman
On Thu, 2009-05-07 at 03:53 -0600, Matthew Wilcox wrote: > On Thu, May 07, 2009 at 05:40:15PM +0800, Sheng Yang wrote: > > It's indeed weird. Why the semantic of pci_enable_msix can be changed to > > "enable msix, or tell me how many vector do you have"? You can simply call > > pci_msix_table_siz

[PATCH 3/3] virtio_pci: optional MSI-X support

2009-05-07 Thread Michael S. Tsirkin
This implements optional MSI-X support in virtio_pci. MSI-X is used whenever the host supports at least 2 MSI-X vectors: 1 for configuration changes and 1 for virtqueues. Per-virtqueue vectors are allocated if enough vectors available. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_

[PATCH 2/3] virtio_pci: split up vp_interrupt

2009-05-07 Thread Michael S. Tsirkin
This reorganizes virtio-pci code in vp_interrupt slightly, so that it's easier to add per-vq MSI support on top. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 45 +- 1 files changed, 35 insertions(+), 10 deletions(-) diff --git a/d

[PATCH 1/3] virtio: find_vqs/del_vqs virtio operations

2009-05-07 Thread Michael S. Tsirkin
This replaces find_vq/del_vq with find_vqs/del_vqs virtio operations, and updates all drivers. This is needed for MSI support, because MSI needs to know the total number of vectors upfront. Signed-off-by: Michael S. Tsirkin --- drivers/block/virtio_blk.c | 11 +++--- drivers/char/hw_r

[PATCHv2 0/3] virtio: add guest MSI-X support

2009-05-07 Thread Michael S. Tsirkin
Add optional MSI-X support: use a vector per virtqueue with fallback to a common vector and finally to regular interrupt. Teach all drivers to use it. Signed-off-by: Michael S. Tsirkin --- Here's a draft set of patches for MSI-X support in the guest. It still needs to be tested properly, and p

Re: [PATCH] msi-x: let drivers retry when not enough vectors

2009-05-07 Thread Matthew Wilcox
On Thu, May 07, 2009 at 01:44:38PM +0300, Avi Kivity wrote: > I imagine this loop is present in many drivers. So why not add a helper Let's look! arch/x86/kernel/amd_iommu_init.c : Needs an exact number of vectors. drivers/block/cciss.c : If it doesn't get all 4 vectors, falls back to pin mode

Re: [PATCH] msi-x: let drivers retry when not enough vectors

2009-05-07 Thread Avi Kivity
Michael Ellerman wrote: > Not to mention that there's no guarantee that you'll get as many > interrupts as the device supports, so you should really be coding to > cope with that anyway. Like the example in MSI-HOWTO.txt: > > 197 static int foo_driver_enable_msix(struct foo_adapter *adapter, int nv

Re: [PATCH] msi-x: let drivers retry when not enough vectors

2009-05-07 Thread Michael S. Tsirkin
On Thu, May 07, 2009 at 06:19:53PM +0800, Sheng Yang wrote: > On Thursday 07 May 2009 17:53:02 Matthew Wilcox wrote: > > On Thu, May 07, 2009 at 05:40:15PM +0800, Sheng Yang wrote: > > > It's indeed weird. Why the semantic of pci_enable_msix can be changed to > > > "enable msix, or tell me how many

Re: [PATCH] msi-x: let drivers retry when not enough vectors

2009-05-07 Thread Sheng Yang
On Thursday 07 May 2009 18:23:50 Michael Ellerman wrote: > On Thu, 2009-05-07 at 03:53 -0600, Matthew Wilcox wrote: > > On Thu, May 07, 2009 at 05:40:15PM +0800, Sheng Yang wrote: > > > It's indeed weird. Why the semantic of pci_enable_msix can be changed > > > to "enable msix, or tell me how many

Re: [PATCH] msi-x: let drivers retry when not enough vectors

2009-05-07 Thread Sheng Yang
On Thursday 07 May 2009 17:53:02 Matthew Wilcox wrote: > On Thu, May 07, 2009 at 05:40:15PM +0800, Sheng Yang wrote: > > It's indeed weird. Why the semantic of pci_enable_msix can be changed to > > "enable msix, or tell me how many vector do you have"? You can simply > > call pci_msix_table_size()

Re: [PATCH] msi-x: let drivers retry when not enough vectors

2009-05-07 Thread Matthew Wilcox
On Thu, May 07, 2009 at 05:40:15PM +0800, Sheng Yang wrote: > It's indeed weird. Why the semantic of pci_enable_msix can be changed to > "enable msix, or tell me how many vector do you have"? You can simply call > pci_msix_table_size() to get what you want, also without any more work, no? I > ca

Re: [PATCH] msi-x: let drivers retry when not enough vectors

2009-05-07 Thread Sheng Yang
On Thursday 07 May 2009 17:27:31 Matthew Wilcox wrote: > On Thu, May 07, 2009 at 04:51:24PM +0800, Sheng Yang wrote: > > On Thursday 07 May 2009 16:28:41 Michael S. Tsirkin wrote: > > > pci_enable_msix currently returns -EINVAL if you ask > > > for more vectors than supported by the device, which w

Re: [PATCH] msi-x: let drivers retry when not enough vectors

2009-05-07 Thread Michael S. Tsirkin
On Thu, May 07, 2009 at 05:10:46PM +0800, Sheng Yang wrote: > > > I think driver should read from capability list to know how many vector > > > supported by this device before enable MSI-X for device, as > > > pci_msix_table_size() did... > > > > Drivers can do this, but it's more code. Since pci_e

Re: [PATCH] msi-x: let drivers retry when not enough vectors

2009-05-07 Thread Matthew Wilcox
On Thu, May 07, 2009 at 04:51:24PM +0800, Sheng Yang wrote: > On Thursday 07 May 2009 16:28:41 Michael S. Tsirkin wrote: > > pci_enable_msix currently returns -EINVAL if you ask > > for more vectors than supported by the device, which would > > typically cause fallback to regular interrupts. > > >

Re: [PATCH] msi-x: let drivers retry when not enough vectors

2009-05-07 Thread Sheng Yang
On Thursday 07 May 2009 17:05:06 Michael S. Tsirkin wrote: > On Thu, May 07, 2009 at 04:51:24PM +0800, Sheng Yang wrote: > > On Thursday 07 May 2009 16:28:41 Michael S. Tsirkin wrote: > > > pci_enable_msix currently returns -EINVAL if you ask > > > for more vectors than supported by the device, whi

Re: [PATCH] msi-x: let drivers retry when not enough vectors

2009-05-07 Thread Michael S. Tsirkin
On Thu, May 07, 2009 at 04:51:24PM +0800, Sheng Yang wrote: > On Thursday 07 May 2009 16:28:41 Michael S. Tsirkin wrote: > > pci_enable_msix currently returns -EINVAL if you ask > > for more vectors than supported by the device, which would > > typically cause fallback to regular interrupts. > > >

Re: [PATCH] msi-x: let drivers retry when not enough vectors

2009-05-07 Thread Sheng Yang
On Thursday 07 May 2009 16:28:41 Michael S. Tsirkin wrote: > pci_enable_msix currently returns -EINVAL if you ask > for more vectors than supported by the device, which would > typically cause fallback to regular interrupts. > > It's better to return the table size, making the driver retry > MSI-X

[PATCH] msi-x: let drivers retry when not enough vectors

2009-05-07 Thread Michael S. Tsirkin
pci_enable_msix currently returns -EINVAL if you ask for more vectors than supported by the device, which would typically cause fallback to regular interrupts. It's better to return the table size, making the driver retry MSI-X with less vectors. Signed-off-by: Michael S. Tsirkin --- Hi Jesse,