From 45942c08c98fa5e78c7bc9e1475b1db603fca560 Mon Sep 17 00:00:00 2001 From: Jong-Woo Chae Date: Tue, 8 Dec 2015 23:51:48 -0800 Subject: Revert "Revert "linux-user: Run multi-threaded code on a single core"" This reverts commit a82e4a19e88da9bccb1fb539f66298a7e3b8cac6. This revert commit harms stability of GBS build and may cause hang in OBS build. Change-Id: I017d6accb0bcc7b2b2df662590ed05b81b82f28c --- linux-user/syscall.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 84193cedf..52885ab05 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4531,6 +4531,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); -- cgit v1.2.3