summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2015-09-03 15:03:30 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-04 16:23:56 +0100
commitea3384e9f84388d60331ba24f67ce5716ce45ee0 (patch)
tree2c35e1f766e82e1019dc7b475e0c29b67d3b0834
parent92f68b45fcddc9e9303999ebc5d06a7e4724310f (diff)
downloadpoky-ea3384e9f84388d60331ba24f67ce5716ce45ee0.tar.gz
qemu: Fix qemu_cpu_kick_thread on init
When QEMU starts the RCU thread executes qemu_mutex_lock_thread causing error "qemu:qemu_cpu_kick_thread: No such process" and exits. For detail explanation see upstream patch. [YOCTO #8143] (From OE-Core rev: e4bbd98bf9648bbf3ffa7c4338f2302a92a413ef) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/qemu/qemu.inc1
-rw-r--r--meta/recipes-devtools/qemu/qemu/cpus.c-qemu_mutex_lock_iothread-fix-race-condition-a.patch45
2 files changed, 46 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
index dc7b628d6d..738bf2b22e 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -21,6 +21,7 @@ SRC_URI = "\
21 file://wacom.patch \ 21 file://wacom.patch \
22 file://add-ptest-in-makefile.patch \ 22 file://add-ptest-in-makefile.patch \
23 file://run-ptest \ 23 file://run-ptest \
24 file://cpus.c-qemu_mutex_lock_iothread-fix-race-condition-a.patch \
24 " 25 "
25 26
26SRC_URI_append_class-native = "\ 27SRC_URI_append_class-native = "\
diff --git a/meta/recipes-devtools/qemu/qemu/cpus.c-qemu_mutex_lock_iothread-fix-race-condition-a.patch b/meta/recipes-devtools/qemu/qemu/cpus.c-qemu_mutex_lock_iothread-fix-race-condition-a.patch
new file mode 100644
index 0000000000..45dffabc34
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/cpus.c-qemu_mutex_lock_iothread-fix-race-condition-a.patch
@@ -0,0 +1,45 @@
1Upstream-Status: Submitted
2
3From f354b9333408d411854af058cc44cceda60b4473 Mon Sep 17 00:00:00 2001
4From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal.limon@linux.intel.com>
5Date: Thu, 3 Sep 2015 14:07:34 -0500
6Subject: [PATCH] cpus.c: qemu_mutex_lock_iothread fix race condition at cpu
7 thread init
8MIME-Version: 1.0
9Content-Type: text/plain; charset=UTF-8
10Content-Transfer-Encoding: 8bit
11
12When QEMU starts the RCU thread executes qemu_mutex_lock_thread
13causing error "qemu:qemu_cpu_kick_thread: No such process" and exits.
14
15This isn't occur frequently but in glibc the thread id can exist and
16this not guarantee that the thread is on active/running state. If is
17inserted a sleep(1) after newthread assignment [1] the issue appears.
18
19So not make assumption that thread exist if first_cpu->thread is set
20then change the validation of cpu to created that is set into cpu
21threads (kvm, tcg, dummy).
22
23[1] https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/pthread_create.c;h=d10f4ea8004e1d8f3a268b95cc0f8d93b8d89867;hb=HEAD#l621
24
25Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
26---
27 cpus.c | 2 +-
28 1 file changed, 1 insertion(+), 1 deletion(-)
29
30diff --git a/cpus.c b/cpus.c
31index 7e4786e..05e5400 100644
32--- a/cpus.c
33+++ b/cpus.c
34@@ -1171,7 +1171,7 @@ void qemu_mutex_lock_iothread(void)
35 * TCG code execution.
36 */
37 if (!tcg_enabled() || qemu_in_vcpu_thread() ||
38- !first_cpu || !first_cpu->thread) {
39+ !first_cpu || !first_cpu->created) {
40 qemu_mutex_lock(&qemu_global_mutex);
41 atomic_dec(&iothread_requesting_mutex);
42 } else {
43--
441.9.1
45