On Wed, 5 Aug 2020 at 15:18, Richard Henderson <richard.hender...@linaro.org> wrote: > > On 8/5/20 11:12 AM, Robert Foley wrote: > > @@ -299,8 +299,12 @@ void alpha_cpu_do_interrupt(CPUState *cs) > > { > > AlphaCPU *cpu = ALPHA_CPU(cs); > > CPUAlphaState *env = &cpu->env; > > - int i = cs->exception_index; > > - > > + int i; > > + bool bql = !qemu_mutex_iothread_locked(); > > + if (bql) { > > + qemu_mutex_lock_iothread(); > > + } > > Why does this patch for alpha need to check qemu_mutex_iothread_locked and the > next patch for arm does not? >
In alpha (and arm) the do_interrupt function can be called separately or by cpu_exec_interrupt. In the case where do_interrupt gets called separately it needs to take the BQL (bql == true). In the case where cpu_exec_interrupt is holding the BQL, and calls do_interrupt, do_interrupt needs to check qemu_mutex_iothread_locked, and in this case not get the lock (bql == false). The next patch for arm, checks qemu_mutex_iothread_locked in its do_interrupt function, but not in its cpu_exec_interrupt function, the same pattern as for alpha. Thanks & Regards, -Rob > > r~