Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-25 Thread Pavel Machek
Hi! I guess this will also allow UIO to work without _any_ kernel parts, with only slight performance penalty in 'almost-never-happens' deadlock case? (Greg, details are below, and better description is in the lkml thread). Pavel > > - Our

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-25 Thread Pavel Machek
Hi! I guess this will also allow UIO to work without _any_ kernel parts, with only slight performance penalty in 'almost-never-happens' deadlock case? (Greg, details are below, and better description is in the lkml thread). Pavel - Our

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-19 Thread Lennart Sorensen
On Thu, Jul 19, 2007 at 04:38:09PM +0300, Avi Kivity wrote: > Looking at two random servers here and a desktop, interrupts are > unshared except for usb. A laptop was not so lucky. So "no chance" is > a bit extreme. > > I agree it's far from optimal, but it is less limited than you imply.

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-19 Thread Avi Kivity
Lennart Sorensen wrote: On Thu, Jul 19, 2007 at 12:23:24PM +0300, Avi Kivity wrote: No, it means disallowing pci devices that use shared irqs, and allowing pci devices that use non-shared irqs. Most machiens I see today have almost no chance of having PCI devices without shared IRQs.

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-19 Thread Lennart Sorensen
On Thu, Jul 19, 2007 at 12:23:24PM +0300, Avi Kivity wrote: > No, it means disallowing pci devices that use shared irqs, and allowing > pci devices that use non-shared irqs. Most machiens I see today have almost no chance of having PCI devices without shared IRQs. This probably means any

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-19 Thread Avi Kivity
Lennart Sorensen wrote: On Wed, Jul 18, 2007 at 07:46:13PM +0300, Avi Kivity wrote: IMO the only reasonable solution is to disallow interrupt forwarding with shared irqs. If someone later comes up with a bright idea, we can implement it. Otherwise the problem will solve itself with

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-19 Thread Avi Kivity
Lennart Sorensen wrote: On Wed, Jul 18, 2007 at 07:46:13PM +0300, Avi Kivity wrote: IMO the only reasonable solution is to disallow interrupt forwarding with shared irqs. If someone later comes up with a bright idea, we can implement it. Otherwise the problem will solve itself with

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-19 Thread Lennart Sorensen
On Thu, Jul 19, 2007 at 12:23:24PM +0300, Avi Kivity wrote: No, it means disallowing pci devices that use shared irqs, and allowing pci devices that use non-shared irqs. Most machiens I see today have almost no chance of having PCI devices without shared IRQs. This probably means any

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-19 Thread Avi Kivity
Lennart Sorensen wrote: On Thu, Jul 19, 2007 at 12:23:24PM +0300, Avi Kivity wrote: No, it means disallowing pci devices that use shared irqs, and allowing pci devices that use non-shared irqs. Most machiens I see today have almost no chance of having PCI devices without shared IRQs.

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-19 Thread Lennart Sorensen
On Thu, Jul 19, 2007 at 04:38:09PM +0300, Avi Kivity wrote: Looking at two random servers here and a desktop, interrupts are unshared except for usb. A laptop was not so lucky. So no chance is a bit extreme. I agree it's far from optimal, but it is less limited than you imply. Well with

Re: [RFC] Deferred interrupt handling.

2007-07-18 Thread Peter Chubb
The problem you're having is essentially the same as the user-level interrupt handler problem I've been dealing with for ages. The basic rule is: don't share interrupts between devices on the host and devices in the guest. But you *can* share interrupts between devices in a single guest. If

