Re: [PATCH v5 1/4] kvm: Extend irqfd to support level interrupts

From: Michael S. Tsirkin
Date: Wed Jul 18 2012 - 17:30:07 EST


On Wed, Jul 18, 2012 at 06:23:34PM -0300, Marcelo Tosatti wrote:
> On Wed, Jul 18, 2012 at 02:28:34PM -0600, Alex Williamson wrote:
> > > turn on lockdep to remember why I couldn't sleep there.
> >
> > switching to a mutex results in:
> >
> > BUG: sleeping function called from invalid context at kernel/mutex.c:269
> > in_atomic(): 1, irqs_disabled(): 0, pid: 30025, name: qemu-system-x86
> > INFO: lockdep is turned off.
> > Pid: 30025, comm: qemu-system-x86 Not tainted 3.5.0-rc4+ #109
> > Call Trace:
> > [<ffffffff81088425>] __might_sleep+0xf5/0x130
> > [<ffffffff81564c6f>] mutex_lock_nested+0x2f/0x60
> > [<ffffffffa07db7d5>] eoifd_event+0x25/0x70 [kvm]
> > [<ffffffffa07daea4>] kvm_notify_acked_irq+0xa4/0x140 [kvm]
> > [<ffffffffa07dae2a>] ? kvm_notify_acked_irq+0x2a/0x140 [kvm]
> > [<ffffffffa07d9bb4>] kvm_ioapic_update_eoi+0x84/0xf0 [kvm]
> > [<ffffffffa0806c43>] apic_set_eoi+0x123/0x130 [kvm]
> > [<ffffffffa0806fd8>] apic_reg_write+0x388/0x670 [kvm]
> > [<ffffffffa07eb03c>] ? vcpu_enter_guest+0x32c/0x740 [kvm]
> > [<ffffffffa0807481>] kvm_lapic_set_eoi+0x21/0x30 [kvm]
> > [<ffffffffa04ba3f9>] handle_apic_access+0x69/0x80 [kvm_intel]
> > [<ffffffffa04ba02a>] vmx_handle_exit+0xaa/0x260 [kvm_intel]
>
> Its RCU from ack notifiers, OK.

I'm testing a patch that moves all bitmap handling to under
pic/ioapic lock. After this we can teach kvm_set_irq to report
when a bit that is cleared/set is already clear/set, without
races.

And then no tracking will be necessary in irqfd - we can just
call kvm_set_irq(..., 0) and look at the return status.

--
MST
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/