Re: [PATCH] kvm: fix race with level interrupts

2012-07-19 Thread Michael S. Tsirkin
On Thu, Jul 19, 2012 at 06:11:15AM -0600, Alex Williamson wrote: > On Thu, 2012-07-19 at 12:07 +0300, Michael S. Tsirkin wrote: > > On Wed, Jul 18, 2012 at 05:20:40PM -0600, Alex Williamson wrote: > > > On Thu, 2012-07-19 at 01:49 +0300, Michael S. Tsirkin wrote: > > > > On Wed, Jul 18, 2012 at 04:

Re: [PATCH] kvm: fix race with level interrupts

2012-07-19 Thread Alex Williamson
On Thu, 2012-07-19 at 12:07 +0300, Michael S. Tsirkin wrote: > On Wed, Jul 18, 2012 at 05:20:40PM -0600, Alex Williamson wrote: > > On Thu, 2012-07-19 at 01:49 +0300, Michael S. Tsirkin wrote: > > > On Wed, Jul 18, 2012 at 04:26:41PM -0600, Alex Williamson wrote: > > > > On Thu, 2012-07-19 at 00:52

Re: [PATCH] kvm: fix race with level interrupts

2012-07-19 Thread Michael S. Tsirkin
On Thu, Jul 19, 2012 at 06:06:31AM -0600, Alex Williamson wrote: > On Thu, 2012-07-19 at 12:15 +0300, Michael S. Tsirkin wrote: > > On Wed, Jul 18, 2012 at 05:22:42PM -0600, Alex Williamson wrote: > > > I hate reviewing code > > > > > where I have to differentiate 'l' vs '1'. > > > > > > > > l is

Re: [PATCH] kvm: fix race with level interrupts

2012-07-19 Thread Alex Williamson
On Thu, 2012-07-19 at 12:15 +0300, Michael S. Tsirkin wrote: > On Wed, Jul 18, 2012 at 05:22:42PM -0600, Alex Williamson wrote: > > I hate reviewing code > > > > where I have to differentiate 'l' vs '1'. > > > > > > l is an illegal variable name? Switch to a different font. > > > > WTF > > Real

Re: [PATCH] kvm: fix race with level interrupts

2012-07-19 Thread Michael S. Tsirkin
On Wed, Jul 18, 2012 at 05:22:42PM -0600, Alex Williamson wrote: > I hate reviewing code > > > where I have to differentiate 'l' vs '1'. > > > > l is an illegal variable name? Switch to a different font. > > WTF Really, you should use a font where these differ. I currently use Monospace but the

Re: [PATCH] kvm: fix race with level interrupts

2012-07-19 Thread Michael S. Tsirkin
On Wed, Jul 18, 2012 at 05:20:40PM -0600, Alex Williamson wrote: > On Thu, 2012-07-19 at 01:49 +0300, Michael S. Tsirkin wrote: > > On Wed, Jul 18, 2012 at 04:26:41PM -0600, Alex Williamson wrote: > > > On Thu, 2012-07-19 at 00:52 +0300, Michael S. Tsirkin wrote: > > > > When more than 1 source id

Re: [PATCH] kvm: fix race with level interrupts

2012-07-19 Thread Gleb Natapov
On Thu, Jul 19, 2012 at 01:44:59AM +0300, Michael S. Tsirkin wrote: > On Wed, Jul 18, 2012 at 04:16:14PM -0600, Alex Williamson wrote: > > On Thu, 2012-07-19 at 00:52 +0300, Michael S. Tsirkin wrote: > > > When more than 1 source id is in use for the same GSI, we have the > > > following race relat

Re: [PATCH] kvm: fix race with level interrupts

2012-07-19 Thread Gleb Natapov
On Wed, Jul 18, 2012 at 05:20:40PM -0600, Alex Williamson wrote: > On Thu, 2012-07-19 at 01:49 +0300, Michael S. Tsirkin wrote: > > On Wed, Jul 18, 2012 at 04:26:41PM -0600, Alex Williamson wrote: > > > On Thu, 2012-07-19 at 00:52 +0300, Michael S. Tsirkin wrote: > > > > When more than 1 source id

Re: [PATCH] kvm: fix race with level interrupts

2012-07-18 Thread Alex Williamson
On Thu, 2012-07-19 at 01:44 +0300, Michael S. Tsirkin wrote: > On Wed, Jul 18, 2012 at 04:16:14PM -0600, Alex Williamson wrote: > > On Thu, 2012-07-19 at 00:52 +0300, Michael S. Tsirkin wrote: > > > When more than 1 source id is in use for the same GSI, we have the > > > following race related to h

Re: [PATCH] kvm: fix race with level interrupts

2012-07-18 Thread Alex Williamson
On Thu, 2012-07-19 at 01:49 +0300, Michael S. Tsirkin wrote: > On Wed, Jul 18, 2012 at 04:26:41PM -0600, Alex Williamson wrote: > > On Thu, 2012-07-19 at 00:52 +0300, Michael S. Tsirkin wrote: > > > When more than 1 source id is in use for the same GSI, we have the > > > following race related to h

Re: [PATCH] kvm: fix race with level interrupts

2012-07-18 Thread Michael S. Tsirkin
On Wed, Jul 18, 2012 at 04:26:41PM -0600, Alex Williamson wrote: > On Thu, 2012-07-19 at 00:52 +0300, Michael S. Tsirkin wrote: > > When more than 1 source id is in use for the same GSI, we have the > > following race related to handling irq_states: > > > > CPU 0 clears bit in irq_states. CPU 0 re

Re: [PATCH] kvm: fix race with level interrupts

2012-07-18 Thread Michael S. Tsirkin
On Wed, Jul 18, 2012 at 04:16:14PM -0600, Alex Williamson wrote: > On Thu, 2012-07-19 at 00:52 +0300, Michael S. Tsirkin wrote: > > When more than 1 source id is in use for the same GSI, we have the > > following race related to handling irq_states: > > > > CPU 0 clears bit in irq_states. CPU 0 re

Re: [PATCH] kvm: fix race with level interrupts

2012-07-18 Thread Alex Williamson
On Thu, 2012-07-19 at 00:52 +0300, Michael S. Tsirkin wrote: > When more than 1 source id is in use for the same GSI, we have the > following race related to handling irq_states: > > CPU 0 clears bit in irq_states. CPU 0 reads irq_state as 0. > CPU 1 sets bit in irq_states. CPU 1 calls kvm_ioapic

Re: [PATCH] kvm: fix race with level interrupts

2012-07-18 Thread Alex Williamson
On Thu, 2012-07-19 at 00:52 +0300, Michael S. Tsirkin wrote: > When more than 1 source id is in use for the same GSI, we have the > following race related to handling irq_states: > > CPU 0 clears bit in irq_states. CPU 0 reads irq_state as 0. > CPU 1 sets bit in irq_states. CPU 1 calls kvm_ioapic

[PATCH] kvm: fix race with level interrupts

2012-07-18 Thread Michael S. Tsirkin
When more than 1 source id is in use for the same GSI, we have the following race related to handling irq_states: CPU 0 clears bit in irq_states. CPU 0 reads irq_state as 0. CPU 1 sets bit in irq_states. CPU 1 calls kvm_ioapic_set_irq(1). CPU 0 calls kvm_ioapic_set_irq(0). Now ioapic thinks the