main-loop: use qemu_mutex_lock_iothread consistently

The next patch will require the BQL to be always taken with
qemu_mutex_lock_iothread(), while right now this isn't the case.

Outside TCG mode this is not a problem.  In TCG mode, we need to be
careful and avoid the "prod out of compiled code" step if already
in a VCPU thread.  This is easily done with a check on current_cpu,
i.e. qemu_in_vcpu_thread().

Hopefully, multithreaded TCG will get rid of the whole logic to kick
VCPUs whenever an I/O event occurs!

Cc: Frederic Konrad <fred.konrad@greensocs.com>
Message-Id: <1434646046-27150-2-git-send-email-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 file changed
tree: a6b808eefcf024455e90366c9ab77899167db614
  1. audio/
  2. backends/
  3. block/
  4. bsd-user/
  5. default-configs/
  6. disas/
  7. docs/
  8. fpu/
  9. fsdev/
  10. gdb-xml/
  11. hw/
  12. include/
  13. libcacard/
  14. libdecnumber/
  15. linux-headers/
  16. linux-user/
  17. migration/
  18. net/
  19. pc-bios/
  20. po/
  21. qapi/
  22. qga/
  23. qobject/
  24. qom/
  25. roms/
  26. scripts/
  27. slirp/
  28. stubs/
  29. target-alpha/
  30. target-arm/
  31. target-cris/
  32. target-i386/
  33. target-lm32/
  34. target-m68k/
  35. target-microblaze/
  36. target-mips/
  37. target-moxie/
  38. target-openrisc/
  39. target-ppc/
  40. target-s390x/
  41. target-sh4/
  42. target-sparc/
  43. target-tricore/
  44. target-unicore32/
  45. target-xtensa/
  46. tcg/
  47. tests/
  48. trace/
  49. ui/
  50. util/
  51. .exrc
  52. .gitignore
  53. .gitmodules
  54. .mailmap
  55. .travis.yml
  56. accel.c
  57. aio-posix.c
  58. aio-win32.c
  59. arch_init.c
  60. async.c
  61. balloon.c
  62. block.c
  63. blockdev-nbd.c
  64. blockdev.c
  65. blockjob.c
  66. bootdevice.c
  67. bt-host.c
  68. bt-vhci.c
  69. Changelog
  70. CODING_STYLE
  71. configure
  72. COPYING
  73. COPYING.LIB
  74. coroutine-gthread.c
  75. coroutine-sigaltstack.c
  76. coroutine-ucontext.c
  77. coroutine-win32.c
  78. cpu-exec.c
  79. cpus.c
  80. cputlb.c
  81. device-hotplug.c
  82. device_tree.c
  83. disas.c
  84. dma-helpers.c
  85. dump.c
  86. exec.c
  87. gdbstub.c
  88. HACKING
  89. hmp-commands.hx
  90. hmp.c
  91. hmp.h
  92. iohandler.c
  93. ioport.c
  94. iothread.c
  95. kvm-all.c
  96. kvm-stub.c
  97. LICENSE
  98. main-loop.c
  99. MAINTAINERS
  100. Makefile
  101. Makefile.objs
  102. Makefile.target
  103. memory.c
  104. memory_mapping.c
  105. module-common.c
  106. monitor.c
  107. nbd.c
  108. numa.c
  109. os-posix.c
  110. os-win32.c
  111. page_cache.c
  112. qapi-schema.json
  113. qdev-monitor.c
  114. qdict-test-data.txt
  115. qemu-bridge-helper.c
  116. qemu-char.c
  117. qemu-coroutine-io.c
  118. qemu-coroutine-lock.c
  119. qemu-coroutine-sleep.c
  120. qemu-coroutine.c
  121. qemu-doc.texi
  122. qemu-img-cmds.hx
  123. qemu-img.c
  124. qemu-img.texi
  125. qemu-io-cmds.c
  126. qemu-io.c
  127. qemu-log.c
  128. qemu-nbd.c
  129. qemu-nbd.texi
  130. qemu-options-wrapper.h
  131. qemu-options.h
  132. qemu-options.hx
  133. qemu-seccomp.c
  134. qemu-tech.texi
  135. qemu-timer.c
  136. qemu.nsi
  137. qemu.sasl
  138. qjson.c
  139. qmp-commands.hx
  140. qmp.c
  141. qtest.c
  142. README
  143. rules.mak
  144. softmmu_template.h
  145. spice-qemu-char.c
  146. tcg-runtime.c
  147. tci.c
  148. thread-pool.c
  149. thunk.c
  150. tpm.c
  151. trace-events
  152. translate-all.c
  153. translate-all.h
  154. user-exec.c
  155. VERSION
  156. version.rc
  157. vl.c
  158. xen-common-stub.c
  159. xen-common.c
  160. xen-hvm-stub.c
  161. xen-hvm.c
  162. xen-mapcache.c