Fix race condition on access to env->interrupt_request

env->interrupt_request is accessed as the bit level from both main code
and signal handler, making a race condition possible even on CISC CPU.
This causes freeze of QEMU under high load when running the dyntick
clock.

The patch below move the bit corresponding to CPU_INTERRUPT_EXIT in a
separate variable, declared as volatile sig_atomic_t, so it should be
work even on RISC CPU.

We may want to move the cpu_interrupt(env, CPU_INTERRUPT_EXIT) case in
its own function and get rid of CPU_INTERRUPT_EXIT. That can be done
later, I wanted to keep the patch short for easier review.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6728 c046a42c-6fe2-441c-8c8c-71466251a162
4 files changed
tree: 0c85067ab440ccba46d3282cbe15cf75c8d6640f
  1. audio/
  2. bsd-user/
  3. darwin-user/
  4. fpu/
  5. gdb-xml/
  6. hw/
  7. keymaps/
  8. linux-user/
  9. pc-bios/
  10. slirp/
  11. target-alpha/
  12. target-arm/
  13. target-cris/
  14. target-i386/
  15. target-m68k/
  16. target-mips/
  17. target-ppc/
  18. target-sh4/
  19. target-sparc/
  20. tcg/
  21. tests/
  22. .gitignore
  23. a.out.h
  24. acl.c
  25. acl.h
  26. aes.c
  27. aes.h
  28. aio.c
  29. alpha-dis.c
  30. alpha.ld
  31. arm-dis.c
  32. arm-semi.c
  33. arm.ld
  34. balloon.h
  35. block-bochs.c
  36. block-cloop.c
  37. block-cow.c
  38. block-dmg.c
  39. block-nbd.c
  40. block-parallels.c
  41. block-qcow.c
  42. block-qcow2.c
  43. block-raw-posix.c
  44. block-raw-win32.c
  45. block-vmdk.c
  46. block-vpc.c
  47. block-vvfat.c
  48. block.c
  49. block.h
  50. block_int.h
  51. bswap.h
  52. bt-host.c
  53. bt-vhci.c
  54. buffered_file.c
  55. buffered_file.h
  56. cache-utils.c
  57. cache-utils.h
  58. Changelog
  59. cocoa.m
  60. configure
  61. console.c
  62. console.h
  63. COPYING
  64. COPYING.LIB
  65. cpu-all.h
  66. cpu-defs.h
  67. cpu-exec.c
  68. cris-dis.c
  69. curses.c
  70. curses_keys.h
  71. cutils.c
  72. d3des.c
  73. d3des.h
  74. def-helper.h
  75. device_tree.c
  76. device_tree.h
  77. dis-asm.h
  78. disas.c
  79. disas.h
  80. dma-helpers.c
  81. dma.h
  82. dyngen-exec.h
  83. elf.h
  84. elf_ops.h
  85. exec-all.h
  86. exec.c
  87. feature_to_c.sh
  88. gdbstub.c
  89. gdbstub.h
  90. gen-icount.h
  91. host-utils.c
  92. host-utils.h
  93. hostregs_helper.h
  94. hpet.h
  95. hppa-dis.c
  96. hppa.ld
  97. i386-dis.c
  98. i386.ld
  99. ia64.ld
  100. keymaps.c
  101. kqemu.c
  102. kqemu.h
  103. kvm-all.c
  104. kvm.h
  105. libfdt_env.h
  106. LICENSE
  107. loader.c
  108. m68k-dis.c
  109. m68k-semi.c
  110. m68k.ld
  111. MAINTAINERS
  112. Makefile
  113. Makefile.target
  114. migration-exec.c
  115. migration-tcp.c
  116. migration.c
  117. migration.h
  118. mips-dis.c
  119. mips.ld
  120. mipsel.ld
  121. monitor.c
  122. monitor.h
  123. nbd.c
  124. nbd.h
  125. net-checksum.c
  126. net.c
  127. net.h
  128. osdep.c
  129. osdep.h
  130. pci-ids.txt
  131. posix-aio-compat.c
  132. posix-aio-compat.h
  133. ppc-dis.c
  134. ppc.ld
  135. ppc64.ld
  136. qemu-aio.h
  137. qemu-binfmt-conf.sh
  138. qemu-char.c
  139. qemu-char.h
  140. qemu-common.h
  141. qemu-doc.texi
  142. qemu-img.c
  143. qemu-img.texi
  144. qemu-lock.h
  145. qemu-log.h
  146. qemu-malloc.c
  147. qemu-nbd.c
  148. qemu-nbd.texi
  149. qemu-sockets.c
  150. qemu-tech.texi
  151. qemu-timer.h
  152. qemu-tool.c
  153. qemu.sasl
  154. qemu_socket.h
  155. readline.c
  156. readline.h
  157. README
  158. rules.mak
  159. s390-dis.c
  160. s390.ld
  161. savevm.c
  162. sdl.c
  163. sdl_keysym.h
  164. sh4-dis.c
  165. softmmu-semi.h
  166. softmmu_defs.h
  167. softmmu_exec.h
  168. softmmu_header.h
  169. softmmu_template.h
  170. sparc-dis.c
  171. sparc.ld
  172. sparc64.ld
  173. sys-queue.h
  174. sysemu.h
  175. tap-win32.c
  176. texi2pod.pl
  177. thunk.c
  178. thunk.h
  179. TODO
  180. translate-all.c
  181. uboot_image.h
  182. usb-bsd.c
  183. usb-linux.c
  184. usb-stub.c
  185. VERSION
  186. vgafont.h
  187. vl.c
  188. vnc-auth-sasl.c
  189. vnc-auth-sasl.h
  190. vnc.c
  191. vnc.h
  192. vnc_keysym.h
  193. vnchextile.h
  194. x86_64.ld
  195. x_keymap.c
  196. x_keymap.h