Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define STAP_MSG_RUNTIME_H_01 "myproc-unprivileged tapset function called without is_myproc checking for pid %d (euid %d)"
- #define STAP_MSG_LOC2C_01 "kernel read fault at 0x%p (%s)"
- #define STAP_MSG_LOC2C_02 "kernel write fault at 0x%p (%s)"
- #define STAP_MSG_LOC2C_03 "divide by zero in DWARF operand (%s)"
- #define STAP_VERSION(a, b) ( ((a) << 8) + (b) )
- #ifndef STAP_COMPAT_VERSION
- #define STAP_COMPAT_VERSION STAP_VERSION(1, 6)
- #endif
- #define STP_PRIVILEGED 1
- #ifndef MAXNESTING
- #define MAXNESTING 5
- #endif
- #include <asm/types.h>
- #ifndef MAXSTRINGLEN
- #if BITS_PER_LONG == 32
- #define MAXSTRINGLEN 256
- #else
- #define MAXSTRINGLEN 512
- #endif
- #endif
- #ifndef MAXACTION
- #define MAXACTION 1000
- #endif
- #ifndef MAXACTION_INTERRUPTIBLE
- #define MAXACTION_INTERRUPTIBLE (MAXACTION * 10)
- #endif
- #ifndef TRYLOCKDELAY
- #define TRYLOCKDELAY 10 /* microseconds */
- #endif
- #ifndef MAXTRYLOCK
- #define MAXTRYLOCK 100 /* 1 millisecond total */
- #endif
- #ifndef MAXMAPENTRIES
- #define MAXMAPENTRIES 2048
- #endif
- #ifndef MAXERRORS
- #define MAXERRORS 0
- #endif
- #ifndef MAXSKIPPED
- #define MAXSKIPPED 100
- #endif
- #ifndef MINSTACKSPACE
- #define MINSTACKSPACE 1024
- #endif
- #ifndef INTERRUPTIBLE
- #define INTERRUPTIBLE 1
- #endif
- #ifndef STP_OVERLOAD_INTERVAL
- #define STP_OVERLOAD_INTERVAL 1000000000LL
- #endif
- #ifndef STP_OVERLOAD_THRESHOLD
- #define STP_OVERLOAD_THRESHOLD 500000000LL
- #endif
- #if !defined(STP_NO_OVERLOAD) && !defined(STAP_NO_OVERLOAD)
- #define STP_OVERLOAD
- #endif
- #define STP_SKIP_BADVARS 0
- #include "runtime.h"
- #include "stack.c"
- #include "stat.c"
- #include <linux/string.h>
- #include <linux/timer.h>
- #include <linux/sched.h>
- #include <linux/delay.h>
- #include <linux/profile.h>
- #include <linux/random.h>
- #include <linux/vermagic.h>
- #include <linux/utsname.h>
- #include <linux/version.h>
- #include "loc2c-runtime.h"
- #include "access_process_vm.h"
- #include <linux/time.h>
- typedef char string_t[MAXSTRINGLEN];
- #define STAP_SESSION_STARTING 0
- #define STAP_SESSION_RUNNING 1
- #define STAP_SESSION_ERROR 2
- #define STAP_SESSION_STOPPING 3
- #define STAP_SESSION_STOPPED 4
- static atomic_t session_state = ATOMIC_INIT (STAP_SESSION_STARTING);
- static atomic_t error_count = ATOMIC_INIT (0);
- static atomic_t skipped_count = ATOMIC_INIT (0);
- static atomic_t skipped_count_lowstack = ATOMIC_INIT (0);
- static atomic_t skipped_count_reentrant = ATOMIC_INIT (0);
- static atomic_t skipped_count_uprobe_reg = ATOMIC_INIT (0);
- static atomic_t skipped_count_uprobe_unreg = ATOMIC_INIT (0);
- #define _STP_REGS_USER_FLAG 1
- struct context {
- atomic_t busy;
- const char *probe_point;
- const char *probe_name;
- int actionremaining;
- int nesting;
- string_t error_buffer;
- #ifdef STAP_NEED_CONTEXT_TOKENIZE
- string_t tok_str;
- char *tok_start;
- char *tok_end;
- #endif
- const char *last_error;
- const char *last_stmt;
- struct pt_regs *regs;
- #if defined __ia64__
- unsigned long *unwaddr;
- #endif
- struct kretprobe_instance *pi;
- int pi_longs;
- int regflags;
- int regparm;
- va_list *mark_va_list;
- const char * marker_name;
- const char * marker_format;
- void *data;
- #ifdef STP_OVERLOAD
- cycles_t cycles_base;
- cycles_t cycles_sum;
- #endif
- struct uretprobe_instance *ri;
- #if defined(STP_NEED_UNWIND_DATA)
- struct unwind_context uwcontext;
- #endif
- union {
- struct probe_2962_locals {
- string_t __tmp0;
- string_t __tmp2;
- } probe_2962;
- struct probe_2963_locals {
- string_t __tmp0;
- int64_t __tmp1;
- string_t __tmp2;
- } probe_2963;
- } probe_locals;
- union {
- struct function___indent_timestamp_locals {
- int64_t __retvalue;
- } function___indent_timestamp;
- struct function__generic_indent_locals {
- int64_t ts;
- int64_t x;
- string_t r;
- int64_t i;
- int64_t idx;
- int64_t delta;
- union {
- struct {
- int64_t __tmp0;
- };
- struct {
- int64_t __tmp2;
- int64_t __tmp3;
- int64_t __tmp4;
- int64_t __tmp5;
- int64_t __tmp6;
- };
- struct {
- int64_t __tmp8;
- int64_t __tmp10;
- int64_t __tmp11;
- };
- struct {
- int64_t __tmp12;
- int64_t __tmp13;
- int64_t __tmp14;
- };
- struct {
- string_t __tmp16;
- int64_t __tmp18;
- int64_t __tmp19;
- int64_t __tmp20;
- string_t __tmp21;
- int64_t __tmp22;
- string_t __tmp23;
- };
- struct {
- int64_t __tmp29;
- };
- };
- string_t __retvalue;
- } function__generic_indent;
- struct function_execname_locals {
- string_t __retvalue;
- } function_execname;
- struct function_gettimeofday_ns_locals {
- int64_t __retvalue;
- } function_gettimeofday_ns;
- struct function_gettimeofday_us_locals {
- int64_t __tmp0;
- int64_t __retvalue;
- } function_gettimeofday_us;
- struct function_probefunc_locals {
- string_t __retvalue;
- } function_probefunc;
- struct function_thread_indent_locals {
- int64_t delta;
- int64_t __tmp0;
- int64_t __tmp1;
- string_t __retvalue;
- } function_thread_indent;
- struct function_tid_locals {
- int64_t __retvalue;
- } function_tid;
- } locals [MAXNESTING+1];
- #if MAXNESTING < 0
- #error "MAXNESTING must be positive"
- #endif
- };
- static struct context *contexts[NR_CPUS] = { NULL };
- #include "alloc.c"
- #define VALUE_TYPE INT64
- #define KEY1_TYPE INT64
- #include "map-gen.c"
- #undef VALUE_TYPE
- #undef KEY1_TYPE
- #include "map.c"
- #ifdef STAP_NEED_GETTIMEOFDAY
- #include "time.c"
- #endif
- #include "probe_lock.h"
- static struct {
- MAP s__indent_counters;
- #ifdef CONFIG_PREEMPT_RT
- raw_rwlock_t s__indent_counters_lock;
- #else
- rwlock_t s__indent_counters_lock;
- #endif
- #ifdef STP_TIMING
- atomic_t s__indent_counters_lock_skip_count;
- #endif
- MAP s__indent_timestamps;
- #ifdef CONFIG_PREEMPT_RT
- raw_rwlock_t s__indent_timestamps_lock;
- #else
- rwlock_t s__indent_timestamps_lock;
- #endif
- #ifdef STP_TIMING
- atomic_t s__indent_timestamps_lock_skip_count;
- #endif
- } global = {
- #ifdef STP_TIMING
- .s__indent_counters_lock_skip_count = ATOMIC_INIT(0),
- #endif
- #ifdef STP_TIMING
- .s__indent_timestamps_lock_skip_count = ATOMIC_INIT(0),
- #endif
- };
- static void function___indent_timestamp (struct context * __restrict__ c);
- static void function__generic_indent (struct context * __restrict__ c);
- static void function_execname (struct context * __restrict__ c);
- static void function_gettimeofday_ns (struct context * __restrict__ c);
- static void function_gettimeofday_us (struct context * __restrict__ c);
- static void function_probefunc (struct context * __restrict__ c);
- static void function_thread_indent (struct context * __restrict__ c);
- static void function_tid (struct context * __restrict__ c);
- static void function___indent_timestamp (struct context* __restrict__ c) {
- __label__ out;
- struct function___indent_timestamp_locals * __restrict__ l = & c->locals[c->nesting+1].function___indent_timestamp;
- (void) l;
- #define CONTEXT c
- #define THIS l
- c->last_stmt = "identifier '__indent_timestamp' at /usr/share//systemtap/tapset/indent-default.stp:1:10";
- if (unlikely (c->nesting+1 >= MAXNESTING)) {
- c->last_error = "MAXNESTING exceeded";
- return;
- } else {
- c->nesting ++;
- }
- l->__retvalue = 0;
- #define return goto out
- l->__retvalue =
- ({
- function_gettimeofday_us (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function_gettimeofday_us.__retvalue;
- });
- c->actionremaining -= 1;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "keyword at /usr/share//systemtap/tapset/indent-default.stp:1:33";
- goto out;
- }
- goto out;
- #undef return
- out:
- if (0) goto out;
- c->nesting --;
- #undef CONTEXT
- #undef THIS
- }
- static void function__generic_indent (struct context* __restrict__ c) {
- __label__ out;
- struct function__generic_indent_locals * __restrict__ l = & c->locals[c->nesting+1].function__generic_indent;
- (void) l;
- #define CONTEXT c
- #define THIS l
- c->last_stmt = "identifier '_generic_indent' at /usr/share//systemtap/tapset/indent.stp:3:10";
- if (unlikely (c->nesting+1 >= MAXNESTING)) {
- c->last_error = "MAXNESTING exceeded";
- return;
- } else {
- c->nesting ++;
- }
- l->ts = 0;
- l->x = 0;
- l->r[0] = '\0';
- l->i = 0;
- l->__retvalue[0] = '\0';
- #define return goto out
- {
- (void)
- ({
- l->__tmp0 =
- ({
- function___indent_timestamp (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function___indent_timestamp.__retvalue;
- });
- l->ts = l->__tmp0;
- l->__tmp0;
- });
- c->actionremaining -= 2;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "keyword at /usr/share//systemtap/tapset/indent.stp:6:3";
- goto out;
- }
- if ((! (
- ({
- l->__tmp2 = l->idx;
- l->__tmp3 = _stp_map_get_ii (global.s__indent_counters, l->__tmp2);
- l->__tmp3;
- })))) {
- (void)
- ({
- l->__tmp4 = l->idx;
- l->__tmp5 = l->ts;
- c->last_stmt = "identifier '_indent_timestamps' at /usr/share//systemtap/tapset/indent.stp:6:32";
- l->__tmp6 = l->__tmp5;
- { int rc = _stp_map_set_ii (global.s__indent_timestamps, l->__tmp4, l->__tmp6); if (unlikely(rc)) { c->last_error = "Array overflow, check MAXMAPENTRIES"; goto out; }};
- l->__tmp5;
- });
- c->actionremaining -= 1;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "identifier '_indent_timestamps' at /usr/share//systemtap/tapset/indent.stp:6:32";
- goto out;
- }
- }
- (void)
- ({
- l->__tmp8 = ((
- ({
- l->__tmp10 = l->idx;
- l->__tmp11 = _stp_map_get_ii (global.s__indent_counters, l->__tmp10);
- l->__tmp11;
- })) + ((((((l->delta) > (((int64_t)0LL))))) ? (l->delta) : (((int64_t)0LL)))));
- l->x = l->__tmp8;
- l->__tmp8;
- });
- (void)
- ({
- l->__tmp12 = l->idx;
- l->__tmp13 = l->delta;
- c->last_stmt = "identifier '_indent_counters' at /usr/share//systemtap/tapset/indent.stp:10:3";
- l->__tmp14 = _stp_map_get_ii (global.s__indent_counters, l->__tmp12);
- l->__tmp14 += l->__tmp13;
- { int rc = _stp_map_set_ii (global.s__indent_counters, l->__tmp12, l->__tmp14); if (unlikely(rc)) { c->last_error = "Array overflow, check MAXMAPENTRIES"; goto out; }};
- l->__tmp14;
- });
- (void)
- ({
- strlcpy (l->__tmp16,
- ({
- l->__tmp18 = ((l->ts) - (
- ({
- l->__tmp19 = l->idx;
- l->__tmp20 = _stp_map_get_ii (global.s__indent_timestamps, l->__tmp19);
- l->__tmp20;
- })));
- strlcpy (l->__tmp21,
- ({
- function_execname (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function_execname.__retvalue;
- }), MAXSTRINGLEN);
- l->__tmp22 =
- ({
- function_tid (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function_tid.__retvalue;
- });
- _stp_snprintf (l->__tmp23, MAXSTRINGLEN, "%6lld %s(%lld):", l->__tmp18, l->__tmp21, l->__tmp22);
- l->__tmp23;
- }), MAXSTRINGLEN);
- strlcpy (l->r, l->__tmp16, MAXSTRINGLEN);
- l->__tmp16;
- });
- (void)
- ({
- l->i = ((int64_t)1LL);
- ((int64_t)1LL);
- });
- c->actionremaining -= 5;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "keyword at /usr/share//systemtap/tapset/indent.stp:14:3";
- goto out;
- }
- top_0:
- if (! ((((l->i) < (l->x))))) goto break_0;
- (void)
- ({
- strlcat (l->r, " ", MAXSTRINGLEN);
- l->r;
- });
- c->actionremaining -= 2;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "identifier 'r' at /usr/share//systemtap/tapset/indent.stp:14:23";
- goto out;
- }
- continue_0:
- (void)
- ({
- l->__tmp29 = l->i;
- l->i += 1;
- l->__tmp29;
- });
- goto top_0;
- break_0:
- ; /* dummy statement */
- strlcpy (l->__retvalue, l->r, MAXSTRINGLEN);
- c->actionremaining -= 2;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "keyword at /usr/share//systemtap/tapset/indent.stp:16:3";
- goto out;
- }
- goto out;
- }
- #undef return
- out:
- if (0) goto out;
- c->nesting --;
- #undef CONTEXT
- #undef THIS
- }
- static void function_execname (struct context* __restrict__ c) {
- __label__ out;
- struct function_execname_locals * __restrict__ l = & c->locals[c->nesting+1].function_execname;
- (void) l;
- #define CONTEXT c
- #define THIS l
- c->last_stmt = "identifier 'execname' at /usr/share//systemtap/tapset/context.stp:33:10";
- if (unlikely (c->nesting+1 >= MAXNESTING)) {
- c->last_error = "MAXNESTING exceeded";
- return;
- } else {
- c->nesting ++;
- }
- l->__retvalue[0] = '\0';
- #define return goto out
- {
- /* pure */
- strlcpy (THIS->__retvalue, current->comm, MAXSTRINGLEN);
- }
- #undef return
- out:
- if (0) goto out;
- c->nesting --;
- #undef CONTEXT
- #undef THIS
- }
- static void function_gettimeofday_ns (struct context* __restrict__ c) {
- __label__ out;
- struct function_gettimeofday_ns_locals * __restrict__ l = & c->locals[c->nesting+1].function_gettimeofday_ns;
- (void) l;
- #define CONTEXT c
- #define THIS l
- c->last_stmt = "identifier 'gettimeofday_ns' at /usr/share//systemtap/tapset/timestamp.stp:24:10";
- if (unlikely (c->nesting+1 >= MAXNESTING)) {
- c->last_error = "MAXNESTING exceeded";
- return;
- } else {
- c->nesting ++;
- }
- l->__retvalue = 0;
- #define return goto out
- {
- /* pure */
- /* NOTE: we can't use do_gettimeofday because we could be called from a
- * context where xtime_lock is already held. See bug #2525. */
- THIS->__retvalue = _stp_gettimeofday_ns();
- }
- #undef return
- out:
- if (0) goto out;
- c->nesting --;
- #undef CONTEXT
- #undef THIS
- }
- static void function_gettimeofday_us (struct context* __restrict__ c) {
- __label__ out;
- struct function_gettimeofday_us_locals * __restrict__ l = & c->locals[c->nesting+1].function_gettimeofday_us;
- (void) l;
- #define CONTEXT c
- #define THIS l
- c->last_stmt = "identifier 'gettimeofday_us' at /usr/share//systemtap/tapset/timestamp.stp:31:10";
- if (unlikely (c->nesting+1 >= MAXNESTING)) {
- c->last_error = "MAXNESTING exceeded";
- return;
- } else {
- c->nesting ++;
- }
- l->__retvalue = 0;
- #define return goto out
- l->__retvalue = ({
- l->__tmp0 =
- ({
- function_gettimeofday_ns (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function_gettimeofday_ns.__retvalue;
- });
- if (unlikely(!((int64_t)1000LL))) {
- c->last_error = "division by 0";
- c->last_stmt = "operator '/' at /usr/share//systemtap/tapset/timestamp.stp:32:28";
- goto out;
- }
- _stp_div64 (NULL, l->__tmp0, ((int64_t)1000LL));
- });
- c->actionremaining -= 1;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "keyword at /usr/share//systemtap/tapset/timestamp.stp:32:3";
- goto out;
- }
- goto out;
- #undef return
- out:
- if (0) goto out;
- c->nesting --;
- #undef CONTEXT
- #undef THIS
- }
- static void function_probefunc (struct context* __restrict__ c) {
- __label__ out;
- struct function_probefunc_locals * __restrict__ l = & c->locals[c->nesting+1].function_probefunc;
- (void) l;
- #define CONTEXT c
- #define THIS l
- c->last_stmt = "identifier 'probefunc' at /usr/share//systemtap/tapset/context.stp:92:10";
- if (unlikely (c->nesting+1 >= MAXNESTING)) {
- c->last_error = "MAXNESTING exceeded";
- return;
- } else {
- c->nesting ++;
- }
- l->__retvalue[0] = '\0';
- #define return goto out
- {
- /* pure */
- char *ptr, *start;
- start = strstr(CONTEXT->probe_point, "function(\"");
- ptr = start + 10;
- if (!start) {
- start = strstr(CONTEXT->probe_point, "inline(\"");
- ptr = start + 8;
- }
- if (start) {
- int len = MAXSTRINGLEN;
- char *dst = THIS->__retvalue;
- while (*ptr != '@' && --len > 0 && *ptr)
- *dst++ = *ptr++;
- *dst = 0;
- } else if (CONTEXT->regs &&
- #if defined (__ia64__)
- ((unsigned long)REG_IP(CONTEXT->regs) >= (unsigned long)KERNEL_START)) {
- #else
- ((unsigned long)REG_IP(CONTEXT->regs) >= (unsigned long)PAGE_OFFSET)) {
- #endif
- _stp_symbol_sprint_basic(THIS->__retvalue, MAXSTRINGLEN,
- REG_IP(CONTEXT->regs));
- if (THIS->__retvalue[0] == '.') /* powerpc symbol has a dot*/
- strlcpy(THIS->__retvalue,THIS->__retvalue + 1,MAXSTRINGLEN);
- } else {
- THIS->__retvalue[0] = '\0';
- }
- }
- #undef return
- out:
- if (0) goto out;
- c->nesting --;
- #undef CONTEXT
- #undef THIS
- }
- static void function_thread_indent (struct context* __restrict__ c) {
- __label__ out;
- struct function_thread_indent_locals * __restrict__ l = & c->locals[c->nesting+1].function_thread_indent;
- (void) l;
- #define CONTEXT c
- #define THIS l
- c->last_stmt = "identifier 'thread_indent' at /usr/share//systemtap/tapset/indent.stp:19:10";
- if (unlikely (c->nesting+1 >= MAXNESTING)) {
- c->last_error = "MAXNESTING exceeded";
- return;
- } else {
- c->nesting ++;
- }
- l->__retvalue[0] = '\0';
- #define return goto out
- strlcpy (l->__retvalue,
- ({
- l->__tmp0 =
- ({
- function_tid (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function_tid.__retvalue;
- });
- l->__tmp1 = l->delta;
- c->locals[c->nesting+1].function__generic_indent.idx = l->__tmp0;
- c->locals[c->nesting+1].function__generic_indent.delta = l->__tmp1;
- function__generic_indent (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function__generic_indent.__retvalue;
- }), MAXSTRINGLEN);
- c->actionremaining -= 1;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "keyword at /usr/share//systemtap/tapset/indent.stp:21:3";
- goto out;
- }
- goto out;
- #undef return
- out:
- if (0) goto out;
- c->nesting --;
- #undef CONTEXT
- #undef THIS
- }
- static void function_tid (struct context* __restrict__ c) {
- __label__ out;
- struct function_tid_locals * __restrict__ l = & c->locals[c->nesting+1].function_tid;
- (void) l;
- #define CONTEXT c
- #define THIS l
- c->last_stmt = "identifier 'tid' at /usr/share//systemtap/tapset/context.stp:41:10";
- if (unlikely (c->nesting+1 >= MAXNESTING)) {
- c->last_error = "MAXNESTING exceeded";
- return;
- } else {
- c->nesting ++;
- }
- l->__retvalue = 0;
- #define return goto out
- {
- /* pure */
- THIS->__retvalue = current->pid;
- }
- #undef return
- out:
- if (0) goto out;
- c->nesting --;
- #undef CONTEXT
- #undef THIS
- }
- static void probe_2962 (struct context * __restrict__ c) {
- __label__ out;
- static const struct stp_probe_lock locks[] = {
- {
- .lock = &global.s__indent_counters_lock,
- .write_p = 1,
- #ifdef STP_TIMING
- .skipped = &global.s__indent_counters_lock_skip_count,
- #endif
- },
- {
- .lock = &global.s__indent_timestamps_lock,
- .write_p = 1,
- #ifdef STP_TIMING
- .skipped = &global.s__indent_timestamps_lock_skip_count,
- #endif
- },
- };
- struct probe_2962_locals * __restrict__ l = & c->probe_locals.probe_2962;
- (void) l;
- #ifndef STP_PRIVILEGED
- #error Internal Error: Probe kernel.function("lock_sock@net/core/sock.c:1355") generated in --unprivileged mode
- #endif
- if (!stp_lock_probe(locks, ARRAY_SIZE(locks)))
- return;
- (void)
- ({
- strlcpy (l->__tmp0,
- ({
- c->locals[c->nesting+1].function_thread_indent.delta = ((int64_t)1LL);
- function_thread_indent (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function_thread_indent.__retvalue;
- }), MAXSTRINGLEN);
- strlcpy (l->__tmp2,
- ({
- function_probefunc (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function_probefunc.__retvalue;
- }), MAXSTRINGLEN);
- _stp_printf ("%s -> %s \n", l->__tmp0, l->__tmp2);
- ((int64_t)0LL);
- });
- c->actionremaining -= 1;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "identifier 'printf' at /tmp/psock.stp:10:2";
- goto out;
- }
- out:
- stp_unlock_probe(locks, ARRAY_SIZE(locks));
- _stp_print_flush();
- }
- static void probe_2963 (struct context * __restrict__ c) {
- __label__ out;
- static const struct stp_probe_lock locks[] = {
- {
- .lock = &global.s__indent_counters_lock,
- .write_p = 1,
- #ifdef STP_TIMING
- .skipped = &global.s__indent_counters_lock_skip_count,
- #endif
- },
- {
- .lock = &global.s__indent_timestamps_lock,
- .write_p = 1,
- #ifdef STP_TIMING
- .skipped = &global.s__indent_timestamps_lock_skip_count,
- #endif
- },
- };
- struct probe_2963_locals * __restrict__ l = & c->probe_locals.probe_2963;
- (void) l;
- #ifndef STP_PRIVILEGED
- #error Internal Error: Probe kernel.function("release_sock@net/core/sock.c:1367").return generated in --unprivileged mode
- #endif
- if (!stp_lock_probe(locks, ARRAY_SIZE(locks)))
- return;
- (void)
- ({
- strlcpy (l->__tmp0,
- ({
- l->__tmp1 = ((int64_t)-1LL);
- c->locals[c->nesting+1].function_thread_indent.delta = l->__tmp1;
- function_thread_indent (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function_thread_indent.__retvalue;
- }), MAXSTRINGLEN);
- strlcpy (l->__tmp2,
- ({
- function_probefunc (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function_probefunc.__retvalue;
- }), MAXSTRINGLEN);
- _stp_printf ("%s <- %s\n", l->__tmp0, l->__tmp2);
- ((int64_t)0LL);
- });
- c->actionremaining -= 1;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "identifier 'printf' at /tmp/psock.stp:15:2";
- goto out;
- }
- out:
- stp_unlock_probe(locks, ARRAY_SIZE(locks));
- _stp_print_flush();
- }
- static struct stap_probe {
- void (* const ph) (struct context*);
- #ifdef STP_ALIBI
- atomic_t alibi;
- #define STAP_PROBE_INIT_ALIBI() .alibi=ATOMIC_INIT(0),
- #else
- #define STAP_PROBE_INIT_ALIBI()
- #endif
- #ifdef STP_TIMING
- Stat timing;
- #endif
- #if defined(STP_TIMING) || defined(STP_ALIBI)
- const char location[22];
- const char derivation[66];
- #define STAP_PROBE_INIT_TIMING(L, D) .location=(L), .derivation=(D),
- #else
- #define STAP_PROBE_INIT_TIMING(L, D)
- #endif
- const char pp[64];
- #ifdef STP_NEED_PROBE_NAME
- const char pn[64];
- #define STAP_PROBE_INIT_NAME(PN) .pn=(PN),
- #else
- #define STAP_PROBE_INIT_NAME(PN)
- #endif
- #define STAP_PROBE_INIT(PH, PP, PN, L, D) { .ph=(PH), .pp=(PP), STAP_PROBE_INIT_NAME(PN) STAP_PROBE_INIT_ALIBI() STAP_PROBE_INIT_TIMING(L, D) }
- } stap_probes[] = {
- STAP_PROBE_INIT(&probe_2962, "kernel.function(\"lock_sock@net/core/sock.c:1355\")", "kernel.function(\"lock_sock@net/core/sock.c:1355\")", "/tmp/psock.stp:9:1", " from: kernel.function(\"lock_sock@net/core/sock.c\")"),
- STAP_PROBE_INIT(&probe_2963, "kernel.function(\"release_sock@net/core/sock.c:1367\").return", "kernel.function(\"release_sock@net/core/sock.c:1367\").return", "/tmp/psock.stp:14:1", " from: kernel.function(\"release_sock@net/core/sock.c\").return"),
- };
- /* ---- dwarf probes ---- */
- #if ! defined(CONFIG_KPROBES)
- #error "Need CONFIG_KPROBES!"
- #endif
- #ifndef KRETACTIVE
- #define KRETACTIVE (max(15,6*(int)num_possible_cpus()))
- #endif
- #include "kprobes-common.h"
- static int enter_kprobe_probe (struct kprobe *inst, struct pt_regs *regs);
- static int enter_kretprobe_probe (struct kretprobe_instance *inst, struct pt_regs *regs);
- #if defined(STAPCONF_UNREGISTER_KPROBES)
- static void * stap_unreg_kprobes[2];
- #endif
- static struct stap_dwarf_kprobe stap_dwarf_kprobes[2];
- static struct stap_dwarf_probe {
- const unsigned return_p:1;
- const unsigned maxactive_p:1;
- const unsigned optional_p:1;
- unsigned registered_p:1;
- const unsigned short maxactive_val;
- const unsigned short saved_longs;
- const unsigned short saved_strings;
- const char module[7];
- const char section[7];
- const unsigned long address;
- struct stap_probe * const probe;
- struct stap_probe * const entry_probe;
- } stap_dwarf_probes[] = {
- { .address=(unsigned long)0x167b53ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[0]), },
- { .return_p=1, .address=(unsigned long)0x167a9cULL, .module="kernel", .section="_stext", .probe=(&stap_probes[1]), },
- };
- static int enter_kprobe_probe (struct kprobe *inst, struct pt_regs *regs) {
- int kprobe_idx = ((uintptr_t)inst-(uintptr_t)stap_dwarf_kprobes)/sizeof(struct stap_dwarf_kprobe);
- struct stap_dwarf_probe *sdp = &stap_dwarf_probes[((kprobe_idx >= 0 && kprobe_idx < 2)?kprobe_idx:0)];
- #ifdef STP_ALIBI
- atomic_inc(&(sdp->probe->alibi));
- #else
- struct context* __restrict__ c;
- #if !INTERRUPTIBLE
- unsigned long flags;
- #endif
- #if defined(STP_TIMING) || defined(STP_OVERLOAD)
- cycles_t cycles_atstart = get_cycles ();
- #endif
- #ifdef STP_TIMING
- Stat stat = sdp->probe->timing;
- #endif
- #if INTERRUPTIBLE
- preempt_disable ();
- #else
- local_irq_save (flags);
- #endif
- if (unlikely ((((unsigned long) (& c)) & (THREAD_SIZE-1))
- < (MINSTACKSPACE + sizeof (struct thread_info)))) {
- atomic_inc (& skipped_count);
- #ifdef STP_TIMING
- atomic_inc (& skipped_count_lowstack);
- #endif
- goto probe_epilogue;
- }
- if (atomic_read (&session_state) != STAP_SESSION_RUNNING)
- goto probe_epilogue;
- c = contexts[smp_processor_id()];
- if (atomic_inc_return (& c->busy) != 1) {
- #if !INTERRUPTIBLE
- atomic_inc (& skipped_count);
- #endif
- #ifdef STP_TIMING
- atomic_inc (& skipped_count_reentrant);
- #ifdef DEBUG_REENTRANCY
- _stp_warn ("Skipped %s due to %s residency on cpu %u\n", sdp->probe->pp, c->probe_point ?: "?", smp_processor_id());
- #endif
- #endif
- atomic_dec (& c->busy);
- goto probe_epilogue;
- }
- c->last_stmt = 0;
- c->last_error = 0;
- c->nesting = -1;
- c->regs = 0;
- #if defined __ia64__
- c->unwaddr = 0;
- #endif
- c->probe_point = sdp->probe->pp;
- #ifdef STP_NEED_PROBE_NAME
- c->probe_name = sdp->probe->pn;
- #else
- c->probe_name = 0;
- #endif
- c->pi = 0;
- c->pi_longs = 0;
- c->regflags = 0;
- c->regparm = 0;
- c->marker_name = NULL;
- c->marker_format = NULL;
- #if INTERRUPTIBLE
- c->actionremaining = MAXACTION_INTERRUPTIBLE;
- #else
- c->actionremaining = MAXACTION;
- #endif
- c->ri = 0;
- c->regs = regs;
- {
- unsigned long kprobes_ip = REG_IP(c->regs);
- SET_REG_IP(regs, (unsigned long) inst->addr);
- (*sdp->probe->ph) (c);
- SET_REG_IP(regs, kprobes_ip);
- }
- #if defined(STP_TIMING) || defined(STP_OVERLOAD)
- {
- cycles_t cycles_atend = get_cycles ();
- int32_t cycles_elapsed = ((int32_t)cycles_atend > (int32_t)cycles_atstart)
- ? ((int32_t)cycles_atend - (int32_t)cycles_atstart)
- : (~(int32_t)0) - (int32_t)cycles_atstart + (int32_t)cycles_atend + 1;
- #ifdef STP_TIMING
- if (likely (stat)) _stp_stat_add(stat, cycles_elapsed);
- #endif
- #ifdef STP_OVERLOAD
- {
- cycles_t interval = (cycles_atend > c->cycles_base)
- ? (cycles_atend - c->cycles_base)
- : (STP_OVERLOAD_INTERVAL + 1);
- c->cycles_sum += cycles_elapsed;
- if (interval > STP_OVERLOAD_INTERVAL) {
- if (c->cycles_sum > STP_OVERLOAD_THRESHOLD) {
- _stp_error ("probe overhead exceeded threshold");
- atomic_set (&session_state, STAP_SESSION_ERROR);
- atomic_inc (&error_count);
- }
- c->cycles_base = cycles_atend;
- c->cycles_sum = 0;
- }
- }
- #endif
- }
- #endif
- c->probe_point = 0;
- c->probe_name = 0;
- if (unlikely (c->last_error && c->last_error[0])) {
- if (c->last_stmt != NULL)
- _stp_softerror ("%s near %s", c->last_error, c->last_stmt);
- else
- _stp_softerror ("%s", c->last_error);
- atomic_inc (& error_count);
- if (atomic_read (& error_count) > MAXERRORS) {
- atomic_set (& session_state, STAP_SESSION_ERROR);
- _stp_exit ();
- }
- }
- atomic_dec (&c->busy);
- probe_epilogue:
- if (unlikely (atomic_read (& skipped_count) > MAXSKIPPED)) {
- if (unlikely (pseudo_atomic_cmpxchg(& session_state, STAP_SESSION_RUNNING, STAP_SESSION_ERROR) == STAP_SESSION_RUNNING))
- _stp_error ("Skipped too many probes, check MAXSKIPPED or try again with stap -t for more details.");
- }
- #if INTERRUPTIBLE
- preempt_enable_no_resched ();
- #else
- local_irq_restore (flags);
- #endif
- #endif // STP_ALIBI
- return 0;
- }
- static int enter_kretprobe_common (struct kretprobe_instance *inst, struct pt_regs *regs, int entry) {
- struct kretprobe *krp = inst->rp;
- int kprobe_idx = ((uintptr_t)krp-(uintptr_t)stap_dwarf_kprobes)/sizeof(struct stap_dwarf_kprobe);
- struct stap_dwarf_probe *sdp = &stap_dwarf_probes[((kprobe_idx >= 0 && kprobe_idx < 2)?kprobe_idx:0)];
- struct stap_probe *sp = entry ? sdp->entry_probe : sdp->probe;
- if (sp) {
- #ifdef STP_ALIBI
- atomic_inc(&(sp->alibi));
- #else
- struct context* __restrict__ c;
- #if !INTERRUPTIBLE
- unsigned long flags;
- #endif
- #if defined(STP_TIMING) || defined(STP_OVERLOAD)
- cycles_t cycles_atstart = get_cycles ();
- #endif
- #ifdef STP_TIMING
- Stat stat = sp->timing;
- #endif
- #if INTERRUPTIBLE
- preempt_disable ();
- #else
- local_irq_save (flags);
- #endif
- if (unlikely ((((unsigned long) (& c)) & (THREAD_SIZE-1))
- < (MINSTACKSPACE + sizeof (struct thread_info)))) {
- atomic_inc (& skipped_count);
- #ifdef STP_TIMING
- atomic_inc (& skipped_count_lowstack);
- #endif
- goto probe_epilogue;
- }
- if (atomic_read (&session_state) != STAP_SESSION_RUNNING)
- goto probe_epilogue;
- c = contexts[smp_processor_id()];
- if (atomic_inc_return (& c->busy) != 1) {
- #if !INTERRUPTIBLE
- atomic_inc (& skipped_count);
- #endif
- #ifdef STP_TIMING
- atomic_inc (& skipped_count_reentrant);
- #ifdef DEBUG_REENTRANCY
- _stp_warn ("Skipped %s due to %s residency on cpu %u\n", sp->pp, c->probe_point ?: "?", smp_processor_id());
- #endif
- #endif
- atomic_dec (& c->busy);
- goto probe_epilogue;
- }
- c->last_stmt = 0;
- c->last_error = 0;
- c->nesting = -1;
- c->regs = 0;
- #if defined __ia64__
- c->unwaddr = 0;
- #endif
- c->probe_point = sp->pp;
- #ifdef STP_NEED_PROBE_NAME
- c->probe_name = sp->pn;
- #else
- c->probe_name = 0;
- #endif
- c->pi = 0;
- c->pi_longs = 0;
- c->regflags = 0;
- c->regparm = 0;
- c->marker_name = NULL;
- c->marker_format = NULL;
- #if INTERRUPTIBLE
- c->actionremaining = MAXACTION_INTERRUPTIBLE;
- #else
- c->actionremaining = MAXACTION;
- #endif
- c->ri = 0;
- c->regs = regs;
- c->pi = inst;
- c->pi_longs = sdp->saved_longs;
- {
- unsigned long kprobes_ip = REG_IP(c->regs);
- if (entry)
- SET_REG_IP(regs, (unsigned long) inst->rp->kp.addr);
- else
- SET_REG_IP(regs, (unsigned long)inst->ret_addr);
- (sp->ph) (c);
- SET_REG_IP(regs, kprobes_ip);
- }
- #if defined(STP_TIMING) || defined(STP_OVERLOAD)
- {
- cycles_t cycles_atend = get_cycles ();
- int32_t cycles_elapsed = ((int32_t)cycles_atend > (int32_t)cycles_atstart)
- ? ((int32_t)cycles_atend - (int32_t)cycles_atstart)
- : (~(int32_t)0) - (int32_t)cycles_atstart + (int32_t)cycles_atend + 1;
- #ifdef STP_TIMING
- if (likely (stat)) _stp_stat_add(stat, cycles_elapsed);
- #endif
- #ifdef STP_OVERLOAD
- {
- cycles_t interval = (cycles_atend > c->cycles_base)
- ? (cycles_atend - c->cycles_base)
- : (STP_OVERLOAD_INTERVAL + 1);
- c->cycles_sum += cycles_elapsed;
- if (interval > STP_OVERLOAD_INTERVAL) {
- if (c->cycles_sum > STP_OVERLOAD_THRESHOLD) {
- _stp_error ("probe overhead exceeded threshold");
- atomic_set (&session_state, STAP_SESSION_ERROR);
- atomic_inc (&error_count);
- }
- c->cycles_base = cycles_atend;
- c->cycles_sum = 0;
- }
- }
- #endif
- }
- #endif
- c->probe_point = 0;
- c->probe_name = 0;
- if (unlikely (c->last_error && c->last_error[0])) {
- if (c->last_stmt != NULL)
- _stp_softerror ("%s near %s", c->last_error, c->last_stmt);
- else
- _stp_softerror ("%s", c->last_error);
- atomic_inc (& error_count);
- if (atomic_read (& error_count) > MAXERRORS) {
- atomic_set (& session_state, STAP_SESSION_ERROR);
- _stp_exit ();
- }
- }
- atomic_dec (&c->busy);
- probe_epilogue:
- if (unlikely (atomic_read (& skipped_count) > MAXSKIPPED)) {
- if (unlikely (pseudo_atomic_cmpxchg(& session_state, STAP_SESSION_RUNNING, STAP_SESSION_ERROR) == STAP_SESSION_RUNNING))
- _stp_error ("Skipped too many probes, check MAXSKIPPED or try again with stap -t for more details.");
- }
- #if INTERRUPTIBLE
- preempt_enable_no_resched ();
- #else
- local_irq_restore (flags);
- #endif
- #endif // STP_ALIBI
- }
- return 0;
- }
- static int enter_kretprobe_probe (struct kretprobe_instance *inst, struct pt_regs *regs) {
- return enter_kretprobe_common(inst, regs, 0);
- }
- static int enter_kretprobe_entry_probe (struct kretprobe_instance *inst, struct pt_regs *regs) {
- return enter_kretprobe_common(inst, regs, 1);
- }
- #include "kprobes-common.c"
- static int systemtap_module_init (void) {
- int rc = 0;
- int cpu;
- int i=0, j=0;
- const char *probe_point = "";
- {
- const char* release = UTS_RELEASE;
- if (strcmp (release, "2.6.16.60-0.81.99.14.6d9b710-default")) {
- _stp_error ("module release mismatch (%s vs %s)", release, "2.6.16.60-0.81.99.14.6d9b710-default");
- rc = -EINVAL;
- }
- if (_stp_module_check()) rc = -EINVAL;
- }
- if (rc) goto out;
- #ifdef STAP_NEED_GETTIMEOFDAY
- rc = _stp_init_time();
- if (rc) {
- _stp_error ("couldn't initialize gettimeofday");
- goto out;
- }
- #endif
- (void) probe_point;
- (void) i;
- (void) j;
- atomic_set (&session_state, STAP_SESSION_STARTING);
- for_each_possible_cpu(cpu) {
- contexts[cpu] = _stp_kzalloc(sizeof(struct context));
- if (contexts[cpu] == NULL) {
- _stp_error ("context (size %lu) allocation failed", (unsigned long) sizeof (struct context));
- rc = -ENOMEM;
- goto out;
- }
- }
- global.s__indent_counters = _stp_map_new_ii (MAXMAPENTRIES); if (global.s__indent_counters == NULL) rc = -ENOMEM;
- if (rc) {
- _stp_error ("global variable '_indent_counters' allocation failed");
- goto out;
- }
- rwlock_init (& global.s__indent_counters_lock);
- global.s__indent_timestamps = _stp_map_new_ii (MAXMAPENTRIES); if (global.s__indent_timestamps == NULL) rc = -ENOMEM;
- if (rc) {
- _stp_error ("global variable '_indent_timestamps' allocation failed");
- goto out;
- }
- rwlock_init (& global.s__indent_timestamps_lock);
- #ifdef STP_TIMING
- for (i = 0; i < ARRAY_SIZE(stap_probes); ++i)
- stap_probes[i].timing = _stp_stat_init (HIST_NONE);
- #endif
- _stp_print_kernel_info("1.6/0.148", (num_online_cpus() * sizeof(struct context)), 2);
- for (i=0; i<2; i++) {
- struct stap_dwarf_probe *sdp = & stap_dwarf_probes[i];
- struct stap_dwarf_kprobe *kp = & stap_dwarf_kprobes[i];
- unsigned long relocated_addr = _stp_kmodule_relocate (sdp->module, sdp->section, sdp->address);
- if (relocated_addr == 0) continue;
- probe_point = sdp->probe->pp;
- if (sdp->return_p) {
- kp->u.krp.kp.addr = (void *) relocated_addr;
- if (sdp->maxactive_p) {
- kp->u.krp.maxactive = sdp->maxactive_val;
- } else {
- kp->u.krp.maxactive = KRETACTIVE;
- }
- kp->u.krp.handler = &enter_kretprobe_probe;
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
- if (sdp->entry_probe) {
- kp->u.krp.entry_handler = &enter_kretprobe_entry_probe;
- kp->u.krp.data_size = sdp->saved_longs * sizeof(int64_t) +
- sdp->saved_strings * MAXSTRINGLEN;
- }
- #endif
- #ifdef __ia64__
- kp->dummy.addr = kp->u.krp.kp.addr;
- kp->dummy.pre_handler = NULL;
- rc = register_kprobe (& kp->dummy);
- if (rc == 0) {
- rc = register_kretprobe (& kp->u.krp);
- if (rc != 0)
- unregister_kprobe (& kp->dummy);
- }
- #else
- rc = register_kretprobe (& kp->u.krp);
- #endif
- } else {
- kp->u.kp.addr = (void *) relocated_addr;
- kp->u.kp.pre_handler = &enter_kprobe_probe;
- #ifdef __ia64__
- kp->dummy.addr = kp->u.kp.addr;
- kp->dummy.pre_handler = NULL;
- rc = register_kprobe (& kp->dummy);
- if (rc == 0) {
- rc = register_kprobe (& kp->u.kp);
- if (rc != 0)
- unregister_kprobe (& kp->dummy);
- }
- #else
- rc = register_kprobe (& kp->u.kp);
- #endif
- }
- if (rc) {
- sdp->registered_p = 0;
- if (!sdp->optional_p)
- _stp_warn ("probe %s (address 0x%lx) registration error (rc %d)", probe_point, (unsigned long) relocated_addr, rc);
- rc = 0;
- }
- else sdp->registered_p = 1;
- }
- if (rc) {
- _stp_error ("probe %s registration error (rc %d)", probe_point, rc);
- atomic_set (&session_state, STAP_SESSION_ERROR);
- goto out;
- }
- if (atomic_read (&session_state) == STAP_SESSION_STARTING)
- atomic_set (&session_state, STAP_SESSION_RUNNING);
- return 0;
- out:
- _stp_map_del (global.s__indent_counters);
- _stp_map_del (global.s__indent_timestamps);
- atomic_set (&session_state, STAP_SESSION_STOPPED);
- #ifdef STAPCONF_SYNCHRONIZE_SCHED
- synchronize_sched();
- #endif
- #ifdef STAP_NEED_GETTIMEOFDAY
- _stp_kill_time();
- #endif
- for_each_possible_cpu(cpu) {
- if (contexts[cpu] != NULL) {
- _stp_kfree(contexts[cpu]);
- contexts[cpu] = NULL;
- }
- }
- return rc;
- }
- static void systemtap_module_exit (void) {
- int holdon;
- int i=0, j=0;
- int cpu;
- unsigned long hold_start;
- int hold_index;
- (void) i;
- (void) j;
- if (atomic_read (&session_state) == STAP_SESSION_STARTING)
- return;
- if (atomic_read (&session_state) == STAP_SESSION_RUNNING)
- atomic_set (&session_state, STAP_SESSION_STOPPING);
- #if defined(STAPCONF_UNREGISTER_KPROBES)
- j = 0;
- for (i=0; i<2; i++) {
- struct stap_dwarf_probe *sdp = & stap_dwarf_probes[i];
- struct stap_dwarf_kprobe *kp = & stap_dwarf_kprobes[i];
- if (! sdp->registered_p) continue;
- if (!sdp->return_p)
- stap_unreg_kprobes[j++] = &kp->u.kp;
- }
- unregister_kprobes((struct kprobe **)stap_unreg_kprobes, j);
- j = 0;
- for (i=0; i<2; i++) {
- struct stap_dwarf_probe *sdp = & stap_dwarf_probes[i];
- struct stap_dwarf_kprobe *kp = & stap_dwarf_kprobes[i];
- if (! sdp->registered_p) continue;
- if (sdp->return_p)
- stap_unreg_kprobes[j++] = &kp->u.krp;
- }
- unregister_kretprobes((struct kretprobe **)stap_unreg_kprobes, j);
- #ifdef __ia64__
- j = 0;
- for (i=0; i<2; i++) {
- struct stap_dwarf_probe *sdp = & stap_dwarf_probes[i];
- struct stap_dwarf_kprobe *kp = & stap_dwarf_kprobes[i];
- if (! sdp->registered_p) continue;
- stap_unreg_kprobes[j++] = &kp->dummy;
- }
- unregister_kprobes((struct kprobe **)stap_unreg_kprobes, j);
- #endif
- #endif
- for (i=0; i<2; i++) {
- struct stap_dwarf_probe *sdp = & stap_dwarf_probes[i];
- struct stap_dwarf_kprobe *kp = & stap_dwarf_kprobes[i];
- if (! sdp->registered_p) continue;
- if (sdp->return_p) {
- #if !defined(STAPCONF_UNREGISTER_KPROBES)
- unregister_kretprobe (&kp->u.krp);
- #endif
- atomic_add (kp->u.krp.nmissed, & skipped_count);
- #ifdef STP_TIMING
- if (kp->u.krp.nmissed)
- _stp_warn ("Skipped due to missed kretprobe/1 on '%s': %d\n", sdp->probe->pp, kp->u.krp.nmissed);
- #endif
- atomic_add (kp->u.krp.kp.nmissed, & skipped_count);
- #ifdef STP_TIMING
- if (kp->u.krp.kp.nmissed)
- _stp_warn ("Skipped due to missed kretprobe/2 on '%s': %lu\n", sdp->probe->pp, kp->u.krp.kp.nmissed);
- #endif
- } else {
- #if !defined(STAPCONF_UNREGISTER_KPROBES)
- unregister_kprobe (&kp->u.kp);
- #endif
- atomic_add (kp->u.kp.nmissed, & skipped_count);
- #ifdef STP_TIMING
- if (kp->u.kp.nmissed)
- _stp_warn ("Skipped due to missed kprobe on '%s': %lu\n", sdp->probe->pp, kp->u.kp.nmissed);
- #endif
- }
- #if !defined(STAPCONF_UNREGISTER_KPROBES) && defined(__ia64__)
- unregister_kprobe (&kp->dummy);
- #endif
- sdp->registered_p = 0;
- }
- #ifdef STAPCONF_SYNCHRONIZE_SCHED
- synchronize_sched();
- #endif
- hold_start = jiffies;
- hold_index = -1;
- do {
- int i;
- holdon = 0;
- for (i=0; i < NR_CPUS; i++)
- if (cpu_possible (i) && contexts[i] != NULL && atomic_read (& contexts[i]->busy)) {
- holdon = 1;
- if (time_after(jiffies, hold_start + HZ) && (i > hold_index)) {
- hold_index = i;
- printk(KERN_ERR "%s context[%d] stuck: %s\n", THIS_MODULE->name, i, contexts[i]->probe_point);
- }
- }
- #ifdef STAP_OVERRIDE_STUCK_CONTEXT
- if (time_after(jiffies, hold_start + HZ*10)) {
- printk(KERN_ERR "%s overriding stuck context to allow module shutdown.", THIS_MODULE->name);
- holdon = 0;
- }
- #else
- msleep (250);
- #endif
- yield ();
- } while (holdon);
- atomic_set (&session_state, STAP_SESSION_STOPPED);
- #ifdef STAPCONF_SYNCHRONIZE_SCHED
- synchronize_sched();
- #endif
- _stp_map_del (global.s__indent_counters);
- _stp_map_del (global.s__indent_timestamps);
- for_each_possible_cpu(cpu) {
- if (contexts[cpu] != NULL) {
- _stp_kfree(contexts[cpu]);
- contexts[cpu] = NULL;
- }
- }
- #if defined(STP_TIMING) || defined(STP_ALIBI)
- _stp_printf("----- probe hit report: \n");
- for (i = 0; i < ARRAY_SIZE(stap_probes); ++i) {
- struct stap_probe *const p = &stap_probes[i];
- #ifdef STP_ALIBI
- int alibi = atomic_read(&(p->alibi));
- if (alibi)
- _stp_printf ("%s, (%s), hits: %d,%s\n",
- p->pp, p->location, alibi, p->derivation);
- #endif
- #ifdef STP_TIMING
- if (likely (p->timing)) {
- struct stat_data *stats = _stp_stat_get (p->timing, 0);
- if (stats->count) {
- int64_t avg = _stp_div64 (NULL, stats->sum, stats->count);
- _stp_printf ("%s, (%s), hits: %lld, cycles: %lldmin/%lldavg/%lldmax,%s\n",
- p->pp, p->location, (long long) stats->count,
- (long long) stats->min, (long long) avg, (long long) stats->max,
- p->derivation);
- }
- _stp_stat_del (p->timing);
- }
- #endif
- }
- _stp_print_flush();
- #endif
- #ifdef STAP_NEED_GETTIMEOFDAY
- _stp_kill_time();
- #endif
- if (atomic_read (& skipped_count) || atomic_read (& error_count) || atomic_read (& skipped_count_reentrant)) {
- _stp_warn ("Number of errors: %d, skipped probes: %d\n", (int) atomic_read (& error_count), (int) atomic_read (& skipped_count));
- #ifdef STP_TIMING
- {
- int ctr;
- ctr = atomic_read (& global.s__indent_counters_lock_skip_count);
- if (ctr) _stp_warn ("Skipped due to global '%s' lock timeout: %d\n", "_indent_counters", ctr);
- ctr = atomic_read (& global.s__indent_timestamps_lock_skip_count);
- if (ctr) _stp_warn ("Skipped due to global '%s' lock timeout: %d\n", "_indent_timestamps", ctr);
- ctr = atomic_read (& skipped_count_lowstack);
- if (ctr) _stp_warn ("Skipped due to low stack: %d\n", ctr);
- ctr = atomic_read (& skipped_count_reentrant);
- if (ctr) _stp_warn ("Skipped due to reentrancy: %d\n", ctr);
- ctr = atomic_read (& skipped_count_uprobe_reg);
- if (ctr) _stp_warn ("Skipped due to uprobe register failure: %d\n", ctr);
- ctr = atomic_read (& skipped_count_uprobe_unreg);
- if (ctr) _stp_warn ("Skipped due to uprobe unregister failure: %d\n", ctr);
- }
- #endif
- _stp_print_flush();
- }
- }
- static int probe_start (void) {
- return systemtap_module_init () ? -1 : 0;
- }
- static void probe_exit (void) {
- systemtap_module_exit ();
- }
- #include "stap-symbols.h"
- MODULE_DESCRIPTION("systemtap-generated probe");
- MODULE_LICENSE("GPL");
- #undef _indent_counters
- #undef _indent_timestamps
Add Comment
Please, Sign In to add comment