From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 2/9] Revert "rcu: do not create thread in pthread_atfork callback"
Date: Tue, 8 Aug 2017 17:29:34 +0200 [thread overview]
Message-ID: <20170808152941.11247-3-pbonzini@redhat.com> (raw)
In-Reply-To: <20170808152941.11247-1-pbonzini@redhat.com>
This reverts commit a59629fcc6f603e19b516dc08f75334e5c480bd0.
This is not needed anymore because the IOThread mutex is not
"magic" anymore (need not kick the CPU thread)and also because
fork callbacks are only enabled at the very beginning of
QEMU's execution.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/qemu/rcu.h | 1 -
linux-user/syscall.c | 1 -
os-posix.c | 2 --
util/rcu.c | 10 +++++++---
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h
index c0da9907e8..f19413d649 100644
--- a/include/qemu/rcu.h
+++ b/include/qemu/rcu.h
@@ -111,7 +111,6 @@ extern void rcu_unregister_thread(void);
*/
extern void rcu_enable_atfork(void);
extern void rcu_disable_atfork(void);
-extern void rcu_after_fork(void);
struct rcu_head;
typedef void RCUCBFunc(struct rcu_head *head);
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 54343c06be..9b6364a266 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6354,7 +6354,6 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
ret = fork();
if (ret == 0) {
/* Child Process. */
- rcu_after_fork();
cpu_clone_regs(env, newsp);
fork_end(1);
/* There is a race condition here. The parent process could
diff --git a/os-posix.c b/os-posix.c
index c6ddb7d830..92e9d85215 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -34,7 +34,6 @@
#include "sysemu/sysemu.h"
#include "net/slirp.h"
#include "qemu-options.h"
-#include "qemu/rcu.h"
#include "qemu/error-report.h"
#include "qemu/log.h"
#include "qemu/cutils.h"
@@ -249,7 +248,6 @@ void os_daemonize(void)
signal(SIGTSTP, SIG_IGN);
signal(SIGTTOU, SIG_IGN);
signal(SIGTTIN, SIG_IGN);
- rcu_after_fork();
}
}
diff --git a/util/rcu.c b/util/rcu.c
index 2142ddd93b..ca5a63e36a 100644
--- a/util/rcu.c
+++ b/util/rcu.c
@@ -350,18 +350,22 @@ static void rcu_init_unlock(void)
qemu_mutex_unlock(&rcu_registry_lock);
qemu_mutex_unlock(&rcu_sync_lock);
}
-#endif
-void rcu_after_fork(void)
+static void rcu_init_child(void)
{
+ if (atfork_depth < 1) {
+ return;
+ }
+
memset(®istry, 0, sizeof(registry));
rcu_init_complete();
}
+#endif
static void __attribute__((__constructor__)) rcu_init(void)
{
#ifdef CONFIG_POSIX
- pthread_atfork(rcu_init_lock, rcu_init_unlock, rcu_init_unlock);
+ pthread_atfork(rcu_init_lock, rcu_init_unlock, rcu_init_child);
#endif
rcu_init_complete();
}
--
2.13.3
next prev parent reply other threads:[~2017-08-08 15:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-08 15:29 [Qemu-devel] [PULL 0/9] Misc patches for 2017-08-08 Paolo Bonzini
2017-08-08 15:29 ` [Qemu-devel] [PULL 1/9] rcu: completely disable pthread_atfork callbacks as soon as possible Paolo Bonzini
2017-08-08 15:29 ` Paolo Bonzini [this message]
2017-08-08 15:29 ` [Qemu-devel] [PULL 3/9] kvm: workaround build break on gcc-7.1.1 / fedora26 Paolo Bonzini
2017-08-08 15:29 ` [Qemu-devel] [PULL 4/9] scsi: clarify sense codes for LUN0 emulation Paolo Bonzini
2017-08-08 15:29 ` [Qemu-devel] [PULL 5/9] target/i386: set rip_offset for some SSE4.1 instructions Paolo Bonzini
2017-08-08 15:29 ` [Qemu-devel] [PULL 6/9] qemu-img: Sort sub-command names in --help Paolo Bonzini
2017-08-08 15:29 ` [Qemu-devel] [PULL 7/9] qemu-io: Give more --version information Paolo Bonzini
2017-08-08 15:29 ` [Qemu-devel] [PULL 8/9] qga: " Paolo Bonzini
2017-08-08 15:29 ` [Qemu-devel] [PULL 9/9] maint: Include bug-reporting info in --help output Paolo Bonzini
2017-08-08 16:41 ` [Qemu-devel] [PULL 0/9] Misc patches for 2017-08-08 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170808152941.11247-3-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).