RE: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Or Sagi
> Hope it should work like the following [Please correct me if I'm > wrong]: > - Make the device the last irqaction in the list > - Our dummy handler will always return IRQ_HANDLED in case any other > previous > irqaction did not return such. It will also issue the timer and mask > the irq in

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Alan Cox
> - Make the device the last irqaction in the list > - Our dummy handler will always return IRQ_HANDLED in case any other > previous > irqaction did not return such. It will also issue the timer and mask > the irq in this case. Ok > btw, if I'm not mistaken only after bad 99900/10 the

RE: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Dor Laor
>> >> Guest0 - blocked on I/O >> >> >> >> IRQ14 from your hardware >> >> Block IRQ14 >> >> Sent to guest (guest is blocked) >> >> >> >> IRQ14 from hard disk >> >> Ignored (as blocked) >> >> >> >> >> But now the timer will pop and the hard disk will get

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Lennart Sorensen
On Wed, Jul 18, 2007 at 07:46:13PM +0300, Avi Kivity wrote: > IMO the only reasonable solution is to disallow interrupt forwarding > with shared irqs. If someone later comes up with a bright idea, we can > implement it. Otherwise the problem will solve itself with hardware > moving to msi.

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Alan Cox
> >>Guest0 - blocked on I/O > >> > >>IRQ14 from your hardware > >>Block IRQ14 > >>Sent to guest (guest is blocked) > >> > >>IRQ14 from hard disk > >>Ignored (as blocked) > >> > > > But now the timer will pop and the hard disk will get its

RE: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Dor Laor
>Alan Cox wrote: >>> What if we will force the specific device to the end of the list. >Once >>> IRQ_NONE was returned by the other devices, we will mask the irq, >>> forward the irq to the guest, issue a timer for 1msec. Motivation: >>> 1msec is long enough for the guest to ack the irq + host

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Alan Cox
> Hotplug is user-controllable, so if the user refrains from adding pci > devices after assigning a device to the guest, it should work. I think > that USB interrupts are assigned to the controller, not the device, so > USB hotplug can be ruled out. Cardbus is more problematic. Alan - To

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Avi Kivity
Alan Cox wrote: >> IMO the only reasonable solution is to disallow interrupt forwarding >> with shared irqs. If someone later comes up with a bright idea, we can >> > > Which means you are back to ISA bus devices. Even checking if an IRQ is > currently unshared isn't simple as with hotplug

RE: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Dor Laor
>> In particular, this requires interrupt handling to be done by the >guest -- >> The host shouldn't load the corresponding device driver or otherwise >access >> the device. Since the host kernel is not aware of the device semantics >it >> cannot acknowledge the interrupt at the device level. >

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Alan Cox
> IMO the only reasonable solution is to disallow interrupt forwarding > with shared irqs. If someone later comes up with a bright idea, we can Which means you are back to ISA bus devices. Even checking if an IRQ is currently unshared isn't simple as with hotplug this may change. > implement

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Avi Kivity
Alan Cox wrote: >> What if we will force the specific device to the end of the list. Once >> IRQ_NONE was returned by the other devices, we will mask the irq, >> forward the irq to the guest, issue a timer for 1msec. Motivation: >> 1msec is long enough for the guest to ack the irq + host unmask

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Alan Cox
> What if we will force the specific device to the end of the list. Once > IRQ_NONE was returned by the other devices, we will mask the irq, > forward the irq to the guest, issue a timer for 1msec. Motivation: > 1msec is long enough for the guest to ack the irq + host unmask the irq It makes no

Re: [RFC] Deferred interrupt handling.

2007-07-18 Thread Lennart Sorensen
On Wed, Jul 18, 2007 at 12:53:19PM +0300, Or Sagi wrote: > Gentlepeople, > > We're currently working on PCI device pass-through support for KVM. In this > model all physical hardware access to specific devices will be performed by > the VM, and not by the host. > > In particular, this requires

Re: [RFC] Deferred interrupt handling.

2007-07-18 Thread Alan Cox
> In particular, this requires interrupt handling to be done by the guest -- > The host shouldn't load the corresponding device driver or otherwise access > the device. Since the host kernel is not aware of the device semantics it > cannot acknowledge the interrupt at the device level. Tricky

[RFC] Deferred interrupt handling.

2007-07-18 Thread Or Sagi
Gentlepeople, We're currently working on PCI device pass-through support for KVM. In this model all physical hardware access to specific devices will be performed by the VM, and not by the host. In particular, this requires interrupt handling to be done by the guest -- The host shouldn't load

[RFC] Deferred interrupt handling.

2007-07-18 Thread Or Sagi
Gentlepeople, We're currently working on PCI device pass-through support for KVM. In this model all physical hardware access to specific devices will be performed by the VM, and not by the host. In particular, this requires interrupt handling to be done by the guest -- The host shouldn't load

Re: [RFC] Deferred interrupt handling.

2007-07-18 Thread Alan Cox
In particular, this requires interrupt handling to be done by the guest -- The host shouldn't load the corresponding device driver or otherwise access the device. Since the host kernel is not aware of the device semantics it cannot acknowledge the interrupt at the device level. Tricky indeed.

Re: [RFC] Deferred interrupt handling.

2007-07-18 Thread Lennart Sorensen
On Wed, Jul 18, 2007 at 12:53:19PM +0300, Or Sagi wrote: Gentlepeople, We're currently working on PCI device pass-through support for KVM. In this model all physical hardware access to specific devices will be performed by the VM, and not by the host. In particular, this requires

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Alan Cox
What if we will force the specific device to the end of the list. Once IRQ_NONE was returned by the other devices, we will mask the irq, forward the irq to the guest, issue a timer for 1msec. Motivation: 1msec is long enough for the guest to ack the irq + host unmask the irq It makes no

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Avi Kivity
Alan Cox wrote: What if we will force the specific device to the end of the list. Once IRQ_NONE was returned by the other devices, we will mask the irq, forward the irq to the guest, issue a timer for 1msec. Motivation: 1msec is long enough for the guest to ack the irq + host unmask the irq

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Alan Cox
IMO the only reasonable solution is to disallow interrupt forwarding with shared irqs. If someone later comes up with a bright idea, we can Which means you are back to ISA bus devices. Even checking if an IRQ is currently unshared isn't simple as with hotplug this may change. implement it.

RE: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Dor Laor
In particular, this requires interrupt handling to be done by the guest -- The host shouldn't load the corresponding device driver or otherwise access the device. Since the host kernel is not aware of the device semantics it cannot acknowledge the interrupt at the device level. Tricky indeed.

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Avi Kivity
Alan Cox wrote: IMO the only reasonable solution is to disallow interrupt forwarding with shared irqs. If someone later comes up with a bright idea, we can Which means you are back to ISA bus devices. Even checking if an IRQ is currently unshared isn't simple as with hotplug this may

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Alan Cox
Hotplug is user-controllable, so if the user refrains from adding pci devices after assigning a device to the guest, it should work. I think that USB interrupts are assigned to the controller, not the device, so USB hotplug can be ruled out. Cardbus is more problematic. Alan - To

RE: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Dor Laor
Alan Cox wrote: What if we will force the specific device to the end of the list. Once IRQ_NONE was returned by the other devices, we will mask the irq, forward the irq to the guest, issue a timer for 1msec. Motivation: 1msec is long enough for the guest to ack the irq + host unmask the irq

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Alan Cox
Guest0 - blocked on I/O IRQ14 from your hardware Block IRQ14 Sent to guest (guest is blocked) IRQ14 from hard disk Ignored (as blocked) But now the timer will pop and the hard disk will get its irq. The guest will be released

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Lennart Sorensen
On Wed, Jul 18, 2007 at 07:46:13PM +0300, Avi Kivity wrote: IMO the only reasonable solution is to disallow interrupt forwarding with shared irqs. If someone later comes up with a bright idea, we can implement it. Otherwise the problem will solve itself with hardware moving to msi.

RE: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Dor Laor
Guest0 - blocked on I/O IRQ14 from your hardware Block IRQ14 Sent to guest (guest is blocked) IRQ14 from hard disk Ignored (as blocked) But now the timer will pop and the hard disk will get its irq. The guest will be released right

Re: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Alan Cox
- Make the device the last irqaction in the list - Our dummy handler will always return IRQ_HANDLED in case any other previous irqaction did not return such. It will also issue the timer and mask the irq in this case. Ok btw, if I'm not mistaken only after bad 99900/10 the irq is

RE: [kvm-devel] [RFC] Deferred interrupt handling.

2007-07-18 Thread Or Sagi
Hope it should work like the following [Please correct me if I'm wrong]: - Make the device the last irqaction in the list - Our dummy handler will always return IRQ_HANDLED in case any other previous irqaction did not return such. It will also issue the timer and mask the irq in this

Re: [RFC] Deferred interrupt handling.

2007-07-18 Thread Peter Chubb
The problem you're having is essentially the same as the user-level interrupt handler problem I've been dealing with for ages. The basic rule is: don't share interrupts between devices on the host and devices in the guest. But you *can* share interrupts between devices in a single guest. If