Message ID | 20221118091858.242569-5-richard.henderson@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | main-loop: Introduce QEMU_IOTHREAD_LOCK_GUARD | expand |
On 11/18/22 06:18, Richard Henderson wrote: > In addition, use tcg_enabled instead of !kvm_enabled. > > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- Should we strive for this change (tcg_enabled instead of !kvm_enabled) everywhere when applicable? There's a lot of places in the ppc code where this can be done. Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> > Cc: qemu-ppc@nongnu.org > --- > target/ppc/helper_regs.c | 14 ++++---------- > 1 file changed, 4 insertions(+), 10 deletions(-) > > diff --git a/target/ppc/helper_regs.c b/target/ppc/helper_regs.c > index c0aee5855b..779e7db513 100644 > --- a/target/ppc/helper_regs.c > +++ b/target/ppc/helper_regs.c > @@ -22,6 +22,7 @@ > #include "qemu/main-loop.h" > #include "exec/exec-all.h" > #include "sysemu/kvm.h" > +#include "sysemu/tcg.h" > #include "helper_regs.h" > #include "power8-pmu.h" > #include "cpu-models.h" > @@ -203,17 +204,10 @@ void cpu_interrupt_exittb(CPUState *cs) > { > /* > * We don't need to worry about translation blocks > - * when running with KVM. > + * unless running with TCG. > */ > - if (kvm_enabled()) { > - return; > - } > - > - if (!qemu_mutex_iothread_locked()) { > - qemu_mutex_lock_iothread(); > - cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); > - qemu_mutex_unlock_iothread(); > - } else { > + if (tcg_enabled()) { > + QEMU_IOTHREAD_LOCK_GUARD(); > cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); > } > }
On 11/18/22 02:13, Daniel Henrique Barboza wrote: > > > On 11/18/22 06:18, Richard Henderson wrote: >> In addition, use tcg_enabled instead of !kvm_enabled. >> >> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> >> --- > > Should we strive for this change (tcg_enabled instead of !kvm_enabled) > everywhere when applicable? There's a lot of places in the ppc code where > this can be done. I think it's better style, since that's generally what is meant. It's important when the target supports multiple accelerators. A test for !kvm begs the question of why we aren't also testing for e.g. !hvf. I've noticed a couple of these in the code base. r~ > > > Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> > > >> Cc: qemu-ppc@nongnu.org >> --- >> target/ppc/helper_regs.c | 14 ++++---------- >> 1 file changed, 4 insertions(+), 10 deletions(-) >> >> diff --git a/target/ppc/helper_regs.c b/target/ppc/helper_regs.c >> index c0aee5855b..779e7db513 100644 >> --- a/target/ppc/helper_regs.c >> +++ b/target/ppc/helper_regs.c >> @@ -22,6 +22,7 @@ >> #include "qemu/main-loop.h" >> #include "exec/exec-all.h" >> #include "sysemu/kvm.h" >> +#include "sysemu/tcg.h" >> #include "helper_regs.h" >> #include "power8-pmu.h" >> #include "cpu-models.h" >> @@ -203,17 +204,10 @@ void cpu_interrupt_exittb(CPUState *cs) >> { >> /* >> * We don't need to worry about translation blocks >> - * when running with KVM. >> + * unless running with TCG. >> */ >> - if (kvm_enabled()) { >> - return; >> - } >> - >> - if (!qemu_mutex_iothread_locked()) { >> - qemu_mutex_lock_iothread(); >> - cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); >> - qemu_mutex_unlock_iothread(); >> - } else { >> + if (tcg_enabled()) { >> + QEMU_IOTHREAD_LOCK_GUARD(); >> cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); >> } >> }
On 18/11/22 10:18, Richard Henderson wrote: > In addition, use tcg_enabled instead of !kvm_enabled. > > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- > Cc: qemu-ppc@nongnu.org > --- > target/ppc/helper_regs.c | 14 ++++---------- > 1 file changed, 4 insertions(+), 10 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff --git a/target/ppc/helper_regs.c b/target/ppc/helper_regs.c index c0aee5855b..779e7db513 100644 --- a/target/ppc/helper_regs.c +++ b/target/ppc/helper_regs.c @@ -22,6 +22,7 @@ #include "qemu/main-loop.h" #include "exec/exec-all.h" #include "sysemu/kvm.h" +#include "sysemu/tcg.h" #include "helper_regs.h" #include "power8-pmu.h" #include "cpu-models.h" @@ -203,17 +204,10 @@ void cpu_interrupt_exittb(CPUState *cs) { /* * We don't need to worry about translation blocks - * when running with KVM. + * unless running with TCG. */ - if (kvm_enabled()) { - return; - } - - if (!qemu_mutex_iothread_locked()) { - qemu_mutex_lock_iothread(); - cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); - qemu_mutex_unlock_iothread(); - } else { + if (tcg_enabled()) { + QEMU_IOTHREAD_LOCK_GUARD(); cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); } }
In addition, use tcg_enabled instead of !kvm_enabled. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- Cc: qemu-ppc@nongnu.org --- target/ppc/helper_regs.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)