diff --git a/0026-linux-user-Run-multi-threaded-code-.patch b/0026-linux-user-Run-multi-threaded-code-.patch new file mode 100644 index 00000000..892f68ac --- /dev/null +++ b/0026-linux-user-Run-multi-threaded-code-.patch @@ -0,0 +1,40 @@ +From f85c851986d24df8700ffe447301786fe83819d0 Mon Sep 17 00:00:00 2001 +From: Alexander Graf +Date: Tue, 10 Jul 2012 20:40:55 +0200 +Subject: [PATCH] linux-user: Run multi-threaded code on a single core + +Running multi-threaded code can easily expose some of the fundamental +breakages in QEMU's design. It's just not a well supported scenario. + +So if we pin the whole process to a single host CPU, we guarantee that +we will never have concurrent memory access actually happen. We can still +get scheduled away at any time, so it's no complete guarantee, but apparently +it reduces the odds well enough to get my test cases to pass. + +This gets Java 1.7 working for me again on my test box. + +Signed-off-by: Alexander Graf +--- + linux-user/syscall.c | 9 +++++++++ + 1 files changed, 9 insertions(+), 0 deletions(-) + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index 46e964b..b0566cd 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -4298,6 +4298,15 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp, + if (nptl_flags & CLONE_SETTLS) + cpu_set_tls (new_env, newtls); + ++ /* agraf: Pin ourselves to a single CPU when running multi-threaded. ++ This turned out to improve stability for me. */ ++ { ++ cpu_set_t mask; ++ CPU_ZERO(&mask); ++ CPU_SET(0, &mask); ++ sched_setaffinity(0, sizeof(mask), &mask); ++ } ++ + /* Grab a mutex so that thread setup appears atomic. */ + pthread_mutex_lock(&clone_lock); + diff --git a/qemu.changes b/qemu.changes index 6d8f13be..d2968a5b 100644 --- a/qemu.changes +++ b/qemu.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Jul 10 18:43:31 UTC 2012 - agraf@suse.com + +- linux-user: pin multi-threaded applications to a single host cpu + ------------------------------------------------------------------- Tue Jul 10 16:42:54 UTC 2012 - agraf@suse.com diff --git a/qemu.spec b/qemu.spec index 0ce9bc5f..de01fe0c 100644 --- a/qemu.spec +++ b/qemu.spec @@ -49,6 +49,7 @@ Patch0022: 0022-use-libexecdir-instead-of-ignoring-.patch Patch0023: 0023-linux-user-Ignore-broken-loop-ioctl.patch Patch0024: 0024-linux-user-fix-segmentation-fault-p.patch Patch0025: 0025-linux-user-lock-tcg.patch.patch +Patch0026: 0026-linux-user-Run-multi-threaded-code-.patch # this is to make lint happy Source300: rpmlintrc Source302: bridge.conf @@ -181,6 +182,7 @@ run cross-architecture builds. %patch0023 -p1 %patch0024 -p1 %patch0025 -p1 +%patch0026 -p1 %build # build QEMU