Michael S. Tsirkin 1a577b7247 KVM: fix race with level interrupts
When more than 1 source id is in use for the same GSI, we have the
following race related to handling irq_states race:

CPU 0 clears bit 0. CPU 0 read irq_state as 0. CPU 1 sets level to 1.
CPU 1 calls kvm_ioapic_set_irq(1). CPU 0 calls kvm_ioapic_set_irq(0).
Now ioapic thinks the level is 0 but irq_state is not 0.

Fix by performing all irq_states bitmap handling under pic/ioapic lock.
This also removes the need for atomics with irq_states handling.

Reported-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2012-07-20 16:12:00 -03:00
..
2011-12-05 17:17:24 +01:00
2008-10-22 22:55:23 -07:00
2009-01-29 14:16:51 +01:00
2011-08-29 13:44:12 -07:00
2011-08-29 13:44:12 -07:00
2012-03-28 18:11:12 +01:00
2012-03-28 18:11:12 +01:00
2012-05-08 14:08:44 +02:00
2012-03-28 18:11:12 +01:00
2008-10-22 22:55:23 -07:00
2012-03-28 18:11:12 +01:00
2008-10-22 22:55:23 -07:00
2008-10-22 22:55:20 -07:00
2011-02-14 12:08:28 +01:00
2008-10-22 22:55:20 -07:00
2011-05-02 17:24:48 +02:00
2008-10-22 22:55:23 -07:00
2008-10-22 22:55:20 -07:00
2012-03-28 18:11:12 +01:00
2010-02-16 21:22:26 -08:00
2008-10-22 22:55:20 -07:00
2008-10-22 22:55:23 -07:00
2012-03-28 18:11:12 +01:00
2011-04-18 09:26:48 -07:00
2012-03-20 21:48:30 +08:00
2008-10-22 22:55:23 -07:00
2012-03-28 18:11:12 +01:00
2009-08-27 00:35:56 +02:00
2011-11-11 10:22:55 +01:00
2008-10-22 22:55:20 -07:00
2010-10-26 16:52:08 -07:00
2011-02-23 22:27:52 +01:00
2008-10-22 22:55:23 -07:00
2012-02-20 12:51:00 -08:00
2009-06-13 15:37:30 +02:00
2012-07-20 16:12:00 -03:00
2012-06-18 16:06:35 +03:00
2008-10-22 22:55:23 -07:00
2011-07-22 14:39:50 +09:30
2011-05-24 14:33:35 +02:00
2010-06-09 11:12:36 +02:00
2012-03-28 18:11:12 +01:00
2008-10-22 22:55:23 -07:00
2008-10-22 22:55:23 -07:00
2008-10-22 22:55:20 -07:00
2012-01-26 21:23:53 +01:00
2010-05-07 17:13:04 -07:00
2008-10-22 22:55:23 -07:00
2008-10-22 22:55:23 -07:00
2008-10-22 22:55:20 -07:00
2008-10-22 22:55:23 -07:00
2008-10-22 22:55:23 -07:00
2012-05-14 14:15:32 -07:00
2010-11-01 15:38:34 -04:00
2010-10-26 16:52:08 -07:00
2011-01-13 17:32:44 -08:00
2011-06-05 21:30:33 +02:00
2011-01-13 17:32:44 -08:00
2008-10-22 22:55:20 -07:00
2009-02-02 23:27:09 +05:30
2011-03-15 15:34:15 -07:00
2010-02-12 09:42:39 -08:00
2011-03-18 10:39:30 +01:00
2008-10-22 22:55:20 -07:00
2008-10-22 22:55:23 -07:00
2008-10-22 22:55:20 -07:00
2011-08-29 13:44:12 -07:00
2008-10-22 22:55:20 -07:00
2008-10-22 22:55:23 -07:00
2008-10-22 22:55:23 -07:00
2008-10-22 22:55:23 -07:00
2012-02-20 12:52:05 -08:00
2008-10-22 22:55:23 -07:00
2009-06-15 12:40:02 +02:00
2008-10-22 22:55:20 -07:00
2008-10-22 22:55:20 -07:00
2009-01-31 00:19:32 +05:30
2012-03-28 18:11:12 +01:00
2008-10-22 22:55:23 -07:00
2008-10-22 22:55:23 -07:00
2008-10-22 22:55:23 -07:00
2011-03-23 19:47:18 -07:00
2008-10-22 22:55:23 -07:00
2008-10-22 22:55:23 -07:00
2008-10-22 22:55:23 -07:00
2008-10-22 22:55:23 -07:00
2012-03-28 18:11:12 +01:00
2008-10-22 22:55:23 -07:00
2011-06-05 21:30:32 +02:00
2008-10-22 22:55:20 -07:00
2009-06-15 12:40:02 +02:00