Re: [PATCH][RFC] Use return value from kvm_set_irq() to re-inject PIT interrupts.

2009-08-26 Thread Marcelo Tosatti
On Mon, Aug 24, 2009 at 09:19:05PM +0300, Gleb Natapov wrote: Current code very fragile and relies on hacks to work. Lets take calling of ack notifiers on pic reset as an example. Why is it needed? To signal the ack notifiers users that, in case of reset with pending IRR, the given

Re: [PATCH][RFC] Use return value from kvm_set_irq() to re-inject PIT interrupts.

2009-08-26 Thread Marcelo Tosatti
On Mon, Aug 24, 2009 at 10:01:50PM +0300, Gleb Natapov wrote: On Mon, Aug 24, 2009 at 09:19:05PM +0300, Gleb Natapov wrote: It is obviously wrong thing to do from assigned devices POV. Thats not entirely clear to me. So what happens if a guest with PIC assigned device resets with a

Re: [PATCH][RFC] Use return value from kvm_set_irq() to re-inject PIT interrupts.

2009-08-26 Thread Gleb Natapov
On Wed, Aug 26, 2009 at 09:43:48AM -0300, Marcelo Tosatti wrote: On Mon, Aug 24, 2009 at 09:19:05PM +0300, Gleb Natapov wrote: Current code very fragile and relies on hacks to work. Lets take calling of ack notifiers on pic reset as an example. Why is it needed? To signal the ack

Re: [PATCH][RFC] Use return value from kvm_set_irq() to re-inject PIT interrupts.

2009-08-26 Thread Marcelo Tosatti
On Wed, Aug 26, 2009 at 04:19:17PM +0300, Gleb Natapov wrote: On Wed, Aug 26, 2009 at 09:43:48AM -0300, Marcelo Tosatti wrote: On Mon, Aug 24, 2009 at 09:19:05PM +0300, Gleb Natapov wrote: Current code very fragile and relies on hacks to work. Lets take calling of ack notifiers

Re: [PATCH][RFC] Use return value from kvm_set_irq() to re-inject PIT interrupts.

2009-08-26 Thread Avi Kivity
On 08/26/2009 04:38 PM, Marcelo Tosatti wrote: An injectable timer interrupt is defined by: - time(now)= time(next_expiration) - Previous timer interrupt has been acked (thus we can inject). The thing is, sure you can drop ack notifiers and check IRR on every guest entry, but why bother if

Re: [PATCH][RFC] Use return value from kvm_set_irq() to re-inject PIT interrupts.

2009-08-26 Thread Marcelo Tosatti
On Wed, Aug 26, 2009 at 04:19:17PM +0300, Gleb Natapov wrote: On Wed, Aug 26, 2009 at 09:43:48AM -0300, Marcelo Tosatti wrote: On Mon, Aug 24, 2009 at 09:19:05PM +0300, Gleb Natapov wrote: Current code very fragile and relies on hacks to work. Lets take calling of ack notifiers

Re: [PATCH][RFC] Use return value from kvm_set_irq() to re-inject PIT interrupts.

2009-08-26 Thread Gleb Natapov
On Wed, Aug 26, 2009 at 10:38:42AM -0300, Marcelo Tosatti wrote: If you don't have a host timer emulating the guest PIT, to periodically bang on kvm_set_irq, how do you know when to attempt reinjection? You keep calling kvm_set_irq on every guest entry to figure out when

[PATCH][RFC] Use return value from kvm_set_irq() to re-inject PIT interrupts.

2009-08-24 Thread Gleb Natapov
Use return value from kvm_set_irq() to track coalesced PIT interrupts instead of ack/mask notifiers. Signed-off-by: Gleb Natapov g...@redhat.com diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index b857ca3..0b63991 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c @@ -231,20

Re: [PATCH][RFC] Use return value from kvm_set_irq() to re-inject PIT interrupts.

2009-08-24 Thread Marcelo Tosatti
On Mon, Aug 24, 2009 at 03:06:23PM +0300, Gleb Natapov wrote: Use return value from kvm_set_irq() to track coalesced PIT interrupts instead of ack/mask notifiers. Gleb, What is the advantage of doing so? Ack notifiers are asynchronous notifications. Using the return value from kvm_set_irq

Re: [PATCH][RFC] Use return value from kvm_set_irq() to re-inject PIT interrupts.

2009-08-24 Thread Gleb Natapov
On Mon, Aug 24, 2009 at 01:32:56PM -0300, Marcelo Tosatti wrote: On Mon, Aug 24, 2009 at 03:06:23PM +0300, Gleb Natapov wrote: Use return value from kvm_set_irq() to track coalesced PIT interrupts instead of ack/mask notifiers. Gleb, What is the advantage of doing so? Current code

Re: [PATCH][RFC] Use return value from kvm_set_irq() to re-inject PIT interrupts.

2009-08-24 Thread Marcelo Tosatti
On Mon, Aug 24, 2009 at 08:16:46PM +0300, Gleb Natapov wrote: On Mon, Aug 24, 2009 at 01:32:56PM -0300, Marcelo Tosatti wrote: On Mon, Aug 24, 2009 at 03:06:23PM +0300, Gleb Natapov wrote: Use return value from kvm_set_irq() to track coalesced PIT interrupts instead of ack/mask notifiers.

Re: [PATCH][RFC] Use return value from kvm_set_irq() to re-inject PIT interrupts.

2009-08-24 Thread Gleb Natapov
On Mon, Aug 24, 2009 at 02:44:27PM -0300, Marcelo Tosatti wrote: On Mon, Aug 24, 2009 at 08:16:46PM +0300, Gleb Natapov wrote: On Mon, Aug 24, 2009 at 01:32:56PM -0300, Marcelo Tosatti wrote: On Mon, Aug 24, 2009 at 03:06:23PM +0300, Gleb Natapov wrote: Use return value from

Re: [PATCH][RFC] Use return value from kvm_set_irq() to re-inject PIT interrupts.

2009-08-24 Thread Gleb Natapov
On Mon, Aug 24, 2009 at 09:19:05PM +0300, Gleb Natapov wrote: It is obviously wrong thing to do from assigned devices POV. Thats not entirely clear to me. So what happens if a guest with PIC assigned device resets with a pending IRR? The host interrupt line will be kept disabled, even