On 6 February 2018 at 08:24, Gonglei (Arei) <arei.gong...@huawei.com> wrote: > So, taking BQL is necessary, and what we can do is trying our best to narrow > down the process of locking ? For example, do the following wrapping: > > static void rtc_rasie_irq(RTCState *s) > { > qemu_mutex_lock_iothread(); > qemu_irq_raise(s->irq); > qemu_mutex_unlock_iothread(); > } > > static void rtc_lower_irq(RTCState *s) > { > qemu_mutex_lock_iothread(); > qemu_irq_lower(s->irq); > qemu_mutex_unlock_iothread(); > }
If you do that you'll also need to be careful about not calling those functions from contexts where you already hold the iothread mutex (eg timer callbacks), since you can't lock a mutex you already have locked. thanks -- PMM