diff options
author | Roland Grunberg <rgrunber@redhat.com> | 2009-11-06 14:09:06 -0500 |
---|---|---|
committer | Roland Grunberg <rgrunber@redhat.com> | 2009-11-06 14:09:06 -0500 |
commit | 079915a57182ed3e5981190ccf8216c674aa4406 (patch) | |
tree | 50f5da998baded364e7908236a6ce9a18106ddaf | |
parent | 4be13c03169ded00a0a6b0e7e7ce8d008aaa51d0 (diff) | |
download | systemtap-steved-079915a57182ed3e5981190ccf8216c674aa4406.tar.gz systemtap-steved-079915a57182ed3e5981190ccf8216c674aa4406.tar.xz systemtap-steved-079915a57182ed3e5981190ccf8216c674aa4406.zip |
PR10849: Support MAXSKIPPED handling on RHEL4 through implementation of atomic_cmpxchg
-rw-r--r-- | runtime/runtime.h | 11 | ||||
-rw-r--r-- | tapsets.cxx | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/runtime/runtime.h b/runtime/runtime.h index a95627ae..ba583aeb 100644 --- a/runtime/runtime.h +++ b/runtime/runtime.h @@ -179,6 +179,17 @@ void cleanup_module(void) _stp_transport_close(); } +#define pseudo_atomic_cmpxchg(v, old, new) ({\ + int ret;\ + unsigned long flags;\ + local_irq_save(flags);\ + ret = atomic_read(v);\ + if (likely(ret == old))\ + atomic_set(v, new);\ + local_irq_restore(flags);\ + ret; }) + + MODULE_LICENSE("GPL"); #endif /* _RUNTIME_H_ */ diff --git a/tapsets.cxx b/tapsets.cxx index 17e315e9..21704f69 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -228,7 +228,7 @@ common_probe_entryfn_epilogue (translator_output* o, // Check for excessive skip counts. o->newline() << "if (unlikely (atomic_read (& skipped_count) > MAXSKIPPED)) {"; - o->newline(1) << "if (unlikely (atomic_cmpxchg(& session_state, STAP_SESSION_RUNNING, STAP_SESSION_ERROR) == STAP_SESSION_RUNNING))"; + o->newline(1) << "if (unlikely (pseudo_atomic_cmpxchg(& session_state, STAP_SESSION_RUNNING, STAP_SESSION_ERROR) == STAP_SESSION_RUNNING))"; o->newline() << "_stp_error (\"Skipped too many probes, check MAXSKIPPED or try again with stap -t for more details.\");"; o->newline(-1) << "}"; @@ -4640,7 +4640,7 @@ uprobe_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "#endif"; // NB: duplicates common_entryfn_epilogue, but then this is not a probe entry fn epilogue. s.op->newline() << "if (unlikely (atomic_inc_return (& skipped_count) > MAXSKIPPED)) {"; - s.op->newline(1) << "if (unlikely (atomic_cmpxchg(& session_state, STAP_SESSION_RUNNING, STAP_SESSION_ERROR) == STAP_SESSION_RUNNING))"; + s.op->newline(1) << "if (unlikely (pseudo_atomic_cmpxchg(& session_state, STAP_SESSION_RUNNING, STAP_SESSION_ERROR) == STAP_SESSION_RUNNING))"; s.op->newline() << "_stp_error (\"Skipped too many probes, check MAXSKIPPED or try again with stap -t for more details.\");"; s.op->newline(-1) << "}"; s.op->newline(-1) << "}"; |