Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- root@linaro-developer:~/systemtap-2.2.1/testsuite# cat .systemtap-root/cache/83/stap_83df0379e451bb1ec824cc2edc7d8b76_9733.c
- #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 "read fault [man error::fault] at 0x%p (%s)"
- #define STAP_MSG_LOC2C_02 "write fault [man error::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(2, 2)
- #endif
- #include "runtime_defines.h"
- #include "linux/perf_read.h"
- #define STP_PR_STAPUSR 0x2
- #define STP_PR_STAPSYS 0x4
- #define STP_PR_STAPDEV 0x8
- #define STP_PRIVILEGE 0x8
- int stp_required_privilege __attribute__ ((section (".stap_privilege"))) = STP_PRIVILEGE;
- #ifndef MAXNESTING
- #define MAXNESTING 2
- #endif
- #define STP_SKIP_BADVARS 0
- #define STP_PROBE_COUNT 43
- #include "runtime.h"
- #include <linux/version.h>
- #include <linux/file.h>
- #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25)
- #include <linux/fdtable.h>
- #endif
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)
- #include <linux/sched/rt.h>
- #endif
- #ifndef STAPCONF_TASK_UID
- #include <linux/cred.h>
- #endif
- #define __STP_GET_USER(t, warn) \
- do { \
- __label__ deref_fault; \
- t *_ptr = (t*) (intptr_t) STAP_ARG_addr; \
- STAP_RETVALUE = uread (_ptr); \
- if (0) { \
- deref_fault: \
- STAP_RETVALUE = 0; \
- CONTEXT->last_error = NULL; \
- if (warn) { \
- snprintf(CONTEXT->error_buffer, \
- sizeof(CONTEXT->error_buffer), \
- "user %s copy fault %p", #t, _ptr); \
- _stp_warn(CONTEXT->error_buffer); \
- } \
- } \
- } while (0)
- #define STP_GET_USER(t) __STP_GET_USER(t, 0)
- #define STP_GET_USER_WARN(t) __STP_GET_USER(t, 1)
- #define STAP_NEED_CONTEXT_TOKENIZE 1
- struct context {
- #include "common_probe_context.h"
- union {
- struct probe_2025_locals {
- string_t __tmp0;
- string_t __tmp1;
- int64_t __tmp3;
- int64_t __tmp4;
- } probe_2025;
- struct probe_2066_locals {
- int64_t l_num_to_do;
- string_t l_n;
- string_t l_f;
- union {
- struct {
- struct map_node *__tmp4;
- union {
- struct {
- string_t __tmp5;
- string_t __tmp6;
- int64_t __tmp7;
- };
- struct {
- int64_t __tmp10;
- };
- };
- };
- struct {
- int64_t __tmp12;
- };
- };
- } probe_2066;
- struct probe_2067_locals {
- } probe_2067;
- } probe_locals;
- union {
- struct function_addr_locals {
- int64_t __retvalue;
- } function_addr;
- struct function_execname_locals {
- string_t __retvalue;
- } function_execname;
- struct function_exit_locals {
- /* no return value */
- } function_exit;
- struct function_probefunc_locals {
- int64_t __tmp0;
- int64_t __tmp1;
- string_t __retvalue;
- } function_probefunc;
- struct function_symname_locals {
- int64_t l_addr;
- string_t __retvalue;
- } function_symname;
- struct function_uaddr_locals {
- int64_t __retvalue;
- } function_uaddr;
- struct function_user_mode_locals {
- int64_t __retvalue;
- } function_user_mode;
- struct function_usymname_locals {
- int64_t l_addr;
- string_t __retvalue;
- } function_usymname;
- } locals [MAXNESTING+1];
- #if MAXNESTING < 0
- #error "MAXNESTING must be positive"
- #endif
- #ifndef STP_LEGACY_PRINT
- union {
- struct stp_printf_2_locals {
- const char* arg0;
- const char* arg1;
- int64_t arg2;
- } stp_printf_2;
- } printf_locals;
- #endif // STP_LEGACY_PRINT
- };
- #include "runtime_context.h"
- #include "alloc.c"
- #define VALUE_TYPE INT64
- #define KEY1_TYPE STRING
- #define KEY2_TYPE STRING
- #include "map-gen.c"
- #undef MAP_DO_PMAP
- #undef VALUE_TYPE
- #undef KEY1_TYPE
- #undef KEY2_TYPE
- #include "map.c"
- #ifndef STP_LEGACY_PRINT
- static void stp_printf_2 (struct context* __restrict__ c) {
- struct stp_printf_2_locals * __restrict__ l = & c->printf_locals.stp_printf_2;
- char *str = NULL, *end = NULL;
- const char *src;
- int width;
- int precision;
- unsigned long ptr_value;
- int num_bytes;
- (void) width;
- (void) precision;
- (void) ptr_value;
- (void) num_bytes;
- num_bytes = 0;
- width = -1;
- precision = -1;
- num_bytes += _stp_vsprint_memory_size(l->arg0, width, precision, 's', 0);
- num_bytes += sizeof(" called ") - 1;
- width = -1;
- precision = -1;
- num_bytes += _stp_vsprint_memory_size(l->arg1, width, precision, 's', 0);
- num_bytes += sizeof("\t") - 1;
- width = -1;
- precision = -1;
- num_bytes += number_size(l->arg2, 10, width, precision, 2);
- num_bytes += sizeof(" times\n") - 1;
- num_bytes = clamp(num_bytes, 0, STP_BUFFER_SIZE);
- str = (char*)_stp_reserve_bytes(num_bytes);
- end = str ? str + num_bytes - 1 : 0;
- if (str && str <= end) {
- width = -1;
- precision = -1;
- str = _stp_vsprint_memory(str, end, l->arg0, width, precision, 's', 0);
- src = " called ";
- while (*src && str <= end)
- *str++ = *src++;
- width = -1;
- precision = -1;
- str = _stp_vsprint_memory(str, end, l->arg1, width, precision, 's', 0);
- src = "\t";
- while (*src && str <= end)
- *str++ = *src++;
- width = -1;
- precision = -1;
- str = number(str, end, l->arg2, 10, width, precision, 2);
- src = " times\n";
- while (*src && str <= end)
- *str++ = *src++;
- }
- }
- #endif // STP_LEGACY_PRINT
- struct stp_globals {
- MAP s_called;
- rwlock_t s_called_lock;
- #ifdef STP_TIMING
- atomic_t s_called_lock_skip_count;
- #endif
- int64_t s_num_polls;
- rwlock_t s_num_polls_lock;
- #ifdef STP_TIMING
- atomic_t s_num_polls_lock_skip_count;
- #endif
- };
- static struct stp_globals stp_global = {
- };
- #include "common_session_state.h"
- #include "probe_lock.h"
- #ifdef STAP_NEED_GETTIMEOFDAY
- #include "time.c"
- #endif
- static void function_addr (struct context * __restrict__ c);
- static void function_execname (struct context * __restrict__ c);
- static void function_exit (struct context * __restrict__ c);
- static void function_probefunc (struct context * __restrict__ c);
- static void function_symname (struct context * __restrict__ c);
- static void function_uaddr (struct context * __restrict__ c);
- static void function_user_mode (struct context * __restrict__ c);
- static void function_usymname (struct context * __restrict__ c);
- static void function_addr (struct context* __restrict__ c) {
- __label__ out;
- struct function_addr_locals * __restrict__ l = & c->locals[c->nesting+1].function_addr;
- (void) l;
- #define CONTEXT c
- #define THIS l
- #define STAP_RETVALUE THIS->__retvalue
- c->last_stmt = "identifier 'addr' at /usr/local/share/systemtap/tapset/linux/context.stp:354:10";
- if (unlikely (c->nesting+1 >= MAXNESTING)) {
- c->last_error = "MAXNESTING exceeded";
- return;
- } else {
- c->nesting ++;
- }
- l->__retvalue = 0;
- #define return goto out
- {
- /* pure */
- if (CONTEXT->user_mode_p) {
- STAP_RETVALUE = (intptr_t)(CONTEXT->uregs ? REG_IP(CONTEXT->uregs) : 0);
- } else {
- STAP_RETVALUE = (intptr_t)(CONTEXT->kregs ? REG_IP(CONTEXT->kregs) : 0);
- }
- }
- #undef return
- out:
- if (0) goto out;
- c->nesting --;
- #undef CONTEXT
- #undef THIS
- #undef STAP_RETVALUE
- }
- 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
- #define STAP_RETVALUE THIS->__retvalue
- c->last_stmt = "identifier 'execname' at /usr/local/share/systemtap/tapset/linux/context.stp:17: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 */ /* unprivileged */
- strlcpy (STAP_RETVALUE, current->comm, MAXSTRINGLEN);
- }
- #undef return
- out:
- if (0) goto out;
- c->nesting --;
- #undef CONTEXT
- #undef THIS
- #undef STAP_RETVALUE
- }
- static void function_exit (struct context* __restrict__ c) {
- __label__ out;
- struct function_exit_locals * __restrict__ l = & c->locals[c->nesting+1].function_exit;
- (void) l;
- #define CONTEXT c
- #define THIS l
- c->last_stmt = "identifier 'exit' at /usr/local/share/systemtap/tapset/logging.stp:49:10";
- if (unlikely (c->nesting+1 >= MAXNESTING)) {
- c->last_error = "MAXNESTING exceeded";
- return;
- } else {
- c->nesting ++;
- }
- #define return goto out
- {
- /* unprivileged */
- atomic_set (session_state(), STAP_SESSION_STOPPING);
- _stp_exit ();
- }
- #undef return
- out:
- if (0) goto out;
- c->nesting --;
- #undef CONTEXT
- #undef THIS
- #undef STAP_RETVALUE
- }
- 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
- #define STAP_RETVALUE THIS->__retvalue
- c->last_stmt = "identifier 'probefunc' at /usr/local/share/systemtap/tapset/linux/context-symbols.stp:99: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, ((
- ({
- function_user_mode (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function_user_mode.__retvalue;
- })) ? (
- ({
- l->__tmp0 =
- ({
- function_uaddr (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function_uaddr.__retvalue;
- });
- c->locals[c->nesting+1].function_usymname.l_addr = l->__tmp0;
- function_usymname (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function_usymname.__retvalue;
- })) : (
- ({
- l->__tmp1 =
- ({
- function_addr (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function_addr.__retvalue;
- });
- c->locals[c->nesting+1].function_symname.l_addr = l->__tmp1;
- function_symname (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function_symname.__retvalue;
- }))), MAXSTRINGLEN);
- c->actionremaining -= 1;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "keyword at /usr/local/share/systemtap/tapset/linux/context-symbols.stp:133:5";
- goto out;
- }
- goto out;
- #undef return
- out:
- if (0) goto out;
- c->nesting --;
- #undef CONTEXT
- #undef THIS
- #undef STAP_RETVALUE
- }
- static void function_symname (struct context* __restrict__ c) {
- __label__ out;
- struct function_symname_locals * __restrict__ l = & c->locals[c->nesting+1].function_symname;
- (void) l;
- #define CONTEXT c
- #define THIS l
- #define STAP_ARG_addr THIS->l_addr
- #define STAP_RETVALUE THIS->__retvalue
- c->last_stmt = "identifier 'symname' at /usr/local/share/systemtap/tapset/linux/context-symbols.stp:225: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 */ /* pragma:symbols */
- _stp_snprint_addr(STAP_RETVALUE, MAXSTRINGLEN, STAP_ARG_addr,
- _STP_SYM_SYMBOL, NULL);
- }
- #undef return
- out:
- if (0) goto out;
- c->nesting --;
- #undef CONTEXT
- #undef THIS
- #undef STAP_ARG_addr
- #undef STAP_RETVALUE
- }
- static void function_uaddr (struct context* __restrict__ c) {
- __label__ out;
- struct function_uaddr_locals * __restrict__ l = & c->locals[c->nesting+1].function_uaddr;
- (void) l;
- #define CONTEXT c
- #define THIS l
- #define STAP_RETVALUE THIS->__retvalue
- c->last_stmt = "identifier 'uaddr' at /usr/local/share/systemtap/tapset/linux/context.stp:373:10";
- if (unlikely (c->nesting+1 >= MAXNESTING)) {
- c->last_error = "MAXNESTING exceeded";
- return;
- } else {
- c->nesting ++;
- }
- l->__retvalue = 0;
- #define return goto out
- assert_is_myproc();
- {
- /* pure */ /* myproc-unprivileged */
- struct pt_regs *uregs;
- if (CONTEXT->user_mode_p)
- uregs = CONTEXT->uregs;
- else
- uregs = _stp_current_pt_regs();
- if (uregs)
- STAP_RETVALUE = (int64_t) REG_IP(uregs);
- else
- STAP_RETVALUE = 0;
- }
- #undef return
- out:
- if (0) goto out;
- c->nesting --;
- #undef CONTEXT
- #undef THIS
- #undef STAP_RETVALUE
- }
- static void function_user_mode (struct context* __restrict__ c) {
- __label__ out;
- struct function_user_mode_locals * __restrict__ l = & c->locals[c->nesting+1].function_user_mode;
- (void) l;
- #define CONTEXT c
- #define THIS l
- #define STAP_RETVALUE THIS->__retvalue
- c->last_stmt = "identifier 'user_mode' at /usr/local/share/systemtap/tapset/linux/context.stp:218:10";
- if (unlikely (c->nesting+1 >= MAXNESTING)) {
- c->last_error = "MAXNESTING exceeded";
- return;
- } else {
- c->nesting ++;
- }
- l->__retvalue = 0;
- #define return goto out
- {
- /* pure */ /* unprivileged */
- STAP_RETVALUE = CONTEXT->user_mode_p ? 1 : 0;
- }
- #undef return
- out:
- if (0) goto out;
- c->nesting --;
- #undef CONTEXT
- #undef THIS
- #undef STAP_RETVALUE
- }
- static void function_usymname (struct context* __restrict__ c) {
- __label__ out;
- struct function_usymname_locals * __restrict__ l = & c->locals[c->nesting+1].function_usymname;
- (void) l;
- #define CONTEXT c
- #define THIS l
- #define STAP_ARG_addr THIS->l_addr
- #define STAP_RETVALUE THIS->__retvalue
- c->last_stmt = "identifier 'usymname' at /usr/local/share/systemtap/tapset/linux/ucontext-symbols.stp:57:10";
- if (unlikely (c->nesting+1 >= MAXNESTING)) {
- c->last_error = "MAXNESTING exceeded";
- return;
- } else {
- c->nesting ++;
- }
- l->__retvalue[0] = '\0';
- #define return goto out
- assert_is_myproc();
- {
- /* pure */ /* myproc-unprivileged */ /* pragma:vma */ /* pragma:symbols */
- _stp_snprint_addr(STAP_RETVALUE, MAXSTRINGLEN, STAP_ARG_addr,
- _STP_SYM_SYMBOL, current);
- }
- #undef return
- out:
- if (0) goto out;
- c->nesting --;
- #undef CONTEXT
- #undef THIS
- #undef STAP_ARG_addr
- #undef STAP_RETVALUE
- }
- static void probe_2025 (struct context * __restrict__ c) {
- __label__ out;
- static const struct stp_probe_lock locks[] = {
- {
- .lock = global_lock(s_called),
- .write_p = 1,
- #ifdef STP_TIMING
- .skipped = global_skipped(s_called),
- #endif
- },
- };
- struct probe_2025_locals * __restrict__ l = & c->probe_locals.probe_2025;
- (void) l;
- #if ! STP_PRIVILEGE_CONTAINS (STP_PRIVILEGE, STP_PR_STAPDEV) && \
- ! STP_PRIVILEGE_CONTAINS (STP_PRIVILEGE, STP_PR_STAPSYS)
- #error Internal Error: Probe kernel.function("vfs_truncate@fs/open.c:65").call generated in --unprivileged mode
- #endif
- if (!stp_lock_probe(locks, ARRAY_SIZE(locks)))
- return;
- (void)
- ({
- strlcpy (l->__tmp0,
- ({
- function_execname (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function_execname.__retvalue;
- }), MAXSTRINGLEN);
- strlcpy (l->__tmp1,
- ({
- function_probefunc (c);
- if (unlikely(c->last_error)) goto out;
- c->locals[c->nesting+1].function_probefunc.__retvalue;
- }), MAXSTRINGLEN);
- c->last_stmt = "identifier 'called' at ./systemtap.base/poll_map.stp:9:2";
- l->__tmp3 = _stp_map_get_ssi (global(s_called), l->__tmp0, l->__tmp1);
- l->__tmp4 = l->__tmp3;
- l->__tmp3 += 1;
- { int rc = _stp_map_set_ssi (global(s_called), l->__tmp0, l->__tmp1, l->__tmp3); if (unlikely(rc)) { c->last_error = "Array overflow, check MAXMAPENTRIES"; goto out; }};
- l->__tmp4;
- });
- c->actionremaining -= 1;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "identifier 'called' at ./systemtap.base/poll_map.stp:9:2";
- goto out;
- }
- out:
- stp_unlock_probe(locks, ARRAY_SIZE(locks));
- _stp_print_flush();
- }
- static void probe_2066 (struct context * __restrict__ c) {
- __label__ out;
- static const struct stp_probe_lock locks[] = {
- {
- .lock = global_lock(s_called),
- .write_p = 1,
- #ifdef STP_TIMING
- .skipped = global_skipped(s_called),
- #endif
- },
- {
- .lock = global_lock(s_num_polls),
- .write_p = 1,
- #ifdef STP_TIMING
- .skipped = global_skipped(s_num_polls),
- #endif
- },
- };
- struct probe_2066_locals * __restrict__ l = & c->probe_locals.probe_2066;
- (void) l;
- if (!stp_lock_probe(locks, ARRAY_SIZE(locks)))
- return;
- l->l_num_to_do = 0;
- l->l_n[0] = '\0';
- l->l_f[0] = '\0';
- {
- (void)
- ({
- _stp_print ("\n\n");
- });
- (void)
- ({
- l->l_num_to_do = ((int64_t)10LL);
- ((int64_t)10LL);
- });
- _stp_map_sort_ssi (global(s_called), 0, 1);
- l->__tmp4 = _stp_map_start (global(s_called));
- c->actionremaining -= 3;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "keyword at ./systemtap.base/poll_map.stp:16:2";
- goto out;
- }
- top_0:
- if (! (l->__tmp4)) goto break_0;
- {
- strlcpy (l->l_n, (_stp_map_key_get_str_ssi (l->__tmp4, 1) ?: ""), MAXSTRINGLEN);
- strlcpy (l->l_f, (_stp_map_key_get_str_ssi (l->__tmp4, 2) ?: ""), MAXSTRINGLEN);
- {
- (void)
- ({
- strlcpy (l->__tmp5, l->l_n, MAXSTRINGLEN);
- strlcpy (l->__tmp6, l->l_f, MAXSTRINGLEN);
- l->__tmp7 = _stp_map_get_int64_ssi (l->__tmp4);
- #ifndef STP_LEGACY_PRINT
- c->printf_locals.stp_printf_2.arg0 = l->__tmp5;
- c->printf_locals.stp_printf_2.arg1 = l->__tmp6;
- c->printf_locals.stp_printf_2.arg2 = l->__tmp7;
- stp_printf_2 (c);
- #else // STP_LEGACY_PRINT
- _stp_printf ("%s called %s\t%lld times\n", l->__tmp5, l->__tmp6, l->__tmp7);
- #endif // STP_LEGACY_PRINT
- if (unlikely(c->last_error)) goto out;
- ((int64_t)0LL);
- });
- (void)
- ({
- l->__tmp10 = l->l_num_to_do;
- l->l_num_to_do -= 1;
- l->__tmp10;
- });
- c->actionremaining -= 4;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "keyword at ./systemtap.base/poll_map.stp:19:3";
- goto out;
- }
- if ((((l->l_num_to_do) <= (((int64_t)0LL))))) {
- c->actionremaining -= 1;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "keyword at ./systemtap.base/poll_map.stp:20:4";
- goto out;
- }
- goto break_0;
- }
- }
- }
- continue_0:
- l->__tmp4 = _stp_map_iter (global(s_called), l->__tmp4);
- goto top_0;
- break_0:
- ; /* dummy statement */
- _stp_map_clear (global(s_called));
- (void)
- ({
- l->__tmp12 = global(s_num_polls);
- global(s_num_polls) += 1;
- l->__tmp12;
- });
- c->actionremaining -= 3;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "keyword at ./systemtap.base/poll_map.stp:24:2";
- goto out;
- }
- if ((((global(s_num_polls)) > (((int64_t)30LL))))) {
- (void)
- ({
- function_exit (c);
- if (unlikely(c->last_error)) goto out;
- (void) 0;
- });
- c->actionremaining -= 1;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "identifier 'exit' at ./systemtap.base/poll_map.stp:25:3";
- goto out;
- }
- }
- }
- out:
- stp_unlock_probe(locks, ARRAY_SIZE(locks));
- _stp_print_flush();
- }
- static void probe_2067 (struct context * __restrict__ c) {
- __label__ out;
- struct probe_2067_locals * __restrict__ l = & c->probe_locals.probe_2067;
- (void) l;
- c->actionremaining -= 1;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "keyword at ./systemtap.base/poll_map.stp:29:2";
- goto out;
- }
- if ((((global(s_num_polls)) <= (((int64_t)30LL))))) {
- (void)
- ({
- _stp_print ("FAIL\n");
- });
- c->actionremaining -= 1;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "identifier 'print' at ./systemtap.base/poll_map.stp:30:3";
- goto out;
- }
- }
- else {
- (void)
- ({
- _stp_print ("SUCCESS\n");
- });
- c->actionremaining -= 1;
- if (unlikely (c->actionremaining <= 0)) {
- c->last_error = "MAXACTION exceeded";
- c->last_stmt = "identifier 'print' at ./systemtap.base/poll_map.stp:32:3";
- goto out;
- }
- }
- out:
- _stp_print_flush();
- }
- struct stap_probe {
- size_t index;
- void (* const ph) (struct context*);
- #if defined(STP_TIMING) || defined(STP_ALIBI)
- const char location[37];
- const char derivation[41];
- #define STAP_PROBE_INIT_TIMING(L, D) .location=(L), .derivation=(D),
- #else
- #define STAP_PROBE_INIT_TIMING(L, D)
- #endif
- const char * const pp;
- #ifdef STP_NEED_PROBE_NAME
- const char * const pn;
- #define STAP_PROBE_INIT_NAME(PN) .pn=(PN),
- #else
- #define STAP_PROBE_INIT_NAME(PN)
- #endif
- #define STAP_PROBE_INIT(I, PH, PP, PN, L, D) { .index=(I), .ph=(PH), .pp=(PP), STAP_PROBE_INIT_NAME(PN) STAP_PROBE_INIT_TIMING(L, D) }
- } static const stap_probes[] = {
- STAP_PROBE_INIT(0, &probe_2025, "kernel.function(\"vfs_truncate@fs/open.c:65\").call", "kernel.function(\"vfs_truncate@fs/open.c:65\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(1, &probe_2025, "kernel.function(\"vfs_readv@fs/read_write.c:779\").call", "kernel.function(\"vfs_readv@fs/read_write.c:779\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(2, &probe_2025, "kernel.function(\"vfs_write@fs/read_write.c:459\").call", "kernel.function(\"vfs_write@fs/read_write.c:459\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(3, &probe_2025, "kernel.function(\"vfs_setpos@fs/read_write.c:56\").call", "kernel.function(\"vfs_setpos@fs/read_write.c:56\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(4, &probe_2025, "kernel.function(\"vfs_read@fs/read_write.c:382\").call", "kernel.function(\"vfs_read@fs/read_write.c:382\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(5, &probe_2025, "kernel.function(\"vfs_llseek@fs/read_write.c:254\").call", "kernel.function(\"vfs_llseek@fs/read_write.c:254\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(6, &probe_2025, "kernel.function(\"vfs_writev@fs/read_write.c:792\").call", "kernel.function(\"vfs_writev@fs/read_write.c:792\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(7, &probe_2025, "kernel.function(\"vfs_stat@fs/stat.c:102\").call", "kernel.function(\"vfs_stat@fs/stat.c:102\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(8, &probe_2025, "kernel.function(\"vfs_lstat@fs/stat.c:108\").call", "kernel.function(\"vfs_lstat@fs/stat.c:108\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(9, &probe_2025, "kernel.function(\"vfs_getattr@fs/stat.c:40\").call", "kernel.function(\"vfs_getattr@fs/stat.c:40\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(10, &probe_2025, "kernel.function(\"vfs_fstatat@fs/stat.c:71\").call", "kernel.function(\"vfs_fstatat@fs/stat.c:71\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(11, &probe_2025, "kernel.function(\"vfs_fstat@fs/stat.c:58\").call", "kernel.function(\"vfs_fstat@fs/stat.c:58\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(12, &probe_2025, "kernel.function(\"vfs_mknod@fs/namei.c:3165\").call", "kernel.function(\"vfs_mknod@fs/namei.c:3165\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(13, &probe_2025, "kernel.function(\"vfs_symlink@fs/namei.c:3548\").call", "kernel.function(\"vfs_symlink@fs/namei.c:3548\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(14, &probe_2025, "kernel.function(\"vfs_readlink@fs/namei.c:3984\").call", "kernel.function(\"vfs_readlink@fs/namei.c:3984\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(15, &probe_2025, "kernel.function(\"vfs_link@fs/namei.c:3604\").call", "kernel.function(\"vfs_link@fs/namei.c:3604\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(16, &probe_2025, "kernel.function(\"vfs_rmdir@fs/namei.c:3335\").call", "kernel.function(\"vfs_rmdir@fs/namei.c:3335\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(17, &probe_2025, "kernel.function(\"vfs_follow_link@fs/namei.c:4023\").call", "kernel.function(\"vfs_follow_link@fs/namei.c:4023\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(18, &probe_2025, "kernel.function(\"vfs_rename@fs/namei.c:3834\").call", "kernel.function(\"vfs_rename@fs/namei.c:3834\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(19, &probe_2025, "kernel.function(\"vfs_create@fs/namei.c:2314\").call", "kernel.function(\"vfs_create@fs/namei.c:2314\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(20, &probe_2025, "kernel.function(\"vfs_path_lookup@fs/namei.c:2057\").call", "kernel.function(\"vfs_path_lookup@fs/namei.c:2057\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(21, &probe_2025, "kernel.function(\"vfs_path_lookup@fs/namei.c:2057\").call", "kernel.function(\"vfs_path_lookup@fs/namei.c:2057\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(22, &probe_2025, "kernel.function(\"vfs_mkdir@fs/namei.c:3256\").call", "kernel.function(\"vfs_mkdir@fs/namei.c:3256\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(23, &probe_2025, "kernel.function(\"vfs_unlink@fs/namei.c:3434\").call", "kernel.function(\"vfs_unlink@fs/namei.c:3434\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(24, &probe_2025, "kernel.function(\"vfs_caches_init@fs/dcache.c:3065\").call", "kernel.function(\"vfs_caches_init@fs/dcache.c:3065\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(25, &probe_2025, "kernel.function(\"vfs_caches_init_early@fs/dcache.c:3059\").call", "kernel.function(\"vfs_caches_init_early@fs/dcache.c:3059\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(26, &probe_2025, "kernel.function(\"vfs_kern_mount@fs/namespace.c:775\").call", "kernel.function(\"vfs_kern_mount@fs/namespace.c:775\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(27, &probe_2025, "kernel.function(\"vfs_setxattr@fs/xattr.c:122\").call", "kernel.function(\"vfs_setxattr@fs/xattr.c:122\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(28, &probe_2025, "kernel.function(\"vfs_listxattr@fs/xattr.c:267\").call", "kernel.function(\"vfs_listxattr@fs/xattr.c:267\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(29, &probe_2025, "kernel.function(\"vfs_xattr_cmp@fs/xattr.c:212\").call", "kernel.function(\"vfs_xattr_cmp@fs/xattr.c:212\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(30, &probe_2025, "kernel.function(\"vfs_getxattr@fs/xattr.c:231\").call", "kernel.function(\"vfs_getxattr@fs/xattr.c:231\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(31, &probe_2025, "kernel.function(\"vfs_removexattr@fs/xattr.c:287\").call", "kernel.function(\"vfs_removexattr@fs/xattr.c:287\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(32, &probe_2025, "kernel.function(\"vfs_getxattr_alloc@fs/xattr.c:181\").call", "kernel.function(\"vfs_getxattr_alloc@fs/xattr.c:181\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(33, &probe_2025, "kernel.function(\"vfs_fsync@fs/sync.c:194\").call", "kernel.function(\"vfs_fsync@fs/sync.c:194\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(34, &probe_2025, "kernel.function(\"vfs_fsync_range@fs/sync.c:178\").call", "kernel.function(\"vfs_fsync_range@fs/sync.c:178\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(35, &probe_2025, "kernel.function(\"vfs_statfs@fs/statfs.c:66\").call", "kernel.function(\"vfs_statfs@fs/statfs.c:66\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(36, &probe_2025, "kernel.function(\"vfs_ustat@fs/statfs.c:216\").call", "kernel.function(\"vfs_ustat@fs/statfs.c:216\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(37, &probe_2025, "kernel.function(\"vfs_setlease@fs/locks.c:1615\").call", "kernel.function(\"vfs_setlease@fs/locks.c:1615\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(38, &probe_2025, "kernel.function(\"vfs_lock_file@fs/locks.c:1910\").call", "kernel.function(\"vfs_lock_file@fs/locks.c:1910\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(39, &probe_2025, "kernel.function(\"vfs_cancel_lock@fs/locks.c:2247\").call", "kernel.function(\"vfs_cancel_lock@fs/locks.c:2247\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(40, &probe_2025, "kernel.function(\"vfs_test_lock@fs/locks.c:1798\").call", "kernel.function(\"vfs_test_lock@fs/locks.c:1798\").call", "./systemtap.base/poll_map.stp:8:1", " from: kernel.function(\"vfs_*\").call"),
- STAP_PROBE_INIT(41, &probe_2066, "timer.ms(100)", "timer.ms(100)", "./systemtap.base/poll_map.stp:12:1", " from: timer.ms(100)"),
- STAP_PROBE_INIT(42, &probe_2067, "end", "end", "./systemtap.base/poll_map.stp:28:1", " from: end"),
- };
- /* ---- begin/end/error probes ---- */
- static struct stap_be_probe {
- const struct stap_probe * const probe;
- int state, type;
- } stap_be_probes[] = {
- { .probe=(&stap_probes[42]), .state=STAP_SESSION_STOPPING, .type=1 },
- };
- static void enter_be_probe (struct stap_be_probe *stp) {
- #ifdef STP_ALIBI
- atomic_inc(probe_alibi(stp->probe->index));
- #else
- struct context* __restrict__ c;
- #if !INTERRUPTIBLE
- unsigned long flags;
- #endif
- #ifdef STP_TIMING
- Stat stat = probe_timing(stp->probe->index);
- #endif
- #ifdef STP_TIMING
- cycles_t cycles_atstart = get_cycles ();
- #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()) != stp->state)
- goto probe_epilogue;
- c = _stp_runtime_entryfn_get_context();
- 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", stp->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->uregs = 0;
- c->kregs = 0;
- #if defined __ia64__
- c->unwaddr = 0;
- #endif
- c->probe_point = stp->probe->pp;
- #ifdef STP_NEED_PROBE_NAME
- c->probe_name = stp->probe->pn;
- #endif
- c->probe_type = stp_probe_type_been;
- memset(&c->ips, 0, sizeof(c->ips));
- c->user_mode_p = 0; c->full_uregs_p = 0;
- #ifdef STAP_NEED_REGPARM
- c->regparm = 0;
- #endif
- #if INTERRUPTIBLE
- c->actionremaining = MAXACTION_INTERRUPTIBLE;
- #else
- c->actionremaining = MAXACTION;
- #endif
- #if defined(STP_NEED_UNWIND_DATA)
- c->uwcache_user.state = uwcache_uninitialized;
- c->uwcache_kernel.state = uwcache_uninitialized;
- #endif
- (*stp->probe->ph) (c);
- #ifdef STP_TIMING
- {
- 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
- }
- #endif
- c->probe_point = 0;
- #ifdef STP_NEED_PROBE_NAME
- c->probe_name = 0;
- #endif
- c->probe_type = 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:
- _stp_runtime_entryfn_put_context();
- 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
- }
- /* ---- dwarf probes ---- */
- #if ! defined(CONFIG_KPROBES)
- #error "Need CONFIG_KPROBES!"
- #endif
- #ifndef KRETACTIVE
- #define KRETACTIVE (max(15,6*(int)num_possible_cpus()))
- #endif
- #include "linux/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[41];
- #endif
- static struct stap_dwarf_kprobe stap_dwarf_kprobes[41];
- 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;
- const struct stap_probe * const probe;
- const struct stap_probe * const entry_probe;
- } stap_dwarf_probes[] = {
- { .address=(unsigned long)0xf22ecULL, .module="kernel", .section="_stext", .probe=(&stap_probes[0]), },
- { .address=(unsigned long)0xf4a2cULL, .module="kernel", .section="_stext", .probe=(&stap_probes[1]), },
- { .address=(unsigned long)0xf4004ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[2]), },
- { .address=(unsigned long)0xf3348ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[3]), },
- { .address=(unsigned long)0xf419cULL, .module="kernel", .section="_stext", .probe=(&stap_probes[4]), },
- { .address=(unsigned long)0xf33f4ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[5]), },
- { .address=(unsigned long)0xf49acULL, .module="kernel", .section="_stext", .probe=(&stap_probes[6]), },
- { .address=(unsigned long)0xf8860ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[7]), },
- { .address=(unsigned long)0xf8834ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[8]), },
- { .address=(unsigned long)0xf86dcULL, .module="kernel", .section="_stext", .probe=(&stap_probes[9]), },
- { .address=(unsigned long)0xf8790ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[10]), },
- { .address=(unsigned long)0xf872cULL, .module="kernel", .section="_stext", .probe=(&stap_probes[11]), },
- { .address=(unsigned long)0xff378ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[12]), },
- { .address=(unsigned long)0xfe7c8ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[13]), },
- { .address=(unsigned long)0xfdc44ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[14]), },
- { .address=(unsigned long)0xff1d0ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[15]), },
- { .address=(unsigned long)0x100718ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[16]), },
- { .address=(unsigned long)0xff0fcULL, .module="kernel", .section="_stext", .probe=(&stap_probes[17]), },
- { .address=(unsigned long)0x100980ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[18]), },
- { .address=(unsigned long)0xfe624ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[19]), },
- { .address=(unsigned long)0x448460ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[20]), },
- { .address=(unsigned long)0x10029cULL, .module="kernel", .section="_stext", .probe=(&stap_probes[21]), },
- { .address=(unsigned long)0xfe6e8ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[22]), },
- { .address=(unsigned long)0x100478ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[23]), },
- { .address=(unsigned long)0x654778ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[24]), },
- { .address=(unsigned long)0x6546d0ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[25]), },
- { .address=(unsigned long)0x11035cULL, .module="kernel", .section="_stext", .probe=(&stap_probes[26]), },
- { .address=(unsigned long)0x115910ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[27]), },
- { .address=(unsigned long)0x114f70ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[28]), },
- { .address=(unsigned long)0x115c40ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[29]), },
- { .address=(unsigned long)0x1154f0ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[30]), },
- { .address=(unsigned long)0x1156d4ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[31]), },
- { .address=(unsigned long)0x115b4cULL, .module="kernel", .section="_stext", .probe=(&stap_probes[32]), },
- { .address=(unsigned long)0x11f7b0ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[33]), },
- { .address=(unsigned long)0x11f75cULL, .module="kernel", .section="_stext", .probe=(&stap_probes[34]), },
- { .address=(unsigned long)0x120cf8ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[35]), },
- { .address=(unsigned long)0x120f88ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[36]), },
- { .address=(unsigned long)0x13bfccULL, .module="kernel", .section="_stext", .probe=(&stap_probes[37]), },
- { .address=(unsigned long)0x13b95cULL, .module="kernel", .section="_stext", .probe=(&stap_probes[38]), },
- { .address=(unsigned long)0x139ff0ULL, .module="kernel", .section="_stext", .probe=(&stap_probes[39]), },
- { .address=(unsigned long)0x13af5cULL, .module="kernel", .section="_stext", .probe=(&stap_probes[40]), },
- };
- 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 < 41)?kprobe_idx:0)];
- #ifdef STP_ALIBI
- atomic_inc(probe_alibi(sdp->probe->index));
- #else
- struct context* __restrict__ c;
- #if !INTERRUPTIBLE
- unsigned long flags;
- #endif
- #ifdef STP_TIMING
- Stat stat = probe_timing(sdp->probe->index);
- #endif
- #if defined(STP_TIMING) || defined(STP_OVERLOAD)
- cycles_t cycles_atstart = get_cycles ();
- #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 = _stp_runtime_entryfn_get_context();
- 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->uregs = 0;
- c->kregs = 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;
- #endif
- c->probe_type = stp_probe_type_kprobe;
- memset(&c->ips, 0, sizeof(c->ips));
- c->user_mode_p = 0; c->full_uregs_p = 0;
- #ifdef STAP_NEED_REGPARM
- c->regparm = 0;
- #endif
- #if INTERRUPTIBLE
- c->actionremaining = MAXACTION_INTERRUPTIBLE;
- #else
- c->actionremaining = MAXACTION;
- #endif
- #if defined(STP_NEED_UNWIND_DATA)
- c->uwcache_user.state = uwcache_uninitialized;
- c->uwcache_kernel.state = uwcache_uninitialized;
- #endif
- c->kregs = regs;
- {
- unsigned long kprobes_ip = REG_IP(c->kregs);
- 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;
- #ifdef STP_NEED_PROBE_NAME
- c->probe_name = 0;
- #endif
- c->probe_type = 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:
- _stp_runtime_entryfn_put_context();
- 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 < 41)?kprobe_idx:0)];
- const struct stap_probe *sp = entry ? sdp->entry_probe : sdp->probe;
- if (sp) {
- #ifdef STP_ALIBI
- atomic_inc(probe_alibi(sp->index));
- #else
- struct context* __restrict__ c;
- #if !INTERRUPTIBLE
- unsigned long flags;
- #endif
- #ifdef STP_TIMING
- Stat stat = probe_timing(sp->index);
- #endif
- #if defined(STP_TIMING) || defined(STP_OVERLOAD)
- cycles_t cycles_atstart = get_cycles ();
- #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 = _stp_runtime_entryfn_get_context();
- 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->uregs = 0;
- c->kregs = 0;
- #if defined __ia64__
- c->unwaddr = 0;
- #endif
- c->probe_point = sp->pp;
- #ifdef STP_NEED_PROBE_NAME
- c->probe_name = sp->pn;
- #endif
- c->probe_type = stp_probe_type_kretprobe;
- memset(&c->ips, 0, sizeof(c->ips));
- c->user_mode_p = 0; c->full_uregs_p = 0;
- #ifdef STAP_NEED_REGPARM
- c->regparm = 0;
- #endif
- #if INTERRUPTIBLE
- c->actionremaining = MAXACTION_INTERRUPTIBLE;
- #else
- c->actionremaining = MAXACTION;
- #endif
- #if defined(STP_NEED_UNWIND_DATA)
- c->uwcache_user.state = uwcache_uninitialized;
- c->uwcache_kernel.state = uwcache_uninitialized;
- #endif
- c->kregs = regs;
- c->ips.krp.pi = inst;
- c->ips.krp.pi_longs = sdp->saved_longs;
- {
- unsigned long kprobes_ip = REG_IP(c->kregs);
- 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;
- #ifdef STP_NEED_PROBE_NAME
- c->probe_name = 0;
- #endif
- c->probe_type = 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:
- _stp_runtime_entryfn_put_context();
- 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);
- }
- /* ---- hrtimer probes ---- */
- #include "timer.c"
- static struct stap_hrtimer_probe stap_hrtimer_probes [1] = {
- { .probe=(&stap_probes[41]), .intrv=100000000LL, .rnd=0LL },
- };
- static hrtimer_return_t _stp_hrtimer_notify_function (struct hrtimer *timer) {
- int rc = HRTIMER_NORESTART;
- struct stap_hrtimer_probe *stp = container_of(timer, struct stap_hrtimer_probe, hrtimer);
- if ((atomic_read (session_state()) == STAP_SESSION_STARTING) ||
- (atomic_read (session_state()) == STAP_SESSION_RUNNING)) {
- _stp_hrtimer_update(stp);
- rc = HRTIMER_RESTART;
- }
- {
- #ifdef STP_ALIBI
- atomic_inc(probe_alibi(stp->probe->index));
- #else
- struct context* __restrict__ c;
- #if !INTERRUPTIBLE
- unsigned long flags;
- #endif
- #ifdef STP_TIMING
- Stat stat = probe_timing(stp->probe->index);
- #endif
- #if defined(STP_TIMING) || defined(STP_OVERLOAD)
- cycles_t cycles_atstart = get_cycles ();
- #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 = _stp_runtime_entryfn_get_context();
- 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", stp->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->uregs = 0;
- c->kregs = 0;
- #if defined __ia64__
- c->unwaddr = 0;
- #endif
- c->probe_point = stp->probe->pp;
- #ifdef STP_NEED_PROBE_NAME
- c->probe_name = stp->probe->pn;
- #endif
- c->probe_type = stp_probe_type_hrtimer;
- memset(&c->ips, 0, sizeof(c->ips));
- c->user_mode_p = 0; c->full_uregs_p = 0;
- #ifdef STAP_NEED_REGPARM
- c->regparm = 0;
- #endif
- #if INTERRUPTIBLE
- c->actionremaining = MAXACTION_INTERRUPTIBLE;
- #else
- c->actionremaining = MAXACTION;
- #endif
- #if defined(STP_NEED_UNWIND_DATA)
- c->uwcache_user.state = uwcache_uninitialized;
- c->uwcache_kernel.state = uwcache_uninitialized;
- #endif
- (*stp->probe->ph) (c);
- #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;
- #ifdef STP_NEED_PROBE_NAME
- c->probe_name = 0;
- #endif
- c->probe_type = 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:
- _stp_runtime_entryfn_put_context();
- 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 rc;
- }
- 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;
- #ifdef STAPCONF_GENERATED_COMPILE
- const char* version = UTS_VERSION;
- #endif
- if (strcmp (release, "3.11.0-rc5")) {
- _stp_error ("module release mismatch (%s vs %s)", release, "3.11.0-rc5");
- rc = -EINVAL;
- }
- #ifdef STAPCONF_GENERATED_COMPILE
- if (strcmp (utsname()->version, version)) {
- _stp_error ("module version mismatch (%s vs %s), release %s", version, utsname()->version, release);
- rc = -EINVAL;
- }
- #endif
- if (_stp_module_check()) rc = -EINVAL;
- if (_stp_privilege_credentials == 0) {
- if (STP_PRIVILEGE_CONTAINS(STP_PRIVILEGE, STP_PR_STAPDEV) ||
- STP_PRIVILEGE_CONTAINS(STP_PRIVILEGE, STP_PR_STAPUSR)) {
- _stp_privilege_credentials = STP_PRIVILEGE;
- #ifdef DEBUG_PRIVILEGE
- _dbug("User's privilege credentials default to %s\n",
- privilege_to_text(_stp_privilege_credentials));
- #endif
- }
- else {
- _stp_error ("Unable to verify that you have the required privilege credentials to run this module (%s required). You must use staprun version 1.7 or higher.",
- privilege_to_text(STP_PRIVILEGE));
- rc = -EINVAL;
- }
- }
- else {
- #ifdef DEBUG_PRIVILEGE
- _dbug("User's privilege credentials provided as %s\n",
- privilege_to_text(_stp_privilege_credentials));
- #endif
- if (! STP_PRIVILEGE_CONTAINS(_stp_privilege_credentials, STP_PRIVILEGE)) {
- _stp_error ("Your privilege credentials (%s) are insufficient to run this module (%s required).",
- privilege_to_text(_stp_privilege_credentials), privilege_to_text(STP_PRIVILEGE));
- rc = -EINVAL;
- }
- }
- }
- if (rc) goto out;
- rc = stp_session_init();
- if (rc) {
- _stp_error ("couldn't initialize the main session (rc %d)", 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);
- rc = _stp_runtime_contexts_alloc();
- if (rc != 0)
- goto out;
- global_set(s_called, _stp_map_new_ssi (MAXMAPENTRIES, 0)); if (global(s_called) == NULL) rc = -ENOMEM;
- if (rc) {
- _stp_error ("global variable 'called' allocation failed");
- goto out;
- }
- global_lock_init(s_called);
- #ifdef STP_TIMING
- atomic_set(global_skipped(s_called), 0);
- #endif
- if (rc) {
- _stp_error ("global variable 'num_polls' allocation failed");
- goto out;
- }
- global_lock_init(s_num_polls);
- #ifdef STP_TIMING
- atomic_set(global_skipped(s_num_polls), 0);
- #endif
- _stp_print_kernel_info("2.2.1/0.155", (num_online_cpus() * sizeof(struct context)), 43);
- for (i=0; i<1; i++) {
- struct stap_be_probe* stp = & stap_be_probes [i];
- if (stp->type == 0)
- enter_be_probe (stp); /* rc = 0 */
- }
- if (rc) {
- if (probe_point)
- _stp_error ("probe %s registration error (rc %d)", probe_point, rc);
- atomic_set (session_state(), STAP_SESSION_ERROR);
- goto out;
- }
- for (i=0; i<41; 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) {
- if (probe_point)
- _stp_error ("probe %s registration error (rc %d)", probe_point, rc);
- atomic_set (session_state(), STAP_SESSION_ERROR);
- for (i=0; i<1; i++) {
- struct stap_be_probe* stp = & stap_be_probes [i];
- if (stp->type == 1)
- enter_be_probe (stp);
- }
- for (i=0; i<1; i++) {
- struct stap_be_probe* stp = & stap_be_probes [i];
- if (stp->type == 2)
- enter_be_probe (stp);
- }
- goto out;
- }
- _stp_hrtimer_init();
- for (i=0; i<1; i++) {
- struct stap_hrtimer_probe* stp = & stap_hrtimer_probes [i];
- probe_point = stp->probe->pp;
- rc = _stp_hrtimer_create(stp, _stp_hrtimer_notify_function);
- if (rc) {
- for (j=i-1; j>=0; j--)
- _stp_hrtimer_cancel(& stap_hrtimer_probes[j]);
- break;
- }
- }
- if (rc) {
- if (probe_point)
- _stp_error ("probe %s registration error (rc %d)", probe_point, rc);
- atomic_set (session_state(), STAP_SESSION_ERROR);
- #if defined(STAPCONF_UNREGISTER_KPROBES)
- j = 0;
- for (i=0; i<41; 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<41; 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<41; 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<41; 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;
- }
- for (i=0; i<1; i++) {
- struct stap_be_probe* stp = & stap_be_probes [i];
- if (stp->type == 1)
- enter_be_probe (stp);
- }
- for (i=0; i<1; i++) {
- struct stap_be_probe* stp = & stap_be_probes [i];
- if (stp->type == 2)
- enter_be_probe (stp);
- }
- goto out;
- }
- /* ---- vma tracker ---- */
- rc = _stp_vma_init();
- /* ---- task finder ---- */
- if (rc == 0) {
- rc = stap_start_task_finder();
- if (rc) {
- stap_stop_task_finder();
- }
- }
- if (rc) {
- if (probe_point)
- _stp_error ("probe %s registration error (rc %d)", probe_point, rc);
- atomic_set (session_state(), STAP_SESSION_ERROR);
- for (i=0; i<1; i++)
- _stp_hrtimer_cancel(& stap_hrtimer_probes[i]);
- #if defined(STAPCONF_UNREGISTER_KPROBES)
- j = 0;
- for (i=0; i<41; 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<41; 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<41; 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<41; 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;
- }
- for (i=0; i<1; i++) {
- struct stap_be_probe* stp = & stap_be_probes [i];
- if (stp->type == 1)
- enter_be_probe (stp);
- }
- for (i=0; i<1; i++) {
- struct stap_be_probe* stp = & stap_be_probes [i];
- if (stp->type == 2)
- enter_be_probe (stp);
- }
- goto out;
- }
- if (atomic_read (session_state()) == STAP_SESSION_STARTING)
- atomic_set (session_state(), STAP_SESSION_RUNNING);
- /* ---- task finder ---- */
- stap_task_finder_post_init();
- return 0;
- out:
- _stp_map_del (global(s_called));
- atomic_set (session_state(), STAP_SESSION_STOPPED);
- #ifdef STAPCONF_SYNCHRONIZE_SCHED
- synchronize_sched();
- #endif
- #ifdef STAP_NEED_GETTIMEOFDAY
- _stp_kill_time();
- #endif
- _stp_runtime_contexts_free();
- return rc;
- }
- static void systemtap_module_refresh (void) {
- int i=0, j=0;
- (void) i;
- (void) j;
- for (i=0; i<41; 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);
- int rc;
- if (sdp->registered_p == 0 && relocated_addr != 0) {
- 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 == 0) sdp->registered_p = 1;
- } else if (sdp->registered_p == 1 && relocated_addr == 0) {
- if (sdp->return_p) {
- unregister_kretprobe (&kp->u.krp);
- 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 {
- unregister_kprobe (&kp->u.kp);
- 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(__ia64__)
- unregister_kprobe (&kp->dummy);
- #endif
- sdp->registered_p = 0;
- }
- }
- }
- static void systemtap_module_exit (void) {
- int i=0, j=0;
- (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);
- /* ---- task finder ---- */
- stap_stop_task_finder();
- /* ---- vma tracker ---- */
- _stp_vma_done();
- for (i=0; i<1; i++)
- _stp_hrtimer_cancel(& stap_hrtimer_probes[i]);
- #if defined(STAPCONF_UNREGISTER_KPROBES)
- j = 0;
- for (i=0; i<41; 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<41; 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<41; 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<41; 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;
- }
- for (i=0; i<1; i++) {
- struct stap_be_probe* stp = & stap_be_probes [i];
- if (stp->type == 1)
- enter_be_probe (stp);
- }
- for (i=0; i<1; i++) {
- struct stap_be_probe* stp = & stap_be_probes [i];
- if (stp->type == 2)
- enter_be_probe (stp);
- }
- #ifdef STAPCONF_SYNCHRONIZE_SCHED
- synchronize_sched();
- #endif
- _stp_runtime_context_wait();
- atomic_set (session_state(), STAP_SESSION_STOPPED);
- #ifdef STAPCONF_SYNCHRONIZE_SCHED
- synchronize_sched();
- #endif
- _stp_map_del (global(s_called));
- _stp_runtime_contexts_free();
- #ifdef STAP_NEED_GETTIMEOFDAY
- _stp_kill_time();
- #endif
- preempt_disable();
- #if defined(STP_TIMING) || defined(STP_ALIBI)
- _stp_printf("----- probe hit report: \n");
- for (i = 0; i < ARRAY_SIZE(stap_probes); ++i) {
- const struct stap_probe *const p = &stap_probes[i];
- #ifdef STP_ALIBI
- int alibi = atomic_read(probe_alibi(i));
- if (alibi)
- _stp_printf ("%s, (%s), hits: %d,%s, index: %d\n",
- p->pp, p->location, alibi, p->derivation, i);
- #endif
- #ifdef STP_TIMING
- if (likely (probe_timing(i))) {
- struct stat_data *stats = _stp_stat_get (probe_timing(i), 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, index: %d\n",
- p->pp, p->location, (long long) stats->count,
- (long long) stats->min, (long long) avg, (long long) stats->max,
- p->derivation, i);
- }
- _stp_stat_del (probe_timing(i));
- }
- #endif
- }
- _stp_print_flush();
- #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_skipped(s_called));
- if (ctr) _stp_warn ("Skipped due to global '%s' lock timeout: %d\n", "called", ctr);
- ctr = atomic_read (global_skipped(s_num_polls));
- if (ctr) _stp_warn ("Skipped due to global '%s' lock timeout: %d\n", "num_polls", 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();
- }
- preempt_enable_no_resched();
- }
- static int systemtap_kernel_module_init (void) {
- int rc = 0;
- int i=0, j=0;
- if (rc) {
- goto out;
- }
- if (rc) {
- goto out;
- }
- if (rc) {
- goto out;
- }
- if (rc) {
- goto out;
- }
- out:
- return rc;
- }
- static void systemtap_kernel_module_exit (void) {
- int i=0, j=0;
- }
- #include "stap-symbols.h"
- MODULE_DESCRIPTION("systemtap-generated probe");
- MODULE_LICENSE("GPL");
- MODULE_INFO(intree,"Y");
- #undef called
- #undef num_polls
- module_param_named (num_polls, global(s_num_polls), int64_t, 0);
- root@linaro-developer:~/systemtap-2.2.1/testsuite#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement