Re: [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-12-13 Thread Avi Kivity
On 12/12/2010 01:22 PM, Jan Kiszka wrote: From: Jan Kiszkajan.kis...@siemens.com PCI 2.3 allows to generically disable IRQ sources at device level. This enables us to share IRQs of such devices on the host side when passing them to a guest. However, IRQ disabling via the PCI config space is

[PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-12-12 Thread Jan Kiszka
From: Jan Kiszka jan.kis...@siemens.com PCI 2.3 allows to generically disable IRQ sources at device level. This enables us to share IRQs of such devices on the host side when passing them to a guest. However, IRQ disabling via the PCI config space is more costly than masking the line via

[PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-11-02 Thread Jan Kiszka
PCI 2.3 allows to generically disable IRQ sources at device level. This enables us to share IRQs of such devices between on the host side when passing them to a guest. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- include/linux/kvm_host.h |1 + virt/kvm/assigned-dev.c | 194

Re: [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-11-02 Thread Michael S. Tsirkin
On Tue, Nov 02, 2010 at 04:49:20PM +0100, Jan Kiszka wrote: PCI 2.3 allows to generically disable IRQ sources at device level. This enables us to share IRQs of such devices between on the host side when passing them to a guest. Signed-off-by: Jan Kiszka jan.kis...@siemens.com ---

Re: [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-11-02 Thread Jan Kiszka
Am 02.11.2010 18:41, Michael S. Tsirkin wrote: On Tue, Nov 02, 2010 at 04:49:20PM +0100, Jan Kiszka wrote: PCI 2.3 allows to generically disable IRQ sources at device level. This enables us to share IRQs of such devices between on the host side when passing them to a guest. Signed-off-by:

Re: [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-11-02 Thread Michael S. Tsirkin
On Tue, Nov 02, 2010 at 06:56:14PM +0100, Jan Kiszka wrote: @@ -99,12 +228,23 @@ static void kvm_assigned_dev_ack_irq(struct kvm_irq_ack_notifier *kian) /* The guest irq may be shared so this ack may be * from another device. */ - spin_lock(dev-intx_lock); +

Re: [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-11-02 Thread Jan Kiszka
Am 02.11.2010 19:24, Michael S. Tsirkin wrote: On Tue, Nov 02, 2010 at 06:56:14PM +0100, Jan Kiszka wrote: dev-host_irq_disabled = false; } - spin_unlock(dev-intx_lock); +out: + spin_unlock_irq(dev-intx_lock); + + if (reassert) + kvm_set_irq(dev-kvm,

Re: [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-11-02 Thread Jan Kiszka
Am 02.11.2010 19:40, Jan Kiszka wrote: @@ -199,6 +343,13 @@ static void kvm_free_assigned_device(struct kvm *kvm, pci_reset_function(assigned_dev-dev); + /* + * Unmask the IRQ at PCI level once the reset is done - the next user + * may not expect the IRQ being masked. + */ + if

Re: [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-11-02 Thread Jan Kiszka
Am 02.11.2010 19:48, Jan Kiszka wrote: Am 02.11.2010 19:40, Jan Kiszka wrote: @@ -199,6 +343,13 @@ static void kvm_free_assigned_device(struct kvm *kvm, pci_reset_function(assigned_dev-dev); +/* + * Unmask the IRQ at PCI level once the reset is done - the

Re: [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-11-02 Thread Michael S. Tsirkin
On Tue, Nov 02, 2010 at 07:40:46PM +0100, Jan Kiszka wrote: Am 02.11.2010 19:24, Michael S. Tsirkin wrote: On Tue, Nov 02, 2010 at 06:56:14PM +0100, Jan Kiszka wrote: dev-host_irq_disabled = false; } -spin_unlock(dev-intx_lock); +out: +

Re: [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-11-02 Thread Michael S. Tsirkin
On Tue, Nov 02, 2010 at 07:51:39PM +0100, Jan Kiszka wrote: Am 02.11.2010 19:48, Jan Kiszka wrote: Am 02.11.2010 19:40, Jan Kiszka wrote: @@ -199,6 +343,13 @@ static void kvm_free_assigned_device(struct kvm *kvm, pci_reset_function(assigned_dev-dev); + /* +

Re: [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-11-02 Thread Jan Kiszka
Am 02.11.2010 19:52, Michael S. Tsirkin wrote: On Tue, Nov 02, 2010 at 07:40:46PM +0100, Jan Kiszka wrote: Am 02.11.2010 19:24, Michael S. Tsirkin wrote: On Tue, Nov 02, 2010 at 06:56:14PM +0100, Jan Kiszka wrote: dev-host_irq_disabled = false; } -

Re: [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-11-02 Thread Michael S. Tsirkin
On Tue, Nov 02, 2010 at 08:11:31PM +0100, Jan Kiszka wrote: Am 02.11.2010 19:52, Michael S. Tsirkin wrote: On Tue, Nov 02, 2010 at 07:40:46PM +0100, Jan Kiszka wrote: Am 02.11.2010 19:24, Michael S. Tsirkin wrote: On Tue, Nov 02, 2010 at 06:56:14PM +0100, Jan Kiszka wrote:

Re: [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-11-02 Thread Jan Kiszka
Am 02.11.2010 19:54, Michael S. Tsirkin wrote: On Tue, Nov 02, 2010 at 07:51:39PM +0100, Jan Kiszka wrote: Am 02.11.2010 19:48, Jan Kiszka wrote: Am 02.11.2010 19:40, Jan Kiszka wrote: @@ -199,6 +343,13 @@ static void kvm_free_assigned_device(struct kvm *kvm,

Re: [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-11-02 Thread Alex Williamson
On Tue, 2010-11-02 at 19:40 +0100, Jan Kiszka wrote: Am 02.11.2010 19:24, Michael S. Tsirkin wrote: On Tue, Nov 02, 2010 at 06:56:14PM +0100, Jan Kiszka wrote: dev-host_irq_disabled = false; } -spin_unlock(dev-intx_lock); +out: +

Re: [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-11-02 Thread Michael S. Tsirkin
On Tue, Nov 02, 2010 at 08:30:25PM +0100, Jan Kiszka wrote: Am 02.11.2010 19:54, Michael S. Tsirkin wrote: On Tue, Nov 02, 2010 at 07:51:39PM +0100, Jan Kiszka wrote: Am 02.11.2010 19:48, Jan Kiszka wrote: Am 02.11.2010 19:40, Jan Kiszka wrote: @@ -199,6 +343,13 @@ static void

Re: [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-11-02 Thread Jan Kiszka
Am 02.11.2010 20:14, Michael S. Tsirkin wrote: BTW block userspace access uses a global spinlock which will likely hurt us on multi-CPU. Switching that to something more SMP friendly, e.g. a per-device spinlock, might be a good idea: I don't see why that lock and queue are global. Been

Re: [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-11-02 Thread Jan Kiszka
Am 02.11.2010 20:53, Michael S. Tsirkin wrote: On Tue, Nov 02, 2010 at 08:30:25PM +0100, Jan Kiszka wrote: Am 02.11.2010 19:54, Michael S. Tsirkin wrote: On Tue, Nov 02, 2010 at 07:51:39PM +0100, Jan Kiszka wrote: Am 02.11.2010 19:48, Jan Kiszka wrote: Am 02.11.2010 19:40, Jan Kiszka wrote:

Re: [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

2010-11-02 Thread Michael S. Tsirkin
On Tue, Nov 02, 2010 at 08:58:36PM +0100, Jan Kiszka wrote: Am 02.11.2010 20:53, Michael S. Tsirkin wrote: On Tue, Nov 02, 2010 at 08:30:25PM +0100, Jan Kiszka wrote: Am 02.11.2010 19:54, Michael S. Tsirkin wrote: On Tue, Nov 02, 2010 at 07:51:39PM +0100, Jan Kiszka wrote: Am 02.11.2010