From 8d59b39f96b89eb055d77d422a923c499d2a5fca Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 26 Nov 2008 13:59:53 -0500 Subject: [PATCH] safety: add paranoid call to synchronize_sched() during shutdown process --- ChangeLog | 6 ++++++ buildrun.cxx | 2 ++ runtime/ChangeLog | 4 ++++ runtime/autoconf-synchronize-sched.c | 6 ++++++ translate.cxx | 6 ++++++ 5 files changed, 24 insertions(+) create mode 100644 runtime/autoconf-synchronize-sched.c diff --git a/ChangeLog b/ChangeLog index fd3860e60..8572035bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-11-26 Frank Ch. Eigler + + * translate.cxx (emit_module_exit): Call synchronize_sched during + module shutdown if it's available. + * buildrun.cxx (compile_pass): Test for it. + 2008-11-25 Frank Ch. Eigler PR 7046. diff --git a/buildrun.cxx b/buildrun.cxx index c23a47479..9eeab4baf 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -112,6 +112,8 @@ compile_pass (systemtap_session& s) o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-uaccess.c, -DSTAPCONF_LINUX_UACCESS_H,)" << endl; o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-oneachcpu-retry.c, -DSTAPCONF_ONEACHCPU_RETRY,)" << endl; o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-dpath-path.c, -DSTAPCONF_DPATH_PATH,)" << endl; + o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-synchronize-sched.c, -DSTAPCONF_SYNCHRONIZE_SCHED,)" << endl; + #if 0 /* NB: For now, the performance hit of probe_kernel_read/write (vs. our * homegrown safe-access functions) is deemed undesireable, so we'll skip diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 91a932c47..f3c5f2e3c 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,7 @@ +2008-11-26 Frank Ch. Eigler + + * autoconf-synchronize-sched.c: New file. + 2008-11-25 Frank Ch. Eigler PR 7046. diff --git a/runtime/autoconf-synchronize-sched.c b/runtime/autoconf-synchronize-sched.c new file mode 100644 index 000000000..0291092e2 --- /dev/null +++ b/runtime/autoconf-synchronize-sched.c @@ -0,0 +1,6 @@ +#include + +void foo (void) +{ + synchronize_sched (); +} diff --git a/translate.cxx b/translate.cxx index 1cf7361e8..41a424ed6 100644 --- a/translate.cxx +++ b/translate.cxx @@ -1287,6 +1287,11 @@ c_unparser::emit_module_exit () o->newline () << "yield ();"; // aka schedule() and then some o->newline(-2) << "} while (holdon);"; + // + o->newline() << "#ifdef STAPCONF_SYNCHRONIZE_SCHED"; + o->newline() << "synchronize_sched();"; + o->newline() << "#endif"; + // XXX: might like to have an escape hatch, in case some probe is // genuinely stuck somehow @@ -4860,6 +4865,7 @@ translate_pass (systemtap_session& s) s.op->newline() << "#include \"stat.c\""; s.op->newline() << "#include "; s.op->newline() << "#include "; + s.op->newline() << "#include "; s.op->newline() << "#include "; s.op->newline() << "#include "; s.op->newline() << "#include "; -- 2.43.5