diff options
author | jistone <jistone> | 2006-12-07 03:01:42 +0000 |
---|---|---|
committer | jistone <jistone> | 2006-12-07 03:01:42 +0000 |
commit | e0d86324628566cedd055ed038fd487c12db676a (patch) | |
tree | e1af137734c443eaa923dde0ea22962eb35a8087 /tapsets.cxx | |
parent | 129be0acc85b2bb7bb9b3c71b0c4caa350aecb4b (diff) | |
download | systemtap-steved-e0d86324628566cedd055ed038fd487c12db676a.tar.gz systemtap-steved-e0d86324628566cedd055ed038fd487c12db676a.tar.xz systemtap-steved-e0d86324628566cedd055ed038fd487c12db676a.zip |
2006-12-06 Josh Stone <joshua.i.stone@intel.com>
PR 3623.
* tapsets.cxx (timer_derived_probe_group::emit_module_decls): Restart
the timers if we are in STARTING or RUNNING state.
(hrtimer_derived_probe_group::emit_module_decls): Ditto.
(be_derived_probe_group::emit_module_init): indicate error to the rest
of the initialization if any begin probes fail.
* translate.cxx (c_unparser::emit_module_init): Set the global error
state on an initialization error so timers know to shut down.
runtime/
* time.c (stp_timer_reregister): Add a global to control whether the
gettimeofday timer should restart itself, for clean shutdown.
(__stp_time_timer_callback): Check the global.
(_stp_kill_time, _stp_init_time): Set the global.
(_stp_gettimeofday_ns): Switch to preempt_enable_no_resched.
* time.c (__stp_time_cpufreq_callback): Use the cpu# from the notifier.
(_stp_init_time): No need to disable preemption around cpufreq init.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r-- | tapsets.cxx | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/tapsets.cxx b/tapsets.cxx index 8bce8cd8..a71b352e 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -285,9 +285,18 @@ void be_derived_probe_group::emit_module_init (systemtap_session& s) { // if (probes.empty()) return; + bool have_begin_probes = false; for (unsigned i=0; i < probes.size (); i++) if (probes[i]->begin) - s.op->newline() << "enter_begin_probe (& " << probes[i]->name << ");"; + { + have_begin_probes = true; + s.op->newline() << "enter_begin_probe (& " << probes[i]->name << ");"; + } + + // If any of the begin probes signaled an error, indicate + // failure to the rest of systemtap_module_init. + if (have_begin_probes) + s.op->newline() << "rc = (atomic_read (&session_state) == STAP_SESSION_ERROR);"; } void @@ -3771,14 +3780,19 @@ timer_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "static void enter_timer_probe (unsigned long val) {"; s.op->newline(1) << "struct stap_timer_probe* stp = & stap_timer_probes [val];"; - common_probe_entryfn_prologue (s.op, "STAP_SESSION_RUNNING"); - s.op->newline() << "c->probe_point = stp->pp;"; - s.op->newline() << "mod_timer (& stp->timer_list, jiffies + "; + s.op->newline() << "if ((atomic_read (&session_state) == STAP_SESSION_STARTING) ||"; + s.op->newline() << " (atomic_read (&session_state) == STAP_SESSION_RUNNING))"; + s.op->newline(1) << "mod_timer (& stp->timer_list, jiffies + "; emit_interval (s.op); s.op->line() << ");"; + s.op->newline(-1) << "{"; + s.op->indent(1); + common_probe_entryfn_prologue (s.op, "STAP_SESSION_RUNNING"); + s.op->newline() << "c->probe_point = stp->pp;"; s.op->newline() << "(*stp->ph) (c);"; common_probe_entryfn_epilogue (s.op); s.op->newline(-1) << "}"; + s.op->newline(-1) << "}"; } @@ -4576,19 +4590,24 @@ hrtimer_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline(); s.op->newline() << "static int enter_hrtimer_probe (struct hrtimer *timer) {"; - s.op->newline(1) << "struct stap_hrtimer_probe *stp = container_of(timer, struct stap_hrtimer_probe, hrtimer);"; - // presume problem with updating ->expires or something else XXX - s.op->newline() << "int restart_or_not = HRTIMER_NORESTART;"; - common_probe_entryfn_prologue (s.op, "STAP_SESSION_RUNNING"); - s.op->newline() << "c->probe_point = stp->pp;"; + s.op->newline(1) << "int rc = HRTIMER_NORESTART;"; + s.op->newline() << "struct stap_hrtimer_probe *stp = container_of(timer, struct stap_hrtimer_probe, hrtimer);"; + s.op->newline() << "if ((atomic_read (&session_state) == STAP_SESSION_STARTING) ||"; + s.op->newline() << " (atomic_read (&session_state) == STAP_SESSION_RUNNING)) {"; // Compute next trigger time - s.op->newline() << "timer->expires = ktime_add (timer->expires,"; + s.op->newline(1) << "timer->expires = ktime_add (timer->expires,"; emit_interval (s.op); s.op->line() << ");"; - s.op->newline() << "restart_or_not = HRTIMER_RESTART;"; // ->expires updated; safe to restart + s.op->newline() << "rc = HRTIMER_RESTART;"; + s.op->newline(-1) << "}"; + s.op->newline() << "{"; + s.op->indent(1); + common_probe_entryfn_prologue (s.op, "STAP_SESSION_RUNNING"); + s.op->newline() << "c->probe_point = stp->pp;"; s.op->newline() << "(*stp->ph) (c);"; common_probe_entryfn_epilogue (s.op); - s.op->newline() << "return restart_or_not;"; + s.op->newline(-1) << "}"; + s.op->newline() << "return rc;"; s.op->newline(-1) << "}"; } |