diff options
Diffstat (limited to 'runtime')
50 files changed, 561 insertions, 5166 deletions
diff --git a/runtime/ChangeLog b/runtime/ChangeLog deleted file mode 100644 index ca299a8c..00000000 --- a/runtime/ChangeLog +++ /dev/null @@ -1,2432 +0,0 @@ -2008-12-15 Mark Wielaard <mjw@redhat.com> - - * runtime.h: Just include task_finder.c instead of defining parts - of it here. - * sym.c (_stp_mod_sec_lookup): Add dbug_sym statements. - * task_finder_vma.c: Define __stp_tf_vma_entry here. - -2008-12-10 Mark Wielaard <mjw@redhat.com> - - * runtime.h: Define __stp_tf_vma_entry here. - * sym.c (_stp_mod_sec_lookup): Try vma matching first if task given. - (_stp_kallsyms_lookup): Take an optional task. - (_stp_symbol_snprint): Likewise. - task_finder.c (__stp_tf_vm_cb): Use vm_path to match and attach - module to vma entry. - task_finder_vma.c (stap_add_vma_map_info): Take an optional module. - (__stp_tf_get_vma_entry_addr): New lookup function. - -2009-01-20 David Smith <dsmith@redhat.com> - - PR 9673. - * task_finder.c (struct stap_task_finder_target): Added - 'vm_events' field. - (stap_register_task_finder_target): Sets vm_events if a - vm_callback is present. - (__stp_task_finder_cleanup): Only detaches engines on the main - __stp_task_finder_list linked list. - (__stp_call_callbacks): New function. - (__stp_call_vm_callbacks): New function. - (__stp_utrace_attach_match_filename): Calls __stp_call_callbacks() - to call callbacks. - (__stp_utrace_task_finder_target_death): Ditto. - (__stp_utrace_task_finder_target_quiesce): Calls - __stp_call_callbacks() and __stp_call_vm_callbacks() to call - callbacks. - (__stp_call_vm_callbacks_with_vma): Renamed from - __stp_target_call_vm_callback. - (__stp_utrace_task_finder_target_syscall_exit): Calls - __stp_call_vm_callbacks() to call vm callbacks. - (stap_start_task_finder): Instead of a utrace engine for every - task_finder_target, there is now one utrace engine for all targets - with the same path or pid. - -2009-01-13 Jim Keniston <jkenisto@us.ibm.com> - - PR 7082. - * uprobes2/uprobes.c: On exec, free up outstanding - uretprobe_instances and tick down the uproc's ref-count - accordingly, so the (old image's) uproc goes away as - desired. - -2009-01-12 Wenji Huang <wenji.huang@oracle.com> - - * transport/symbols.c (_stp_sort): Adapt it to 2.6.29. - -2009-01-06 Frank Ch. Eigler <fche@elastic.org> - - PR9699. - * autoconf-task-uid.c: New test. - -2008-12-21 Stan Cox <scox@redhat.com> - - * sduprobes.h (STAP_PROBE): Put block around probe point. - -2008-12-16 Stan Cox <scox@redhat.com> - - * sduprobes.h (STAP_PROBE): Add synthetic reference to probe label. - -2008-12-09 Frank Ch. Eigler <fche@elastic.org> - - * time.c (_stp_gettimeofday_ns): Protect some more against freq=0. - -2008-12-08 Wenji Huang <wenji.huang@oracle.com> - - * uprobes2/uprobes_x86.c (handle_riprel_insn): Fix the warning. - -2008-12-04 Stan Cox <scox@redhat.com> - - * sduprobes.c (STAP_PROBE_START): Remove. - * sduprobes.h (STAP_PROBE_START): Remove. - (DTRACE_PROBE): New. - -2008-11-26 Stan Cox <scox@redhat.com> - - * sduprobes.h (STAP_PROBE1): Add USE_STAP_DEBUGINFO_PROBE. - -2008-11-26 Frank Ch. Eigler <fche@elastic.org> - - PR 4886. - * sym.c (_stp_module_check): Perform assertive - build-id checking for kernel versions >= 2.6.27. - -2008-11-26 Frank Ch. Eigler <fche@elastic.org> - - * autoconf-synchronize-sched.c: New file. - -2008-11-25 Frank Ch. Eigler <fche@elastic.org> - - PR 7046. - * task_finder.c (__stp_utrace_task_finder_target_quiesce): Only - issue vm_callbacks for process main threads. - -2008-11-24 Wenji Huang <wenji.huang@oracle.com> - - From Srikar Dronamraju: - * runtime.h: Use for_each_cpu_mask always. - -2008-11-11 Stan Cox <scox@redhat.com> - - * sduprobes.c: New file. - * sduprobes.h: New file. - -2008-11-17 Wenji Huang <wenji.huang@oracle.com> - - * runtime.h: Rename for_each_cpu to stp_for_each_cpu for 2.6.28. - * counter.c: Ditto. - * map-stat.c: Ditto. - * map.c: Ditto. - * pmap-gen.c: Ditto. - * stat.c: Ditto. - * transport/procfs.c: Ditto. - -2008-11-04 David Smith <dsmith@redhat.com> - - PR 5274. - * syscall.h: Added s390 task_finder support. - - From Jim Keniston, PR 5274. - * uprobes/uprobes_s390.h (arch_get_cur_sp): New function. - (arch_predict_sp_at_ret): Ditto. - -2008-11-04 Frank Ch. Eigler <fche@elastic.org> - - From Masami Hiramatsu <mhiramat@redhat.com>, PR 6028. - * regs-ia64.c (bspcache): Expand documentation. - -2008-10-28 Frank Ch. Eigler <fche@elastic.org> - - From Jim Keniston: - * autoconf-oneachcpu-retry.c: Tweak #include's for broader - compatibility. - -2008-10-24 Josh Stone <joshua.i.stone@intel.com> - - * autoconf-hrtimer-getset-expires.c: New file. - -2008-10-17 Wenji Huang <wenji.huang@oracle.com> - - * task_finder_vma.c (__stp_tf_vma_get_free_entry): Initialize entry. - -2008-10-07 Frank Ch. Eigler <fche@elastic.org> - - PR 4886. - * sym.c (_stp_module_check): Tweak & simplify build-id checking. - Weaken consequences of mismatch temporarily due to fedora bug. - * sym.h: Eliminate special cased values of module->notes_sect. - -2008-10-06 Mark Wielaard <mjw@redhat.com> - - * utrace_compatibility.h: Add workaround for fedora 9 2.6.26 kernels. - -2008-10-06 Wenji Huang <wenji.huang@oracle.com> - - PR 4886 - * sym.h (_stp_module): Add several fields to store build-id. - * sym.c (_stp_module_check): New function to check build-id. - * staprun/staprun.c (send_relocation_kernel): Send build-id of runtime - kernel if there. - * transport/symbols.c (_stp_do_relocation): Update note section. - (_stp_section_is_interesting): No filter to .note.gnu.build-id. - -2008-10-03 Mark Wielaard <mjw@redhat.com> - - * procfs.c (_stp_rmdir_proc_module): Remove debug output from warning. - -2008-10-03 Mark Wielaard <mjw@redhat.com> - - * procfs.c (_stp_rmdir_proc_module): Usage count warning - depends on kernel version. - -2008-10-02 Tim Moore <timoore@redhat.com> - - * addr-map.c (add_bad_addr_entry): Fix bugs in allocating a new - table and copying old entries into the new table. - -2008-09-30 Tim Moore <timoore@redhat.com> - - * addr-map.c (add_bad_addr_entry): Rewrite allocation of address - table to simplify locking and eliminate a race condition. - -2008-09-26 David Smith <dsmith@redhat.com> - - * task_finder.c (__STP_ATTACHED_TASK_EVENTS): Removed UTRACE_STOP, - which isn't needed anymore. - -2008-09-25 David Smith <dsmith@redhat.com> - - * task_finder.c (__stp_utrace_attach): Added action flag to know - to request the thread to be stopped or not. - (stap_utrace_attach): Now just calls __stp_utrace_attach(). - (__stp_utrace_task_finder_target_quiesce): Handles - utrace_set_events() errors properly. - - * utrace_compatibility.h (enum utrace_resume_action): Added - utrace_resume_action enum. - (utrace_control): Added UTRACE_STOP support. - (utrace_engine_put): New. - (utrace_barrier): New. - -2008-09-17 Frank Ch. Eigler <fche@elastic.org> - - PR 6487, 6504. - From Masami Hiramatsu <mhiramat@redhat.com> - * print_new.c (stp_print_flush): Use new utt_reserve(). - -2008-09-12 Masami Hiramatsu <mhiramat@redhat.com> - - BZ 6028 - * regs-ia64.c (bspcache): Use REG_IP instead of pp to check probe - address. - -2008-09-12 David Smith <dsmith@redhat.com> - - BZ 6755 - * task_finder.c: Added 'inuse' count to know when handlers are still - running. - (__stp_utrace_task_finder_report_clone): If state isn't correct, - detach. Increase 'inuse' count when starting, decrement when - exiting. - (__stp_utrace_task_finder_report_exec): Ditto. - (__stp_utrace_task_finder_target_death): Ditto. - (__stp_utrace_task_finder_target_quiesce): Increase 'inuse' count - when starting, decrement when exiting. - (__stp_utrace_task_finder_target_syscall_entry): Ditto. - (__stp_utrace_task_finder_target_syscall_exit): Ditto. - (stap_stop_task_finder): Wait until all callbacks are finished. - -2008-09-10 Frank Ch. Eigler <fche@elastic.org> - - * runtime.h (STP_USE_FRAME_POINTER): Remove architecture #if's. - All will activate it if CONFIG_FRAME_POINTER unless - STP_USE_DWARF_UNWINDER. - * stack-i386.c: (__stp_stack_print): Handle !DWARF and !FRAME - configuration. - -2008-09-10 Mark Wielaard <mjw@redhat.com> - - * sym.h (_stp_module): Rename module_base to dwarf_module_base. - * unwind.c (adjustStartLoc): Document and use dwarf_module_base. - -2008-09-10 Mark Wielaard <mjw@redhat.com> - - * runtime.h (CONFIG_FRAME_POINTER): Don't enable when - STP_USE_DWARF_UNWINDER is already defined. - -2008-09-10 Mark Wielaard <mjw@redhat.com> - - * sym.h (_stp_module): Add module_base field. - * unwind.c (adjustStartLoc): New function. - (_stp_search_unwind_hdr): Use adjustStartLoc. - (unwind): Likewise. - -2008-09-10 Mark Wielaard <mjw@redhat.com> - - * unwind.c (unwind): Use _stp_mod_sec_lookup to get module and - unwind tables. - * runtime.h (STP_USE_FRAME_BUFFER): Disable by default for now. - * stack-x86_64.c (__stp_stack_print): Add levels to - _stp_stack_print_fallback call. - -2008-09-09 Masami Hiramatsu <mhiramat@redhat.com> - - * regs-ia64.c (__ia64_fetch_register): Return the address of the - register. - (ia64_fetch_register): Use __ia64_fetch_register. - * syscall.h (____stp_user_syscall_arg): Use __ia64_fetch_register. - (__stp_user_syscall_arg): Wrapping ____stp_user_syscall_arg to pass the - unwind address cache. - * task_finder.c (__stp_utrace_task_finder_target_syscall_): Added dummy - unwind address cache. - -2008-09-09 Masami Hiramatsu <mhiramat@redhat.com> - - * syscall.h: Added ia64 support. - -2008-09-09 Mark Wielaard <mwielaard@redhat.com> - - * sym.c (_stp_mod_sec_lookup): New function, extracted from - _stp_kallsyms_lookup. - -2008-09-09 Mark Wielaard <mwielaard@redhat.com> - - * sym.c (_stp_kallsyms_lookup): Correct this_section_offset - calculation. - -2008-09-08 Tim Moore <timoore@redhat.com> - - PR 1288 - * addr-map.c: New file with functions for looking up addresses - * loc2c-runtime.h (deref, store_deref): Use lookup_bad_addr to - avoid dereferencing known dangerous addresses. - * runtime.h: Include addr-map.c. - -2008-09-06 Frank Ch. Eigler <fche@elastic.org> - - PR 6445 - * task_finder.c (stap_start_task_finder): When _stp_target - is set (stap -c or -x mode), restrict initial utrace attach - iteration to target process only. - -2008-09-01 Frank Ch. Eigler <fche@elastic.org> - - * task_finder.c: Move CONFIG_UTRACE assertion here. - * task_finder_vma.c (__stp_tf_add_vma): Make printk conditional. - -2008-08-29 David Smith <dsmith@redhat.com> - - * task_finder.c (__stp_utrace_attach_match_filename): Don't call - the callback when the interesting thread is found, call it when - the tread is quiesced. - (stap_start_task_finder): Ditto. - (__stp_utrace_task_finder_target_quiesce): Call the callback. - -2008-08-26 David Smith <dsmith@redhat.com> - - * autoconf-d_path-path.c: New file. - - * task_finder.c (__stp_get_mm_path): Uses STAPCONF_DPATH_PATH - instead of a kernel version check to determine how to call - d_path(). - (__stp_utrace_task_finder_target_quiesce): Ditto. - (__stp_target_call_vm_callback): Ditto. - -2008-08-21 David Smith <dsmith@redhat.com> - - * task_finder.c (__stp_tf_vm_cb): Added task finder target - parameter. - (__stp_utrace_attach_match_filename): Updated task finder callback - call. - (__stp_utrace_task_finder_target_death): Ditto. - (__stp_utrace_task_finder_target_quiesce): Ditto. - (__stp_target_call_vm_callback): Ditto. - (__stp_utrace_task_finder_target_syscall_exit): Ditto. - (stap_start_task_finder): Ditto. - -2008-08-20 David Smith <dsmith@redhat.com> - - * task_finder.c: Supports original and new utrace interfaces. - * utrace_compatibility.h (utrace_attach_task): Compatibility layer - for original utrace interface. - - * task_finder.c (__stp_utrace_task_finder_target_syscall_entry): - Handles mmap2 (as well as mmap). - (__stp_utrace_task_finder_target_syscall_exit): Ditto. - * syscall.h: Added defines for mmap and mmap2. - -2008-08-19 David Smith <dsmith@redhat.com> - - PR 6841 - * task_finder.c (__stp_utrace_task_finder_target_quiesce): - Quiesces thread before turning on syscall tracing. - -2008-08-14 Frank Ch. Eigler <fche@elastic.org> - - PR 6842. - * task_finder.c (__stp_utrace_task_finder_target_death): Tolerate - null tsk->signal. - -2008-08-12 David Smith <dsmith@redhat.com> - - PR 6445 (partial) - * task_finder.c (stap_register_task_finder_target): Handles - probing all threads. - (__stp_utrace_attach_match_filename): Ditto. - (stap_start_task_finder): Ditto. - -2008-08-08 David Smith <dsmith@redhat.com> - - * task_finder.c (stap_utrace_detach): New function. - (stap_utrace_detach_ops): Calls stap_utrace_detach(). - (__stp_utrace_attach_match_filename): Ditto. - - * task_finder.c (__stp_tf_vm_cb): Added calls to save/delete vma - information. - * task_finder_vma.c (__stp_tf_vma_map_hash): New function. - (__stp_tf_get_vma_map_entry_internal): Ditto. - (stap_add_vma_map_info): Ditto. - (stap_remove_vma_map_info): Ditto. - (stap_find_vma_map_info): Ditto. - -2008-07-24 Josh Stone <joshua.i.stone@intel.com> - - * runtime/autoconf-module-nsections.c: removed - * runtime/autoconf-oneachcpu-retry.c: added - -2008-07-21 David Smith <dsmith@redhat.com> - - * task_finder_vma.c (__stp_tf_vma_initialize): New function to - initialize the free list. - (__stp_tf_vma_put_free_entry): Puts a vma entry back on the free - list. - (__stp_tf_add_vma): Instead of allocating a vma entry, grab one - from the free list by calling __stp_tf_vma_put_free_entry(). - (__stp_tf_remove_vma_entry): Instead of freeing a vma entry, call - __stp_tf_vma_put_free_entry() to put it on the free list instead. - * task_finder.c (stap_start_task_finder): Calls - __stp_tf_vma_initialize(). - -2008-07-18 Frank Ch. Eigler <fche@elastic.org> - - BZ 442528, From Masami Hiramatsu <mhiramat@redhat.com> - * regs-ia64.c (ia64_stap_get_arbsp): New function. - -2008-07-17 Frank Ch. Eigler <fche@elastic.org> - - * sym.c (_stp_kallsyms_lookup, _stp_module_relocate): Add - multiple-section-per-module support. - * sym.h (_stp_section): New type for separately relocatable - _stp_module pieces. - -2008-07-12 Frank Ch. Eigler <fche@elastic.org> - - PR 6738. - * loc2c-runtime.h: #include {asm,linux}/uaccess.h as autoconf'd. - * unwind/i386.h (user_mode_vm, FIX_VDSO): #ifdef for older kernels. - * unwind/x86_64.h (VSYSCALL_START): speculative #ifdef for same. - * unwind/unwind.h (BUILD_BUG_ON_ZER): Ditto. - -2008-07-10 Frank Ch. Eigler <fche@elastic.org> - - PR 6736. - * sym.c (_stp_module_relocate): Generalized to search all - _stp_module[]s. - (_stp_kallsyms_lookup_name): Gone. - (_stp_find_module_by_addr): Rewritten. - (_stp_get_unwind_info): Temporarily gone. - * sym.h (_stp_module): Simplify structure. - * unwind.c: Adapt just enough to compile with eliminated elements. - - * probes.stp: Removed unused file. - -2008-07-09 Mark Wielaard <mwielaard@redhat.com> - - PR 6732 - * autoconf-real-parent.c: New file. - * task_finder.c (__stp_utrace_task_finder_report_exec): Define - real_parent using STAPCONF_REAL_PARENT. Undefine when no longer - needed. - -2008-07-01 David Smith <dsmith@redhat.com> - - * task_finder.c (__stp_get_mm_path): Corrected error return code. - (__stp_utrace_attach_match_tsk): Ignores ENOENT error from - __stp_get_mm_path(). - (stap_start_task_finder): Ditto. - -2008-06-30 David Smith <dsmith@redhat.com> - - * task_finder.c (stap_utrace_detach_ops): Removed check to see if - thread has a mm (in the case where a thread isn't quite dead - yet). - (stap_utrace_attach): Minor error handling improvement. - (__stp_utrace_attach_match_tsk): Ditto. - -2008-06-24 David Smith <dsmith@redhat.com> - - From: Srinivasa DS <srinivasa@in.ibm.com> - * syscall.h: Added powerpc support. - -2008-06-23 David Smith <dsmith@redhat.com> - - * task_finder.c (__stp_utrace_task_finder_target_quiesce): Fixed - vm_callback offset by shifting it left PAGE_SHIFT bits. - (__stp_target_call_vm_callback): Ditto. - (__stp_utrace_task_finder_target_syscall_exit): Ditto. - - * task_finder.c (__stp_utrace_task_finder_report_exec): Handles - relative exec paths correctly. - - * task_finder_vma.c (__stp_tf_vma_hash): Improved determination of - whether this is a 64-bit platform. - * syscall.h: Handles kernels with older style register - definitions. - - * task_finder.c (__stp_tf_vm_cb): New function. - (stap_register_task_finder_target): Sets up syscall entry and - syscall exit handlers. - (__stp_find_file_based_vma): New function. - (__stp_utrace_task_finder_target_syscall_entry): New function. - Saves vma information off at syscall entry. - (__stp_target_call_vm_callback): New function. - (__stp_utrace_task_finder_target_syscall_exit): New function. - Handles changes to memory maps based on information saved at - syscall entry. - * syscall.h: New file containing syscall function. - * task_finder_vma.c: New file containing saved vma information - handling functions. - - * regs.h: Removed trailing semicolons from macro definitions. - -2008-06-17 David Smith <dsmith@redhat.com> - - * task_finder.c (__stp_utrace_attach_match_filename): Uses new - __STP_ATTACHED_TASK_EVENTS macro to determine which events to set - on a newly found process based on whether the - stap_task_finder_target structure has a vm_callback defined. - (stap_start_task_finder): Ditto. - -2008-06-16 David Smith <dsmith@redhat.com> - - * task_finder.c (stap_start_task_finder): Improved callback - handling. - -2008-06-10 David Smith <dsmith@redhat.com> - - * task_finder.c (struct stap_task_finder_target): Added - vm_callback public field. - (stap_register_task_finder_target): Sets up .report_quiesce - handler. - (__stp_utrace_task_finder_target_quiesce): New function. - -2008-06-09 David Smith <dsmith@redhat.com> - - * task_finder.c (__stp_utrace_task_finder_report_exec): Handles - 2.6.25 kernels. - -2008-06-06 David Smith <dsmith@redhat.com> - - * task_finder.c: Added some debug logic. Use - '-DDEBUG_TASK_FINDER' to enable. - (stap_utrace_attach): Renamed from '__stp_utrace_attach'. - (__stp_utrace_attach_match_filename): Calls callback with - notification that this is a process or thread event. - (__stp_utrace_attach_match_tsk): Ditto. - (__stp_utrace_task_finder_report_clone): Ditto. - (__stp_utrace_task_finder_report_exec): Ditto. - (stap_utrace_task_finder_report_death): Ditto. - (stap_start_task_finder): Ditto. - (stap_stop_task_finder): Added debug logic. - -2008-05-29 Stan Cox <scox@redhat.com> - - * map.c (print_keytype): Remove. - (print_valtype): Remove. - (_stp_map_printn): Remove. - (_stp_map_print): Remove. - (_stp_pmap_printn): Remove. - * stat-common.c (_stp_stat_print_valtype): Remove. - * stat.c (__stp_stat_print): Remove. - (_stp_stat_print_cpu): Remove. - (_stp_stat_print): Remove. - * Makefile: Delete. - * tests: Delete. - * probes: Delete. - -2008-05-28 David Smith <dsmith@redhat.com> - - * task_finder.c (__stp_utrace_attach_match_filename): Added - register_p parameter, which is passed on to the callback. Only - adds death notification if register_p is 1. If register_p is 0, - removes death notification. - (__stp_utrace_attach_match_tsk): Moved code from - __stp_utrace_task_finder_report_clone that handles the details of - grabbing a task's path. - (__stp_utrace_task_finder_report_clone): Calls new - __stp_utrace_attach_match_tsk(). - (__stp_utrace_task_finder_report_exec): Notifies upper layer that - it might need to detach from newly exec'ed process.` - -2008-05-27 Josh Stone <joshua.i.stone@intel.com> - - PR 6432 - * loc2c-runtime.h (kread, kwrite, deref, store_deref): Add - architecture-neutral implementations, using probe_kernel_* - facilites (controlled by autoconf). - * autoconf-probe-kernel.c: test for above. - -2008-05-21 David Smith <dsmith@redhat.com> - - * task_finder.c (__stp_utrace_attach_match_filename): Added - event_flag parameter of event to pass to callback. - (__stp_utrace_task_finder_target_death): Ditto. - (__stp_utrace_task_finder_report_clone): Calls - __stp_utrace_attach_match_filename() with new argument. - (__stp_utrace_task_finder_report_exec): Ditto. - (stap_start_task_finder): Calls callback with an invalid - event_flag since this callback call isn't related to an event. - -2008-05-16 David Smith <dsmith@redhat.com> - - PR 6499. - * task_finder.c (stap_register_task_finder_target): Added error - check. - (__stp_utrace_task_finder_report_clone): Ditto. - (stap_utrace_detach_ops): Uses do_each_thread/while_each_thread - instead of for_each_process (which only iterated among process - group leaders instead of all threads). - (stap_start_task_finder): Ditto. - -2008-05-08 David Smith <dsmith@redhat.com> - - PR 6500. - * task_finder.c (__stp_utrace_task_finder_report_exec): Moved - attach logic to __stp_utrace_attach_match_filename(). - (__stp_utrace_attach_match_filename): New function. - (__stp_utrace_task_finder_report_clone): Calls - __stp_utrace_attach_match_filename() to attach to newly cloned - threads. - -2008-05-06 Masami Hiramatsu <mhiramat@redhat.com> - - PR 5648 - * print_old.c (stp_print_flush): Fix unaligned access warning on - ia64. - * print_new.c (stp_print_flush): Ditto. - -2008-05-06 Masami Hiramatsu <mhiramat@redhat.com> - - PR 5648 - * vsprintf.c (_stp_vsnprintf): Fix memcpy's endianess issue. - -2008-05-05 Frank Ch. Eigler <fche@elastic.org> - - PR 6481. - * time.c (__stp_time_timer_callback): Reenable irq's before - mod_timer. - -2008-05-05 David Smith <dsmith@redhat.com> - - * task_finder.c (stap_utrace_detach_ops): Make sure we ignore - /sbin/init. - (__stp_utrace_attach): Added function to handle details of - attaching a utrace engine. - (__stp_utrace_task_finder_report_clone): Calls - __stp_utrace_attach. - (__stp_utrace_task_finder_report_exec): Ditto. - (stap_start_task_finder): Ditto. - -2008-04-30 Masami Hiramatsu <mhiramat@redhat.com> - - PR 5648 - From Shaohua Li <shaohua.li@intel.com> - * vsprintf.c (_stp_vsnprintf): Fix unaligned access warning on ia64. - -2008-04-29 David Smith <dsmith@redhat.com> - - * task_finder.c: Made more robust by ensuring that all utrace - attaches have a corresponding utrace detach. - -2008-04-28 Frank Ch. Eigler <fche@elastic.org> - - * runtime.h (TEST_MODE): Remove. - -2008-04-25 David Smith <dsmith@redhat.com> - - From Srinivasa <srinivasa@in.ibm.com> - * task_finder.c (__stp_get_mm_path): Fixed kernel 2.6.25 change. - -2008-04-24 David Smith <dsmith@redhat.com> - - * task_finder.c (__stp_get_mm_path): Made kernel 2.6.25 changes. - -2008-04-16 David Smith <dsmith@redhat.com> - - * task_finder.c (__stp_get_mm_path): Made kernel 2.6.18 changes. - -2008-04-15 David Smith <dsmith@redhat.com> - - PR 5961 (partial) - * task_finder.c (stap_start_task_finder): When an interesting - thread is found that is already running, make sure to set up - thread death notification. - -2008-04-15 hunt <hunt@redhat.com> - * print.c (_stp_pbuf_full): Delete. - -2008-04-15 hunt <hunt@redhat.com> - * stack-x86_64.c (_stp_stack_print_fallback): Add levels. - (__stp_stack_print): Count levels properly. - -2008-04-15 Martin Hunt <hunt@redhat.com> - - Finish support for limits on backtrace depth. - * runtime.h (MAXTRACE): Default to 20. - * stack.c (_stp_stack_print): Call __stp_stack_print - with levels set properly. - * sym.c (_stp_func_print): Return a value indicating - if something was printed. - - Support for i386 and x86_64 on 2.6.25 kernel - * unwind/i386.h: Support unified registers on 2.6.25. - Remove unused frame stuff, including STACK_*. - * stack-i386.c (__stp_stack_print): Support unified - registers on 2.6.25. - * regs.h (REG_FP): Define for i386. - -2008-04-15 Frank Ch. Eigler <fche@elastic.org> - - PR 6410. - * unwind.c, unwind.h: Make body conditional in STP_USE_DWARF_UNWINDER. - * stack-x86_64.c (__stp_stack_print): Tolerate !unwinder. - -2008-04-15 Frank Ch. Eigler <fche@elastic.org> - - PR 6405 - * autoconf-module-nsections.c: New file. - -2008-04-15 Frank Ch. Eigler <fche@elastic.org> - - * unwind/i386.h (STACK_BOTTOM, STACK_TOP): Comment out these - unused definitions, for they collide with some kernels - (2.6.25-0.121.rc5.git4 rawhide). - -2008-04-13 Frank Ch. Eigler <fche@elastic.org> - - * print.c (_stp_pbuf_full): New function to note full print buffer. - * stack-{i386,x86_64}.c: Use it in all stack-searching loops, to - impose another limit against unbounded iteration. - -2008-03-31 Martin Hunt <hunt@redhat.com> - - * runtime.h (STP_USE_DWARF_UNWINDER): Define. - -2008-04-04 Masami Hiramatsu <mhiramat@redhat.com> - - PR 6028 - * loc2c-runtime.h (fetch_register): Call ia64_fetch_register with - the address of c->unwaddr. - * regs-ia64.c (ia64_fetch_register): Don't unwind stack if it has - already unwound stack in same probe. - -2008-03-30 Martin Hunt <hunt@redhat.com> - - * runtime.h (STP_USE_FRAME_POINTER): Define when frame pointers - are available in the kernel and can be used. - * stack-arm.c: Use STP_USE_FRAME_POINTER. - * stack-i386.c: Ditto. - * unwind/i386.h: Ditto. - * unwind/x86_64.h: Ditto. - -2008-04-04 David Smith <dsmith@redhat.com> - - PR 5961 (partial) - * task_finder.c: New file. - -2008-03-28 Martin Hunt <hunt@redhat.com> - - * copy.c (_stp_read_address): New function. Safely read - kernel or userspace. - -2008-03-26 Martin Hunt <hunt@redhat.com> - Fixes to get i386 working. - * unwind.c (unwind): Fix types in debug print. - * stack-i386.c (_stp_stack_print_fallback): New function. - (__stp_stack_print): Call _stp_stack_print_fallback() if unwinder - appears to fail. - -2008-03-25 Martin Hunt <hunt@redhat.com> - - * unwind.c (unwind): Return a positive number to indicate - that unwinding is done. - -2008-04-01 Frank Ch. Eigler <fche@elastic.org> - - * lket/*: Belatedly remove retired LKET code. - -2008-03-17 Eugene Teo <eteo@redhat.com> - - PR 5947 - * autoconf-tsc-khz.c: Remove "&& defined(__i386__)" to make the test - more pessimistic. - -2008-03-14 Masami Hiramatsu <mhiramat@redhat.com> - - PR 3542 - * autoconf-unregister-kprobes.c : New file. - -2008-03-10 Dave Brolley <brolley@redhat.com> - - PR5189 - * vsprintf.c (_stp_vsnprintf): Arguments for dynamic width and precision - are of type 'int' again. - * loc2c-runtime.h (deref_string): Copy the data only if dst is not NULL. - (deref_buffer): New macro. - -2008-02-27 Martin Hunt <hunt@redhat.com> - - * sym.h (_stp_module): Add text_size, lock, and unwind data - pointer. - * sym.c (_stp_find_module_by_addr): New function. - (_stp_kallsyms_lookup): Call _stp_find_module_by_addr(). - (_stp_get_unwind_info): New. - - * runtime.h: Move debug macros to debug.h. Include it. - * debug.h: New file. - * map.c: Update debug calls. - * map-gen.c: Update debug calls. - * pmap-gen.c: Update debug calls. - - * mempool.c: New file. - -2008-02-27 Dave Brolley <brolley@redhat.com> - - PR5189 - * vsprintf.c (_stp_vsnprintf): Extract arguments of type int64_t for - dynamic width and precision. Implement width and precision correctly for - the %b format specifier. Implement the %m specifier. - -2008-02-06 Masami Hiramatsu <mhiramat@redhat.com> - - * stack-ia64.c (__stp_show_stack_sym): Skip printing symbol if (ip == - REG_IP(regs)). - -2008-01-29 Martin Hunt <hunt@redhat.com> - - * io.c (_stp_vlog): Use get_cpu() instead - of smp_processor_id() because this function can get - called with interrupts enabled. - -2008-01-29 Martin Hunt <hunt@redhat.com> - - * alloc.c (struct _stp_malloc_type): Remove - redundant field. - -2008-01-28 Martin Hunt <hunt@redhat.com> - - * alloc.c: Use DEFINE_SPINLOCK. - * counter.c: Ditto. - * pmap-gen.c: Ditto. - * print_new.c: Ditto. - * stat.c: Ditto. - -2008-01-27 Frank Ch. Eigler <fche@elastic.org> - - * stack-i386.c (__stp_stack_print): Correct #elif->#else typo. - -2008-01-14 Martin Hunt <hunt@redhat.com> - - * print.c (_stp_print_kernel_info): New function. - (all): Call stp memory functions. - - * alloc.c: Rewrite to track allocated memory if - DEBUG_MEM is defined. - * counter.c, map.c, stat.c, time.c: Call stp - memory functions. - -2007-11-14 Zhaolei <zhaolei@cn.fujitsu.com> - - From Cai Fei <caifei@cn.fujitsu.com> - * regs-ia64.c (ia64_fetch_register): Fix the bug of fetching - register 12 on IA64. - -2007-11-12 Martin Hunt <hunt@redhat.com> - - * print.c (_stp_print): Rewrite to eliminate the strlen() - call and save a bit of time. - -2007-11-09 Masami Hiramatsu <mhiramat@redhat.com> - - PR3858 - * print.c: Add -DRELAY_HOST=<hostname> and -DRELAY_GUEST=<hostname> - options support. - (_stp_print_flush): Disable irqs if -DRELAY_* option is specified. - * print_old.c: Export stp_print_flush to other modules if the - -DRELAY_HOST option is specified. - * print_new.c: Ditto. - -2007-10-25 Mike Mason <mmlnx@us.ibm.com> - - * stat-common.c: Allow histogram bucket elision to be turned off - with -DHIST_ELISION=<negative #>. Also cleaned up looping code - to prevent unnecessary interation over non-existent buckets. - -2007-10-17 Masami Hiramatsu <mhiramat@redhat.com> - - * autoconf-tsc-khz.c: Not to be compiled if the kernel version is - younger than 2.6.23 on i386. - -2007-10-17 Martin Hunt <hunt@redhat.com> - PR5000 - * vsprintf.c: Remove _stp_endian. - -2007-10-15 Masami Hiramatsu <mhiramat@redhat.com> - - * autoconf-tsc-khz.c: Fix a bug to be configured correctly. - -2007-10-09 Martin Hunt <hunt@redhat.com> - - * user/*: Removed obsolete userspace test files. - -2007-10-02 Frank Ch. Eigler <fche@elastic.org> - - PR 5041 - From <michael.gruener@linux.vnet.ibm.com>: - * loc2c-runtime.h (store_register): Add value as macro parameter where - missing. - -2007-09-24 Masami Hiramatsu <mhiramat@redhat.com> - - PR 3916 - * time.c (stp_time_t): Rename cpufreq to freq. - (__stp_get_freq): Rename from __stp_estimate_cpufreq. Use tsc_khz or - cpu_khz if it is available. Use itc_freq on ia64. - (__stp_ktime_get_real_ts): New function to get current kernel time. - (__stp_time_timer_callback): Call __stp_ktime_get_real_ts to get - base time. - (__stp_init_time): Ditto. - (__stp_constant_freq): New function to check the processor has - constant frequency timestamp counter. - (_stp_kill_time): Don't use the cpufreq notifier if the processor has - constant frequency timestamp counter. - (_stp_init_time): Ditto. - * autoconf-ktime-get-real.c : New file. - * autoconf-constant-tsc.c: Ditto. - * autoconf-tsc-khz.c: Ditto. - -2007-09-22 Frank Ch. Eigler <fche@elastic.org> - - PR 5057. - * stat-common.c (_stp_stat_print_histogram): Elide consecutive - zero rows beyond 2*STAT_ELISION+1. - (STAT_ELISION): New parameter, default 2. - -2007-09-21 Martin Hunt <hunt@redhat.com> - PR 5024 - * stat-common.c (_stp_stat_print_histogram): Change - overflow and underflow handling for linear histograms. - (__stp_stat_add): For linear histograms, use under - and over buckets. - -2007-09-19 Martin Hunt <hunt@redhat.com> - PR 5042 - * procfs.c (_stp_rmdir_proc_module): Warn if removal of - /proc/systemtap/module is deferred. Do not defer removal of - /proc/systemtap. - (_stp_mkdir_proc_module): Call path_release(). Set ownership of - /proc/systemtap/module to force deletion to be deferred. - (_stp_create_procfs): Set owner of all path components. - -2007-09-14 Martin Hunt <hunt@redhat.com> - - * procfs.c (_stp_create_procfs): Be sure that directories in the path - are really directories and not files. - -2007-09-13 David Smith <dsmith@redhat.com> - - * procfs.c (_stp_procfs_dir_lookup): Added 'const' qualifier to - 'dir' parameter. - (_stp_create_procfs): Added 'const' qualifier to 'path' - parameter. Removed debug prints. - (_stp_close_procfs): Removed debug prints. - -2007-09-12 Martin Hunt <hunt@redhat.com> - - * map-stat.c (_stp_map_new_hstat_log): Set buckets to - HIST_LOG_BUCKETS. - (_stp_pmap_new_hstat_log): Ditto. - (_stp_map_new_hstat_linear): Call _stp_stat_calc_buckets(). - (_stp_pmap_new_hstat_linear): Ditto. - - * stat.h (STP_MAX_BUCKETS): Define.. - (HIST_LOG_BUCKETS): Define. - - * stat.c (_stp_stat_init): Call _stp_stat_calc_buckets(). - - * stat-common.c (_stp_stat_calc_buckets): New function. Common - bucket calculation and error reporting code. - (_stp_bucket_to_val): New function. - (_stp_val_to_bucket): Renamed and now handles negative numbers. - (_stp_stat_print_histogram): Handle negative values in log histograms. - (__stp_stat_add): Cleanup.. - - * map-gen.c (_stp_map_new): Remove buckets param for HIST_LOG. - * pmap-gen.c (_stp_pmap_new): Ditto. - -2007-09-10 Martin Hunt <hunt@redhat.com> - - * procfs.c: New file. Common runtime procfs functions. - -2007-08-20 Martin Hunt <hunt@redhat.com> - - * stack.c (_stp_kta): Removed. - -2007-08-20 Masami Hiramatsu <mhiramat@redhat.com> - - * stack-x86_64.c: Fix backtrace to use the value of stack register - instead of its address. - -2007-08-17 Martin Hunt <hunt@redhat.com> - - * bench2/bench.rb: Send HUP to stapio, instead of staprun. - -2007-08-10 Josh Stone <joshua.i.stone@intel.com> - - PR 4593 - * loc2c-runtime.h (deref, store_deref): Set an error message with - the pointer value and name into last_error, since it's hard to - determine the details once you've already jumped to deref_fault. - -2007-07-09 Martin Hunt <hunt@redhat.com> - - * sym.h (STP_MAX_MODULES): Raise limit to 256. - -2007-07-06 Martin Hunt <hunt@redhat.com> - - * stat-common.c (__stp_stat_add): Fix calculations - for linear histogram buckets. - - * stat.c (_stp_stat_init): Check for interval too - small. - -2007-07-05 Eugene Teo <eteo@redhat.com> - - * regs.c (_stp_print_regs): #ifdef CONFIG_CPU_CP15 instead. - -2007-07-02 Martin Hunt <hunt@redhat.com> - - * sym.c (_stp_kallsyms_lookup): Improve heuristic - for determining when a pointer is in a function. - (_stp_func_print): New function. - * stack-i386.c, stack-x86_64.c: Remove obsolete - unwind code. Use _stp_func_print(). - -2007-06-22 Frank Ch. Eigler <fche@elastic.org> - - * string.c (_stp_text_str): Fix handling of embedded - " and \ characters. - -2007-06-21 David Smith <dsmith@redhat.com> - - * lket/b2a/Makefile.in: Regenerated with automake 1.10. - -2007-06-15 Martin Hunt <hunt@redhat.com> - From Quentin Barnes. - * loc2c-runtime.h: Latest arm marcos. - * stack-arm.c (__stp_stack_print): Add a cast. - * regs.c (_stp_ret_addr): Define for arm. - -2007-06-07 Martin Hunt <hunt@redhat.com> - PR 4075 fix from Ananth Mavinakayanahalli - * string.h (_stp_get_user): Define. - * string.c (_stp_text_str): Use _stp_get_user(). - -2007-05-30 Martin Hunt <hunt@redhat.com> - - Patch from Quentin Barnes. - * arith.c: Add arm support for 64-bit division. - * copy.c: Enable arm support. - * loc2c-runtime.h: Ditto. - * regs.[ch]: Ditto. - * stack.c: Include stack-arm.c. - * stack-arm.c: New file. - * time.c (_stp_gettimeofday_ns): hack - for arm. See PR 4569. - -2007-05-29 Frank Ch. Eigler <fche@elastic.org> - - PR 4458 - * print_new.c (_stp_print_flush): Use interrupt-disabling - spinlock variants. - -2007-05-29 Frank Ch. Eigler <fche@redhat.com> - - PR 2224 - * map.h (NEED_MAP_LOCKS): New config macro, defaults to 0. - (MAP_GET_CPU, MAP_PUT_CPU): Wrappers, default to ~no-op. - * map.c (_stp_pmap_clear,agg): Use them. - * pmap-gen.c (_stp_pmap_new,set,add,get_cpu,get,del): Ditto. - -2007-05-15 Martin Hunt <hunt@redhat.com> - - * vsprintf.c: Add comment about %p. - * regs.c, stack*.c, sym.c: Fix %p calls. - -2007-04-27 Martin Hunt <hunt@redhat.com> - - * runtime.h: Improve check for debugfs in kernel. - -2007-04-27 Frank Ch. Eigler <fche@elastic.org> - - * autoconf-inode-private.c: New file from hunt. - -2007-04-04 Sébastien Dugué <sebastien.dugue@bull.net> - - * runtime/lket/b2a/lket_b2a.c: Fix percpu files parsing - for percpu_header transport changes. - -2007-04-05 Martin Hunt <hunt@redhat.com> - - * bench2/var_bench, var.st, const.st: New test. - -2007-04-05 Martin Hunt <hunt@redhat.com> - - * bench2/bench.rb (Stapbench::run): Check result code - of "killall staprun". If it is nonzero, something happened to - staprun. Print an error. - (Stapbench::load): Define STP_NO_OVERLOAD. - * bench2/README: Update. - * bench2/print_bench: New set of tests. - -2007-03-22 Frank Ch. Eigler <fche@elastic.org> - - * sym.c (_stp_module_relocate): Tolerate empty section string. - -2007-03-21 Martin Hunt <hunt@redhat.com> - - - * sym.h: Declare _stp_module_relocate. - * sym.c (_stp_module_relocate): Add comments, reformat, add - a way for "last" cached values to be cleared when modules - are removed. - (_stp_symbol_print): Simplify and remove static buffer. - (_stp_symbol_snprint): Ditto. - -2007-03-21 Martin Hunt <hunt@redhat.com> - - * map.c (_stp_map_init): Fix signed vs unsigned comparison warning. - -2007-03-20 Frank Ch. Eigler <fche@elastic.org> - - PR 4224. - * sym.c (_stp_module_relocate): Support kernel relocations. - -2007-03-19 Frank Ch. Eigler <fche@elastic.org> - - * autoconf-hrtimer-rel.c: New file. - -2007-03-18 Martin Hunt <hunt@redhat.com> - - * stack.c, string.c, sym.c, transport/symbols.c: - Fix some signed vs unsigned comparison warnings. - -2007-03-14 Martin Hunt <hunt@redhat.com> - * stpd: Remove directory. - * relayfs: Remove directory. - -2007-03-14 Martin Hunt <hunt@redhat.com> - * bench2/bench.rb: Updated to work with new transport - and new itest.c. - * bench2/Makefile: Updated for new itest.c - * bench2/itest.c: Rewritten to use multiple threads - and automatically divide the workload among the threads. - - * print.c (_stp_print_flush): Move to print_new.c and - print_old.c. - * print_new.c: New file containing _stp_print_flush() - for the new transport. - * print_old.c: Ditto for old transport. - - * runtime.h (STP_OLD_TRANSPORT): Define - (errk): Define. - (MAXSTRINGLEN): Define if not already defined. - - * io.c (_stp_vlog): Use _stp_ctl_write(). - -2007-03-12 Frank Ch. Eigler <fche@redhat.com> - - PR 4179. - Based on patch from Vasily Averin <vvs@sw.ru>: - * time.c (_stp_init_time): Recover from partial failures. - -2007-03-01 David Wilder <dwilder@us.ibm.com> - - * loc2c-runtime.h: rewrote s390x version of __stp_put_asm - and __stp_put_asm to do single byte writes. - -2007-02-27 David Wilder <dwilder@us.ibm.com> - - * loc2c-runtime.h: Added defines for EX_TABLE needed by older - s390 kernels that do not already have it defined. - -2007-02-07 Martin Hunt <hunt@redhat.com> - - * stack-ppc64.c (__stp_stack_print): Remove an old - reference to the string length and instead limit backtraces - to MAXBACKTRACE. - * stack.c: Define MAXBACKTRACE - -2007-02-06 Josh Stone <joshua.i.stone@intel.com> - - * loc2c-runtime.h (kread): Let it work with const types. - -2007-01-31 Martin Hunt <hunt@redhat.com> - - * string.c (_stp_string_init): Deleted. - (_stp_sprintf): Deleted. - (_stp_vsprintf): Deleted. - (_stp_string_cat_cstr): Deleted. - (_stp_string_cat_string): Deleted. - (_stp_string_cat_char): Deleted. - (_stp_string_ptr): Deleted. - (_stp_string_cat): Deleted. - (_stp_snprintf): Moved from vsprintf.c. - (_stp_vscnprintf): Moved from vsprintf.c. - - * string.h (STP_STRING_SIZE): Deleted. - (STP_NUM_STRINGS): Deleted. - Remove all references to type "String". - - * vsprintf.c (_stp_vscnprintf): Moved to string.c. - (_stp_snprintf): Moved to string.c - - * sym.c (_stp_symbol_sprint): Replaced with - _stp_symbol_print, which writes to the print buffer. - (_stp_symbol_sprint_basic): Replaced with - _stp_symbol_snprint. - - * runtime.h: Include io.c. - - * stat-common.c: Use new _stp_print* functions. - * stat.c: Ditto. - - * regs.c: Renamed to regs-ia64.c. - * current.c: Renamed regs.c. - * regs-ia64.c: New file (renamed from regs.c). - - * stack.c (_stp_stack_sprint): Renamed _stp_stack_print - and now just prints to the print buffer. Calls - __stp_stack_print instead of __stp_stack_sprint. - (_stp_stack_snprint): New function. Calls _stp_stack_print and - then copies the print buffer into a string. - (_stp_stack_printj): Deleted. - (_stp_ustack_sprint): Deleted. - * stack-*.c: Rewritten to print instead of writing to strings. - Uses new _stp_print* functions. - - * print.c (_stp_printf): Create new function instead of macro. - (_stp_print): Ditto. - (_stp_print_char): New function. - - * map.c: Use _stp_print() and _stp_print_char() - instead of _stp_print_cstr(). - - * io.c (_stp_vlog): Use _stp_print() instead - of _stp_string_cat_cstr(). - - * copy.c (_stp_string_from_user): Deleted. - - -2007-01-30 Martin Hunt <hunt@redhat.com> - - * io.c (_stp_vlog): Use dynamic percpu allocations - instead of very wasteful static allocations. - * print.c (_stp_print_init): Do percpu allocations - for io.c. - (_stp_print_cleanup): Free percpu allocations. - - * string.c (_stp_sprintf): Overflow check needed - to be >= instead of >. - -2007-01-30 Martin Hunt <hunt@redhat.com> - - * alloc.c (_stp_alloc_percpu): Don't implement - our own; just call __alloc_percpu with appropriate args - for the OS version. - (_stp_free_percpu): Delete. - * map.c (_stp_map_init): When calling kmalloc_node, first - call cpu_to_node() to get the proper node number. - * stat.c (_stp_stat_del): Call free_percpu() - instead of _stp_free_percpu(). - -2007-01-29 Martin Hunt <hunt@redhat.com> - - * alloc.c (_stp_kmalloc): New function. Call kmalloc - with the correct flags and track usage. - (_stp_kzalloc): Ditto. - * map.c: Use new alloc calls. - * print.c: Ditto. - * stat.c: Ditto. - * time.c: Ditto. - -2007-01-25 Roland McGrath <roland@redhat.com> - - * loc2c-runtime.h (store_deref): Use "Zr" constraint for 64-bit case. - -2007-01-22 Josh Stone <joshua.i.stone@intel.com> - - * loc2c-runtime.h (kread, kwrite): Tweaks to work better with - reading and writing pointer values. - -2007-01-22 Martin Hunt <hunt@redhat.com> - - * map-gen.c (_stp_map_exists): New. Check for membership only. - -2007-01-19 Josh Stone <joshua.i.stone@intel.com> - - PR 3079 - * loc2c-runtime.h (kread, kwrite): New macros to safely read/write - values from kernel pointers. This includes a workaround for 64-bit - numbers on i386 platforms. - -2007-01-10 Martin Hunt <hunt@redhat.com> - - PR 3708 - * map.c (str_copy): Check for NULL pointers. - (_new_map_set_int64): Don't check val for 0. - (_new_map_set_str): Don't check val for NULL. - - * map-gen.c (VAL_IS_ZERO): Removed. - (_stp_map_del): New. - (__stp_map_set): Don't check for zero. - - * pmap-gen.c (VAL_IS_ZERO): Removed. - (_stp_pmap_del): New. - (__stp_pmap_set): Don't check for zero. - -2006-12-20 Martin Hunt <hunt@redhat.com> - - * runtime.h: Include mm.h. - -2006-12-20 Li Guanglei <guanglei@cn.ibm.com> - - * runtime/lket/b2a/lket_b2a.c: bugfix for NULL appname when - search appNameTree. - -2006-12-18 David Smith <dsmith@redhat.com> - - * lket/b2a/Makefile.in: Regenerated. This needed to be done since - lket/b2a/README was removed but lket/b2a/Makefile.in still had a - reference to it which was causing "make distdir" to fail. - -2006-12-18 Frank Ch. Eigler <fche@elastic.org> - - PR 3079 - * loc2c-runtime.h (deref, store_deref): Fork x86 and x86-64 - variants. Remove dysfunctional 64-bit ops from x86. - -2006-12-15 Frank Ch. Eigler <fche@elastic.org> - - * print.c (_stp_print_flush): Add a likely() marker to the hot path. - -2006-12-13 Frank Ch. Eigler <fche@elastic.org> - - * regs.h (s390x REG_IP): Parenthesize for warning-free builds. - -2006-12-08 Josh Stone <joshua.i.stone@intel.com> - - * runtime.h (param_set_int64_t, param_get_int64_t, - param_check_int64_t): New functions to allow taking module parameters - directly as int64_t values. - -2006-12-06 Josh Stone <joshua.i.stone@intel.com> - - * time.c (stp_timer_reregister): Add a global to control whether the - gettimeofday timer should restart itself, for clean shutdown. - (__stp_time_timer_callback): Check the global. - (_stp_kill_time, _stp_init_time): Set the global. - (_stp_gettimeofday_ns): Switch to preempt_enable_no_resched. - - * time.c (__stp_time_cpufreq_callback): Use the cpu# from the notifier. - (_stp_init_time): No need to disable preemption around cpufreq init. - -2006-12-04 Martin Hunt <hunt@redhat.com> - - * bench2/bench.rb: Fixes for the latest runtime - changes. - -2006-11-21 Li Guanglei <guanglei@cn.ibm.com> - - * runtime/lket/b2a/lket_b2a.[ch]: add b2a_error() and change - the error return codes. - -2006-11-19 Li Guanglei <guanglei@cn.ibm.com> - - * runtime/lket/b2a/lket_b2a.[ch]: bugfix for #3536 - -2006-11-15 Martin Hunt <hunt@redhat.com> - - * alloc.c (STP_ALLOC_FLAGS): Define. - Cleanup ifdefs. - * map.c: Use STP_ALLOC_FLAGS. - * stat.c: ditto. - -2006-11-10 Li Guanglei <guanglei@cn.ibm.com> - - * transport/procfs.c: bugfix of the obsolete buf_info - and consumed_info. - -2006-11-09 Martin Hunt <hunt@redhat.com> - - * sym.h: Change int to int32_t. - -2006-11-09 Li Guanglei <guanglei@cn.ibm.com> - - * runtime/lket/b2a/lket_b2a.[ch]: add options to control - the output data fields of lket.out - -2006-11-02 Martin Hunt <hunt@redhat.com> - - * sym.c (_stp_module_relocate): New function. Needed by the - translator to relocate module symbols. - (_stp_kallsyms_lookup_name): Rewrite to use new symbol structs. - (_stp_kallsyms_lookup): Ditto. - - * sym.h: Declare the structures and arrays that contain all - the symbol and module information. - - * io.c (_stp_vlog, _stp_dbug): Make first parameter const. - * runtime.h: Update prototype for _stp_dbug. - -2006-10-27 Thang Nguyen <thang.p.nguyen@intel.com> - - * runtime/regs.c: patch from Bibo Mao for fixing the return - value on IA64 (bz #3404). - -2006-10-24 Li Guanglei <guanglei@cn.ibm.com> - - * runtime/lket/b2a/lket_b2a.[ch]: be sync with LKET hookid - rearrangement. - -2006-10-23 Li Guanglei <guanglei@cn.ibm.com> - - * runtime/lket/b2a/lket_b2a.c: bugfix of event description - data insert. - -2006-10-12 Martin Hunt <hunt@redhat.com> - - * stack-ppc64.c (__stp_stack_sprint): Declare sp before _sp. - -2006-10-12 Martin Hunt <hunt@redhat.com> - - * stack.c: Reorganize and split arch-specific functions to - separate files. - (_stp_kta): Better checking. - (_stp_stack_sprint): Better handling of return probes. - - * stack-i386.c: New file. Uses 2.6.18 DWARF unwinder if available. - * stack-x86_64.c: New file. Uses 2.6.18 DWARF unwinder if available. - * stack-ppc64.c: New file. - * stack-ia64.c: New file. - - * sym.c (_stp_kallsyms_lookup_name): New function. Like - kallsyms_lookup_name() except use our internal lookup table. - -2006-10-10 Frank Ch. Eigler <fche@elastic.org> - - * runtime/lket/b2a/lket_b2a.c: Add several missing #ifdef HAS_MYSQL. - -2006-10-10 Li Guanglei <guanglei@cn.ibm.com> - - * runtime/lket/b2a/lket_b2a.c, runtime/lket/b2a/lket_b2a.h: - clean up the unused database tables and destory GTree on exit. - -2006-10-10 Li Guanglei <guanglei@cn.ibm.com> - - * runtime/lket/b2a/Makefile.am: add the checking and optional - compiling for mysql client library - * runtime/lket/b2a/Makefile.in: regenerated - * runtime/lket/b2a/lket_b2a.c, runtime/lket/b2a/lket_b2a.h: - Adding the support of automatically database creation and - dumping lket trace into mysql database - -2006-10-09 Josh Stone <joshua.i.stone@intel.com> - - From David Wilder <dwilder@us.ibm.com> - * time.c (__stp_estimate_cpufreq): Short-circuit on s390. - (_stp_gettimeofday_ns): Use a fixed formula on s390 to - convert TOD clocks to nanoseconds. - -2006-09-27 Martin Hunt <hunt@redhat.com> - - * stack.c (_stp_kta): Rewrite. Use the _stap_symbols - struct instead of calling into the kernel. - - * sym.c (_stp_kallsyms_lookup): Move here from runtime.h - - * runtime.h: Get rid of all the symbol stuff that - did not belong here. - -2006-09-26 David Smith <dsmith@redhat.com> - - * README: Changed 'stpd' references to 'staprun'. - * README.doc: Ditto. - * TODO: Ditto. - * io.c: Ditto. - * print.c: Ditto. - * runtime.h: Ditto. - * bench2/bench.rb: Ditto. - -2006-09-26 Martin Hunt <hunt@redhat.com> - - * time.c (_stp_init_time): Use dynamic percpu allocations - instead of evil static allocations. - (_stp_kill_time): Free percpu allocations and set - _stp_time to NULL so the timers are only deleted once. - -2006-09-26 Martin Hunt <hunt@redhat.com> - - * io.c (_stp_vlog): Remove ifdef for STP_RELAYFS. Relayfs now - behaves the same as procfs. - -2006-09-22 Martin Hunt <hunt@redhat.com> - - * print.c: Replace STP_PRINT_BUF_LEN with STP_BUFFER_SIZE. - * string.c: Ditto. - -2006-09-21 Martin Hunt <hunt@redhat.com> - - PR 3232 - * print.c (_stp_print_init): New. Alloc per-cpu buffers. - (_stp_print_cleanup): New. Free per-cpu buffers. - (_stp_print_flush): Use per_cpu_ptr(). - * string.c (_stp_sprintf): Ditto. - (_stp_vsprintf): Ditto. - (_stp_string_cat_cstr): Ditto. - (_stp_string_cat_char): Ditto. - -2006-09-20 Josh Stone <joshua.i.stone@intel.com> - - PR 3233 - * time.c (stp_time_t): Use ns for the base time, and freq is now kHz. - (__stp_estimate_cpufreq): Compute kHz instead of MHz. - (__stp_time_timer_callback, __stp_init_time): Compute base in ns. - (__stp_time_cpufreq_callback): Record kHz instead of MHz. - (_stp_init_time): Record kHz, and disable preemption to avoid a race - in the cpufreq notifier. - (_stp_gettimeofday_ns): Converted from _stp_gettimeofday_us. - - * lket/b2a/lket_b2a.c (main): Correct arguments to fseek. - (dump_data): Work around a spurious compiler warning. - -2006-09-19 Li Guanglei <guanglei@cn.ibm.com> - - * lket/b2a/lket_b2a.c, lket/b2a/lket_b2a.h: - Be sync with the recent runtime printing changes made by Martin. - Some clean up work before adding the support of dumping data - into MySQL - Bug fix of segment fault when an event is not registered. - -2006-09-18 Josh Stone <joshua.i.stone@intel.com> - - PR 3220 - From Eugeniy Meshcheryakov <eugen@debian.org>: - * lket/b2a/lket_b2a.c: Check that appNameTree exists before destroying. - -2006-09-18 Martin Hunt <hunt@redhat.com> - - * bench2/bench.rb: Remove the deprecated "-m" option - to stpd. Also, don't use merge mode for relayfs. - * bench2/run_binary_print: New test. Compare various ways of - printing binary data. - -2006-09-18 Martin Hunt <hunt@redhat.com> - - * print.c (_stp_print_flush): Rewrite so one version works for - relayfs or procfs. Use proper per-cpu functions. - (_stp_reserve_bytes): New function. Reserve bytes in the output buffer. - (_stp_print_binary): New function. Write a variable number of - 64-bit values directly into the output buffer. - - * string.c (_stp_sprintf): Rewrite using new per-cpu buffers. - (_stp_vsprintf): Ditto. - (_stp_string_cat_cstr): Ditto. - (_stp_string_cat_char): Ditto. - - * runtime.h: Set defaults for MAXTRYLOCK and TRYLOCKDELAY to make - runtime tests in bench2 happy. - -2006-08-29 Li Guanglei <guanglei@cn.ibm.com> - - From Gui Jian <guijian@cn.ibm.com> - * lket/b2a/lket_b2a.c, lket/b2a/lket_b2a.h: - add the support to get_cycles() and sched_clock() timing - mechanism for LKET. - -2006-08-14 Will Cohen <wcohen@redhat.com> - - PR 3037 - * string.c: - * print.c: Remove includes for <linux/config.h>. - -2006-08-11 David Smith <dsmith@redhat.com> - - * lket/b2a/.cvsignore: Added file to let cvs ignore generated - files. - -2006-07-21 Martin Hunt <hunt@redhat.com> - - * runtime.h: Include compat.h. - -2006-07-20 Martin Hunt <hunt@redhat.com> - - * vsprintf.c (_stp_vsnprintf): %p format fixes. - -2006-07-14 Josh Stone <joshua.i.stone@intel.com> - - PR 2922 - * time.c (_stp_init_time): call cpufreq_get for each cpu from - a non-atomic context (module init time). - * time.c (__stp_init_time): remove call to cpufreq_get from IPI. - - * time.c (__stp_time_timer_callback): disable IRQ's to avoid - perturbations in measurements. - * time.c (_stp_gettimeofday_us): disable preemption to avoid CPU - swaps while we're computing the time. - -2006-07-12 Martin Hunt <hunt@redhat.com> - - * runtime.h (for_each_cpu): Define for new kernels - which no longer define it. - -2006-07-11 Martin Hunt <hunt@redhat.com> - - * string.c (_stp_text_str): Use __get_user(). - -2006-07-11 Martin Hunt <hunt@redhat.com> - - * string.c (_stp_text_str): Add a parameter to support - userspace strings too. - * string.h: (_stp_text_str): Fix proto. - -2006-07-11 Li Guanglei <guanglei@cn.ibm.com> - - * lket/b2a/lket_b2a.c: modified to be sync with - the new addevent.process event hooks - -2006-06-29 Li Guanglei <guanglei@cn.ibm.com> - - * lket/b2a/lket_b2a.c, lket/b2a/lket_b2a.h: modified to be - sync with new _lket_trace() - -2006-06-27 Roland McGrath <roland@redhat.com> - - * loc2c-runtime.h: Add some comments. - -2006-06-23 Josh Stone <joshua.i.stone@intel.com> - - * time.c: Do cpufreq notification only if CONFIG_CPU_FREQ defined. - -2006-06-21 Josh Stone <joshua.i.stone@intel.com> - - PR 2525 - * time.c: Time-estimation with minimal dependency on xtime. - -2006-06-16 Roland McGrath <roland@redhat.com> - - * lket/b2a/Makefile.in: Regenerated with automake-1.9.6-2. - -2006-06-09 Li Guanglei <guanglei@cn.ibm.com> - - * lket/b2a/lket_b2a.c, lket/b2a/lket_b2a.h: Rewrite - according to the latest LKET's tapsets. Make it able - to read the metainfo wrote by tapsets. - -2006-06-02 Li Guanglei <guanglei@cn.ibm.com> - - * lket/b2a/lket_b2a.c: eliminate some compile warnings - -2006-06-01 Li Guanglei <guanglei@cn.ibm.com> - - * lket/b2a/lket_b2a.h, lket/b2a/lket_b2a.c: make it able to - read user added trace data and backtrace - -2006-05-30 Martin Hunt <hunt@redhat.com> - - * string.c (_stp_text_str): New function. - * string.h (_stp_text_str): Declare. - -2006-05-25 Martin Hunt <hunt@redhat.com> - - * vsprintf.c (_stp_vsnprintf): Change %p to work like - libc and automatically insert "0x" before the pointer. - -2006-05-24 Josh Stone <joshua.i.stone@intel.com> - - PR 2677 - * sym.c (_stp_symbol_sprint_basic): New function that returns - just the symbol name, and doesn't bother with String. - -2006-05-24 Li Guanglei <guanglei@cn.ibm.com> - - * lket/b2a/Makefile.am, lket/b2a/Makefile.in, - lket/b2a/README, lket/b2a/lket_b2a.c, - lket/b2a/lket_b2a.h: a binary to ascii converter used - to convert LKET's default binary trace data. - -2006-05-09 Li Guanglei <guanglei@cn.ibm.com> - - PR 2647 - Patch given by Gui Jian <guij@cn.ibm.com> - * vsprintf.c: %0s support to print null-terminated string - -2006-05-03 Josh Stone <joshua.i.stone@intel.com> - - * loc2c-runtime.h (deref_string): resolved gcc "warning: - assignment makes integer from pointer without a cast" when - using a pointer as the source address. - -2006-04-28 Martin Hunt <hunt@redhat.com> - - * vsprintf.c (_stp_vsnprintf): Fix argument size for %p. - -2006-04-17 Martin Hunt <hunt@redhat.com> - - * vsprintf.c (_stp_vsnprintf): Fix endian - before writing binary. - (_stp_endian): New variable to control endianess. - -2006-04-11 Tom Zanussi <zanussi@us.ibm.com> - - * print.c (_stp_print_flush): Change TIMESTAMP_SIZE to - STP_TIMESTAMP_SIZE to avoid conflicts with Suse kernels. - -2006-04-10 Martin Hunt <hunt@redhat.com> - - * string.c (_stp_string_cat_cstr): No need to copy - terminating 0. - - * vsprintf.c (_stp_snprintf): New function. - - * stat-common.c (_stp_stat_print_histogram): Write a - newline at the end of the histogram. - -2006-04-09 Martin Hunt <hunt@redhat.com> - - * print.c (_stp_print_flush): Send 'len" bytes - instead of 'len+1', which included terminating 0. - - * string.c (_stp_sprintf): Call _stp_vsnprintf() - instead of vsnprintf(). - (_stp_vsprintf): Ditto. - - * vsprintf.c: New file. - -2006-04-05 Will Cohen <wcohen@redhat.com> - - * string.h (__stp_stdout): Correct initialization. - -2006-03-30 Martin Hunt <hunt@redhat.com> - - * string.c (_stp_string_cat_cstr): Use memcpy() instead of strncpy(). - -2006-03-26 Martin Hunt <hunt@redhat.com> - - * bench2/bench.rb (Bench::run): Instead of loading the module - once and running against different numbers of threads, load - and unload the module each time. Then keep track of failures - per thread. Also use the new itest to keep the tests the same - size regardless of the number of threads. - (Bench::initialize): Make itest if needed. - (Bench::load, Stapbench::load): Increase buffer size to 8MB. - - * bench2/itest.c: Change arg to be the number of threads - instead of the number of millions of calls to make. - This makes it easy to divide the work among multiple threads - without making the test run many times longer. - -2006-03-09 Martin Hunt <hunt@redhat.com> - - * bench2: New directory containing a benchmark framework. - -2006-02-10 Martin Hunt <hunt@redhat.com> - - * copy.c (_stp_copy_from_user): Revert previous incorrect change. - -2006-02-09 Martin Hunt <hunt@redhat.com> - - * copy.c (_stp_copy_from_user): If access fails, - return -1. - -2006-01-25 Martin Hunt <hunt@redhat.com> - - * stat.c (_stp_stat_init): Use _stp_alloc_percpu(). - (_stp_stat_del): New function. - - * alloc.c (_stp_alloc_percpu): New function. - (_stp_free_percpu): New function. - -2006-01-19 Martin Hunt <hunt@redhat.com> - - * pmap-gen.c (_stp_pmap_get): Fix bug where old data - from agg map could be returned after element was deleted. - -2006-01-16 Josh Stone <joshua.i.stone@intel.com> - - * stat.c (_stp_stat_clear): add a function that just - clears a Stat, so we can use delete in the translator. - -2006-01-16 Martin Hunt <hunt@redhat.com> - - * map.c (_stp_pmap_agg): Return NULL when aggregation - fails. - -2006-01-15 Frank Ch. Eigler <fche@elastic.org> - - * io.c (_stp_exit): Revert. - -2006-01-10 Martin Hunt <hunt@redhat.com> - - * io.c (_stp_exit): set STAP_SESSION_STOPPING. - -2006-01-03 Frank Ch. Eigler <fche@redhat.com> - - * io.c (_stp_softerror): New function. - -2005-12-14 Martin Hunt <hunt@redhat.com> - - * pmap-gen.c (_stp_pmap_new_*): Initialize lock. - (_stp_pmap_set_*): Lock map while in use. - (_stp_pmap_add_*): Lock map while in use. - (_stp_pmap_get_cpu): Ditto. - (_stp_pmap_get): Lock each per-cpu map. - - * map-gen.c: Define and use NULLRET for a NULL return value. - * map.c (_stp_pmap_clear): New function. - (_stp_pmap_agg): Lock each per-cpu map as - it gets aggregated. - -2005-12-13 Martin Hunt <hunt@redhat.com> - - * map.c (_stp_map_sortn): Set a limit of 30 for n. Automatically - call _stp_map_sort() if more is requested. - -2005-12-08 Martin Hunt <hunt@redhat.com> - - * map.c (_new_map_create): Only increment map size if a node - was moved off the free list. - (_stp_map_size): New function. - (_stp_pmap_size): New function. - -2005-12-07 Martin Hunt <hunt@redhat.com> - - PR1923 - * map.h (struct map_root): Remove membuf. - (struct pmap): Define. - (PMAP): Declare. - - * map.c (_stp_map_init): Use kmalloc() to allocate individual - nodes instead of using vmalloc() to allocate one big chunk. - (_stp_map_new): Use kmalloc. - (_stp_pmap_new): Use kmalloc. Return a PMAP. - (__stp_map_del): New function. Free all the nodes in a map. - (_stp_map_del): Call __stp_map_del() then free map struct. - (_stp_pmap_del): Takes a PMAP. Calls __stp_map_del() for - each cpu. - (_stp_pmap_printn_cpu): Change arg to PMAP. - (_stp_pmap_agg): Change arg to PMAP. - (_stp_pmap_get_agg): Change arg to PMAP. - - * map-stat.c (_stp_pmap_new_hstat_linear): Use PMAP - instead of MAP. Fix allocations. - (_stp_pmap_new_hstat_log): Ditto. - - * pmap-gen.c Fix all functions to take or return PMAPS - instead of MAPS. - - * alloc.c: Remove everything except kmalloc_node(). - All runtime code now uses kmalloc() directly. - -2005-11-30 Martin Hunt <hunt@redhat.com> - - * io.c (_stp_exit): To prevent any possible interactions - with the probed function, just set a flag here. - -2005-11-28 Graydon Hoare <graydon@redhat.com> - - * stat-common.c (_stp_stat_print_histogram): Various formatting - corrections and aesthetic tweaks. - (__stp_stat_add): Correction to linear bucket underflow cases. - -2005-11-28 Martin Hunt <hunt@redhat.com> - - * alloc.c (__stp_valloc_percpu): Use same code for up and smp. - (_stp_per_cpu_ptr): New macro. - * user/alloc.c: Ditto. - * map.c: Use _stp_map_cpu_ptr(). - * map-stat.c: Ditto. - * pmap-gen.c: Ditto. - * runtime.h: Include alloc.c - * user/runtime.h: Ditto. - - * map.c (_stp_pmap_del): Use _stp_free_percpu() to - free pmaps. - - * map-stat.c (_stp_pmap_new_hstat_log): Fix typo. Call - _stp_pmap_new() instead of _stp_map_new(). - -2005-11-11 Martin Hunt <hunt@redhat.com> - - * map.h: Removed old API macros and prototypes. - -2005-11-10 Martin Hunt <hunt@redhat.com> - - * pmap-gen.c (_stp_pmap_get()): New function. Aggregates - the per-cpu map nodes into an aggregation map node. - - * map.c (_stp_new_agg): Return a struct map_node *. - (_stp_add_agg): If count is 0 when adding, - just set the stats. - -2005-11-10 Martin Hunt <hunt@redhat.com> - - * map.c: Doc updates. - (_stp_new_agg): - - * pmap-gen.c: Change a bunch of generated function names to - avoid conflicts with maps with the same key and value types. - -2005-11-10 Martin Hunt <hunt@redhat.com> - - * map.c (_stp_cmp): Use _stp_div64(). - -2005-11-09 Martin Hunt <hunt@redhat.com> - - * map.h: Remove HSTAT_LOG and HSTAT_LINEAR. - * map-gen.c: Fix comment. - * pmap-gen.c: Ditto. - -2005-11-09 Martin Hunt <hunt@redhat.com> - - * map.c (_stp_cmp): Patch to sort on stats. - (_stp_map_sort): Ditto. - (_stp_map_sortn): Ditto. - -2005-11-09 Martin Hunt <hunt@redhat.com> - - * map.c: Change order of includes. - -2005-11-09 Martin Hunt <hunt@redhat.com> - - * map.h (struct map_root): Delete fields - used by old API. - - * map.c: Remove old map API functions. - * map-stat.c (_stp_map_add_stat): Delete. - (_stp_pmap_new_hstat_linear): Move here from map.c. - (_stp_pmap_new_hstat_log): Ditto. - - * list.c: Deleted. - * map-keys.c: Deleted. - * map-values.c: Deleted. - * map-int.c: Deleted. - -2005-11-08 Martin Hunt <hunt@redhat.com> - - * alloc.c (__stp_valloc_percpu): Fix call to vmalloc_node. - (vmalloc_node): Remove nonworking code. - -2005-11-08 Martin Hunt <hunt@redhat.com> - - * map.c (_stp_map_init): New function. Extracted from _stp_map_new() - so it can be used in _stp_pmap_new(). - (_stp_map_new): Call _stp_map_init(). - (_stp_pmap_new): New function. - (_stp_pmap_new_hstat_linear): New function. - (_stp_pmap_new_hstat_log): New function. - (_stp_pmap_del): New function. - (_stp_pmap_printn_cpu): New function. - (_stp_pmap_printn): New function. - (_stp_new_agg): New function. - (_stp_add_agg): New function. - (_stp_pmap_agg): New function. - (_new_map_clear_node): New function. - - * map.h (struct map_root): Add Hist struct. Add copy - and cmp function pointers for pmaps. - - * stat.h: Remove Stat struct. Replace with Hist struct - that is limited to only histogram params. - * map-stat.c: Fix up references to histogram params in map_root. - * stat-common.c: Ditto. - * stat.c: Ditto. - - * pmap-gen.c: New file. Implements per-cpu maps. - - * map-gen.c: Minor bug fixes. Use new VAL_IS_ZERO() macro. - - * alloc.c (vmalloc_node): For NUMA, provide a vmalloc that - does node-local allocations. - (_stp_alloc_cpu): A version of _stp_alloc() that does - node-local allocations. - (_stp_valloc): A version of _stp_valloc() that does - node-local allocations. - (__stp_valloc_percpu): New function. Like alloc_percpu() - except uses _stp_valloc(). - (_stp_vfree_percpu): New function. Like free_percpu(). - -2005-11-04 Martin Hunt <hunt@redhat.com> - - * runtime.h: #include <linux/version.h>. - (init_module): Remove old ppc comment. - ifdef _stp_kta so it only gets set for x86 and x86_64. - -2005-10-31 Martin Hunt <hunt@redhat.com> - - * ALL: Cleanup copyrights. - -2005-10-28 Martin Hunt <hunt@redhat.com> - - * map-gen.c (MAP_GET_VAL): Use the _stp_get_*() functions. - (_stp_map_set_*): When setting to "", don't create - node if key not found. - (_stp_map_get_*): Use new MAP_GET_VAL. Return "" when - string lookups not found. - - * map.c (_stp_get_int64): Check args and return - 0 on bad args or wrong type. - (_stp_get_stat): Ditto. - (_stp_key_get_int64): Ditto. - (_stp_get_str): Check args and return - "bad type" on bad args or wrong type. - (_stp_key_get_str): Ditto. - (_new_map_set_str): If setting to "", delete node. - (_new_map_get_*): Delete. Use _stp_get_*(). - - -2005-10-26 Martin Hunt <hunt@redhat.com> - - * map-gen.c (KEY4CPY): Fix typo. - (KEYCPY): Add missing semicolon. - -2005-10-26 Martin Hunt <hunt@redhat.com> - - * map-gen.c: New file. - - * map.c (_new_map_create, _new_map_del_node, _new_map_del_node, - _new_map_set_int64, _new_map_set_str,_new_map_get_int64, - _new_map_get_str, _new_map_get_stat, _new_map_set_stat): - New internal functions for the new API. - - * map-int.c (__stp_map_set_int64): Modify to return an - error code. - * map-stat.c (_stp_map_add_stat): Ditto. - * map-str (_stp_map_set_str): Ditto. - - * Doxyfile: Remove predefines NEED_STRING_VALS, - NEED_STATS, NEED_INT64. - * map-keys.c: Ditto. - * list.c (_stp_list_new): Ditto. Also set map->list. - * map-values.c: Ditto. - -2005-10-19 Martin Hunt <hunt@redhat.com> - - * runtime.h (_stp_kallsyms_lookup_tabled): Only - compile this for systemtap. Runtime-only examples - don't need it. - -2005-10-19 Tom Zanussi <zanussi@us.ibm.com> - - * print.c (_stp_print_flush): Switch to binary TIMESTAMP. - -2005-10-14 Tom Zanussi <zanussi@us.ibm.com> - - PR 1455 - * string.c (_stp_sprintf): Restore overwritten NULL byte. - * print.c: Change STP_PRINT_BUF_LEN to correct size. - -2005-10-06 Frank Ch. Eigler <fche@elastic.org> - - PR 1332. - * sym.h: New file to declare explicit symbol table struct. - * runtime.h (_stp_kallsyms_lookup_tabled): Use it if available. - * sym.c (_stp_symbol_sprint): HAS_LOOKUP mooted. - -2005-09-30 Graydon Hoare <graydon@redhat.com> - - * loc2c-runtime.h (_put_user_asm): Fix bracket-matching. - -2005-09-23 Martin Hunt <hunt@redhat.com> - - * map.c (_stp_map_sortn): Call _stp_map_sort() - when n is 0. - -2005-09-23 Martin Hunt <hunt@redhat.com> - - * map.c (_stp_cmp): New comparison function for sorts. - (_stp_swap): New swap function for bubble sort. - (_stp_map_sortn): New function. - (_stp_map_sort): New function. - (_stp_map_printn): New function. - (_stp_map_print): Convert to a macro. - -2005-09-22 Martin Hunt <hunt@redhat.com> - - * regs.h: PPC64 version from - Ananth N Mavinakayanahalli <ananth@in.ibm.com> - - * runtime.h (init_module): Only initialize _stp_kta and - _stp_kallsyms_lookup on i386 and x86_64. Define HAS_LOOKUP. - - * sym.c (_stp_symbol_sprint): If HAS_LOOKUP is not - defined, just print address in hex. - - * current.c (_stp_ret_addr): Add ppc64 version. - (_stp_sprint_regs): PPC64 version from - Ananth N Mavinakayanahalli <ananth@in.ibm.com> - -2005-09-14 Martin Hunt <hunt@redhat.com> - - * map.c (_stp_map_clear): New function. CLears a map but - does not free it. - - * copy.c (__stp_strncpy_from_user): Add ppc64 support. - (_stp_strncpy_from_user): Call access_ok(). - (_stp_string_from_user): Ditto. - (_stp_copy_from_user): Ditto. - -2005-09-12 Martin Hunt <hunt@redhat.com> - - * io.c (ERR_STRING): Remove ansi codes. - (WARN_STRING): Ditto. - -2005-09-12 Martin Hunt <hunt@redhat.com> - - * arith.c (_stp_div64): Check for division by 0 or -1 first. - This simplifies things and removes the possibility of x86_64 - trying LLONG_MIN/-1 and faulting. - (_stp_mod64): Ditto. - -2005-09-10 Frank Ch. Eigler <fche@elastic.org> - - * arith.c: Add some comments explaining why the last change works. - -2005-09-09 Roland McGrath <roland@redhat.com> - - * loc2c-runtime.h [__powerpc__] (store_register): Add #undef. - -2005-09-09 Martin Hunt <hunt@redhat.com> - - * stat-common.c (_stp_stat_print_valtype): Use _stp_div64(). - * arith.c (_stp_div64): Check error before writing to it. - Remove check against 32-bit LONG_MIN and -1. That only - applies to 64-bit. - (_stp_mod64): Ditto. - -2005-09-08 Martin Hunt <hunt@redhat.com> - - * arith.c (_stp_div64): Check for overflow. - (_stp_mod64): Ditto. - -2005-09-08 Martin Hunt <hunt@redhat.com> - - * arith.c (_stp_div64): For 64-bit cpus, just use native - division. Otherwise call _div64(). - (_stp_mod64): Call _mod64() isf necessary. - (_div64): 64-bit division for 32-bit cpus. - (_mod64): 64-bit modulo for 32-bit cpus. - - * map-values.c (_stp_map_entry_exists): Remove unused var. - -2005-09-01 Martin Hunt <hunt@redhat.com> - - * stack.c (_stp_stack_sprint): Add a verbose arg - to pass along to underlying funcs. - -2005-08-31 Martin Hunt <hunt@redhat.com> - - * runtime.h (init_module): Include full prototype - info in function cast to satisfy stap. - - * sym.c (_stp_kallsyms_lookup): Moved to runtime.h. - * stack.c (_stp_kta): Moved to runtime.h. - * runtime.h (init_module): Initialize _stp_kallsyms_lookup - and _stp_kta. - * probes.c (_stp_lookup_name): Replaced by kallsyms_lookup_name(). - * list.c (_stp_copy_argv_from_user): ifdef this function - NEED_STRING_VALS. - -2005-08-30 Roland McGrath <roland@redhat.com> - - * loc2c-runtime.h (fetch_register, store_register): Rewritten to pass - REGS to dwarf_register_<N> as a macro argument. - [__i386__, __x86_64__]: Update dwarf_register_* macros. - [__i386__] (dwarf_register_4): Define special case for stack pointer. - -2005-08-29 Martin Hunt <hunt@redhat.com> - - * list.c (_stp_copy_argv_from_user): Move to here. - * copy.c (_stp_copy_argv_from_user): Delete. - * runtime.h: Always include copy.h. - -2005-08-25 Roland McGrath <roland@redhat.com> - - * loc2c-runtime.h (deref_string): Rewritten using deref. - -2005-08-24 Roland McGrath <roland@redhat.com> - - * loc2c-runtime.h (deref_string): New macro. - -2005-08-24 Martin Hunt <hunt@redhat.com> - - * io.c (_stp_vlog): Send warnings and errors to STP_OOB_DATA. - -2005-08-23 Martin Hunt <hunt@redhat.com> - - * runtime.h: Add a prototype for _stp_dbug(). - -2005-08-22 Martin Hunt <hunt@redhat.com> - - * runtime.h (kbug): New dbug macros that calls printk. - -2005-08-21 Frank Ch. Eigler <fche@redhat.com> - - * arith.c (*): Adapt to last_error context variable. - -2005-08-19 Frank Ch. Eigler <fche@elastic.org> - - * arith.c (_stp_random_pm): New function. - -2005-08-19 Martin Hunt <hunt@redhat.com> - - * print.c: Change ifdefs to STP_RELAYFS. - * runtime.h: Ditto. - * io.c (_stp_vlog): Call _stp_write instead of - _stp_ctrl_send. - * Makefile: Don't build stp-control. - * README.doc: Update. - * TODO: Update. - -2005-08-12 Graydon Hoare <graydon@redhat.com> - - * map-values.c (_stp_map_entry_exists): New function. - * map.h (_stp_map_entry_exists): Declare it. - -2005-08-12 Frank Ch. Eigler <fche@elastic.org> - - * arith.c: New file to contain arithmetic helper functions. - * builtin_functions.h: Remove, unused. - * runtime.h: Include it. - -2005-08-10 Roland McGrath <roland@redhat.com> - - * loc2c-runtime.h (store_bitfield): Fix argument use. - (store_deref): New macro (three flavors). - -2005-08-03 Martin Hunt <hunt@redhat.com> - - * io.c (_stp_vlog): Revert previous change for now. - * print.c (_stp_print_flush): Ditto. - -2005-08-03 Tom Zanussi <trz@us.ibm.com> - - * io.c (_stp_vlog): Remove call to _stp_print_flush(). - * print.c (_stp_print_flush): _stp_warn() on first - transport failure. - -2005-08-01 Martin Hunt <hunt@redhat.com> - - * io.c (_stp_vlog): Use _stp_pid instead os _stp_tport->pid. - * print.c (_stp_print_flush): Don't need _stp_tport. - *runtime.h (probe_start): Just call _stp_transport_init(). - (probe_exit): Just call _stp_transport_close(). - -2005-07-28 Graydon Hoare <graydon@redhat.com> - - * loc2c-runtime.h: New file from elfutils CVS. - -2005-07-20 Martin Hunt <hunt@redhat.com> - - * io.c (_stp_vlog): Don't count transport failures for - these messages. - -2005-07-19 Martin Hunt <hunt@redhat.com> - - * print.c (_stp_print_flush): Check return value and increment - transport failures. - -2005-07-14 Frank Ch. Eigler <fche@redhat.com> - - * builtin_functions.h (printk): Use explicit format string. - -2005-07-11 Graydon Hoare <graydon@redhat.com> - - * builtin_functions.h: New file. - -2005-07-10 Martin Hunt <hunt@redhat.com> - - * runtime.h (init_module): Fix return value. - -2005-07-08 Martin Hunt <hunt@redhat.com> - - * runtime.h: Move some common pieces of modules into this file. - Includes MODULE_LICENSE, cleanup_module and init_module. - - * print.c (_stp_print_flush): Rename "t" to "_stp_tport". - - * io.c (_stp_vlog): Ditto. - -2005-07-01 Martin Hunt <hunt@redhat.com> - - * string.c (_stp_string_init): CAll stp_error() on bad - init. - - * list.c (_stp_list_clear): Call _stp_warn(). - - * probes.c: Convert all _stp_log() calls to either stp_warn() or - dbug(). - - * print.c: Comment out dbug()s. - - * stat-common.c: Comment out dbug()s. - - * map.c (_stp_map_new): Call _stp_error() on a bad map type. - Comment out dbug()s. - - * map-stat.c (_stp_map_new_hstat_log): Call _stp_warn(). - (_stp_map_new_hstat_linear): Ditto. - - * map-int.c: Comment out dbug()s. - - * map-str.c: Comment out dbug()s. - - * map-keys.c: Use _stp_warn(). Comment out dbug()s. - - * alloc.c (_stp_alloc): Call _stp_error(). - (_stp_valloc): Ditto. - - * io.c (_stp_warn): New function. - (_stp_exit): New function. - (_stp_error): New function. - (_stp_dbug): New function. - - * runtime.h (dbug): Call _stp_dbug() if DEBUG is defined. - -2005-06-29 Martin Hunt <hunt@redhat.com> - - * map-values.c (_stp_map_add_int64): Fix docs. - * map-str.c: Fix some docs - * map.c: Ditto. - * map.doc: Ditto. - - * current.c (_stp_ret_addr_r): New function. - (_stp_probe_addr): New function. - (_stp_probe_addr_r): New function. - -2005-06-27 Martin Hunt <hunt@redhat.com> - - * Doxyfile (PREDEFINED): Added USE_RET_PROBES. - - * probes.c (_stp_register_kretprobes): New function. - (_stp_unregister_kretprobes): New function. - -2005-06-20 Tom Zanussi <zanussi@us.ibm.com> - - * print.c: Made relayfs _stp_print_flush() use sequence counter. - - * runtime.h: Added sequence counter, moved subbuf_size etc to probes. - -2005-06-18 Martin Hunt <hunt@redhat.com> - - * counter.c: New file. Counter aggregations. - - * stat.c: New file. Stat aggregations. - - * stat.h: Header file for stats. - - * map-int.c: New file. Support for int64 values. - - * map-stat.c: New file. Support for stat values. - - * map-str.c: New file. Support for string values. - - * map-values.c: Now just includes the necessary map-*.c files. - - * stat-common.c: New file. Stats stuff common to Stats and maps - containing stats. - - * Doxyfile: Bumped version to 0.6. - - * README: Renamed README.doc and reorganized. - - -2005-06-15 Martin Hunt <hunt@redhat.com> - - * current.c (_stp_ret_addr): Fix computation for i386. - -2005-06-14 Martin Hunt <hunt@redhat.com> - - * README: Removed old docs and replaced with simple build - instructions. - - * Makefile: New file. - - * probes/build: New file. - -2005-06-13 Martin Hunt <hunt@redhat.com> - - * print.c (next_fmt): Move this func to print.c. - -2005-06-02 Martin Hunt <hunt@redhat.com> - - * string.c (_stp_string_cat_cstr): Be sure result is - always terminated. - - * print.c (_stp_vprintf): Fix typo. - -2005-05-31 Martin Hunt <hunt@redhat.com> - - * map.c (_stp_map_print): Now takes a format string instead of a name. - - * map.h (foreach): Update macro. - - * string.c (_stp_string_cat_char): New function. Append a char - to a string. - - * map-keys.c: Don't forget to undef KEYSYM, ALLKEYS and ALLKEYSD. - -2005-05-26 Martin Hunt <hunt@redhat.com> - - * current.c (_stp_sprint_regs): Implement for i386. - - * sym.c (_stp_symbol_sprint): Check name before trying to - print it. - (_stp_symbol_print): Change to macro that calls _stp_symbol_sprint(). - -2005-05-18 Martin Hunt <hunt@redhat.com> - - * print.c: All functions except _stp_print_flush() are - now macros which use _stp_stdout. - - * string.c: Add _stp_stdout support. Data written to - _stp_stdout is automatically flushed when the print buffer - is full. - - * runtime.h: Always include string.c. - -2005-05-17 Martin Hunt <hunt@redhat.com> - - * map.c (needed_space): Use do_div(). - (_stp_map_print_histogram): Ditto. - (_stp_map_print): Ditto. - - * map-values.c (_stp_map_add_int64_stat): Use do_div() when - computing histogram bucket. - - * map-keys.c (_stp_map_key): Fix some warnings on 32-bit machines - by using key_data casts. - -2005-03-30 Martin Hunt <hunt@redhat.com> - - * scbuf.c: Make functions use per-cpu buffers as documented. - _stp_scbuf_clear(): Now returns a pointer to the buffer. diff --git a/runtime/addr-map.c b/runtime/addr-map.c index 706da454..e898044f 100644 --- a/runtime/addr-map.c +++ b/runtime/addr-map.c @@ -30,7 +30,7 @@ struct addr_map static DEFINE_SPINLOCK(addr_map_lock); -struct addr_map* blackmap; +static struct addr_map* blackmap; /* Find address of entry where we can insert a new one. */ static size_t @@ -88,7 +88,7 @@ lookup_addr_aux(unsigned long addr, struct addr_map* map) return 0; } -int +static int lookup_bad_addr(unsigned long addr) { struct addr_map_entry* result = 0; @@ -102,7 +102,7 @@ lookup_bad_addr(unsigned long addr) } -int +static int add_bad_addr_entry(unsigned long min_addr, unsigned long max_addr, struct addr_map_entry** existing_min, struct addr_map_entry** existing_max) @@ -181,7 +181,7 @@ add_bad_addr_entry(unsigned long min_addr, unsigned long max_addr, return 0; } -void +static void delete_bad_addr_entry(struct addr_map_entry* entry) { } diff --git a/runtime/alloc.c b/runtime/alloc.c index cfdb97bd..89d16612 100644 --- a/runtime/alloc.c +++ b/runtime/alloc.c @@ -63,7 +63,7 @@ struct _stp_mem_entry { static LIST_HEAD(_stp_mem_list); -void _stp_check_mem_fence (char *addr, int size) +static void _stp_check_mem_fence (char *addr, int size) { char *ptr; int i; @@ -88,7 +88,7 @@ void _stp_check_mem_fence (char *addr, int size) } } -void *_stp_mem_debug_setup(void *addr, size_t size, enum _stp_memtype type) +static void *_stp_mem_debug_setup(void *addr, size_t size, enum _stp_memtype type) { struct list_head *p; struct _stp_mem_entry *m; @@ -108,7 +108,7 @@ void *_stp_mem_debug_setup(void *addr, size_t size, enum _stp_memtype type) } /* Percpu allocations don't have the fence. Implementing it is problematic. */ -void _stp_mem_debug_percpu(struct _stp_mem_entry *m, void *addr, size_t size) +static void _stp_mem_debug_percpu(struct _stp_mem_entry *m, void *addr, size_t size) { struct list_head *p = (struct list_head *)m; m->magic = MEM_MAGIC; @@ -120,7 +120,7 @@ void _stp_mem_debug_percpu(struct _stp_mem_entry *m, void *addr, size_t size) spin_unlock(&_stp_mem_lock); } -void _stp_mem_debug_free(void *addr, enum _stp_memtype type) +static void _stp_mem_debug_free(void *addr, enum _stp_memtype type) { int found = 0; struct list_head *p, *tmp; @@ -291,7 +291,7 @@ static void *_stp_kmalloc_node(size_t size, int node) } #endif /* LINUX_VERSION_CODE */ -void _stp_kfree(void *addr) +static void _stp_kfree(void *addr) { #ifdef DEBUG_MEM _stp_mem_debug_free(addr, MEM_KMALLOC); @@ -300,7 +300,7 @@ void _stp_kfree(void *addr) #endif } -void _stp_vfree(void *addr) +static void _stp_vfree(void *addr) { #ifdef DEBUG_MEM _stp_mem_debug_free(addr, MEM_VMALLOC); @@ -309,7 +309,7 @@ void _stp_vfree(void *addr) #endif } -void _stp_free_percpu(void *addr) +static void _stp_free_percpu(void *addr) { #ifdef DEBUG_MEM _stp_mem_debug_free(addr, MEM_PERCPU); @@ -318,7 +318,7 @@ void _stp_free_percpu(void *addr) #endif } -void _stp_mem_debug_done(void) +static void _stp_mem_debug_done(void) { #ifdef DEBUG_MEM struct list_head *p, *tmp; diff --git a/runtime/arith.c b/runtime/arith.c index 60576090..d1d0da29 100644 --- a/runtime/arith.c +++ b/runtime/arith.c @@ -21,21 +21,21 @@ /* Other 32-bit cpus will need to modify this file. */ #if defined (__i386__) || defined(__arm__) -long long _div64 (long long u, long long v); -long long _mod64 (long long u, long long v); +static long long _div64 (long long u, long long v); +static long long _mod64 (long long u, long long v); #endif /* 31 bit s390 suupport is not yet included, it may never be. #ifdef __s390__ -long long _div64 (long long u, long long v); -long long _mod64 (long long u, long long v); +static long long _div64 (long long u, long long v); +static long long _mod64 (long long u, long long v); #endif */ /** Divide x by y. In case of division-by-zero, * set context error string, and return 0 */ -int64_t _stp_div64 (const char **error, int64_t x, int64_t y) +static int64_t _stp_div64 (const char **error, int64_t x, int64_t y) { // check for division-by-zero if (unlikely (y == 0)) { @@ -61,7 +61,7 @@ int64_t _stp_div64 (const char **error, int64_t x, int64_t y) /** Modulo x by y. In case of division-by-zero, * set context error string, and return any 0 */ -int64_t _stp_mod64 (const char **error, int64_t x, int64_t y) +static int64_t _stp_mod64 (const char **error, int64_t x, int64_t y) { // check for division-by-zero if (unlikely (y == 0)) { @@ -88,7 +88,7 @@ int64_t _stp_mod64 (const char **error, int64_t x, int64_t y) /** Return a random integer between -n and n. * @param n how far from zero to go. Make it positive but less than a million or so. */ -int _stp_random_pm (int n) +static int _stp_random_pm (int n) { static unsigned long seed; static int initialized_p = 0; @@ -251,7 +251,7 @@ typedef union #endif #if !defined (count_leading_zeros) -const UQItype _stp_clz_tab[256] = +static const UQItype _stp_clz_tab[256] = { 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, @@ -286,7 +286,7 @@ const UQItype _stp_clz_tab[256] = #define COUNT_LEADING_ZEROS_0 W_TYPE_SIZE #endif -UDWtype +static UDWtype _stp_udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp) { const DWunion nn = {.ll = n}; @@ -499,7 +499,7 @@ _stp_udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp) return ww.ll; } -long long _div64 (long long u, long long v) +static long long _div64 (long long u, long long v) { long c = 0; DWunion uu = {.ll = u}; @@ -520,7 +520,7 @@ long long _div64 (long long u, long long v) return w; } -long long _mod64 (long long u, long long v) +static long long _mod64 (long long u, long long v) { long c = 0; DWunion uu = {.ll = u}; diff --git a/runtime/autoconf-procfs-owner.c b/runtime/autoconf-procfs-owner.c new file mode 100644 index 00000000..d64bf5e8 --- /dev/null +++ b/runtime/autoconf-procfs-owner.c @@ -0,0 +1,8 @@ +#include <linux/proc_fs.h> + +/* kernel commit 4d38a69c6 */ + +void bar (void) { + struct proc_dir_entry foo; + foo.owner = (void*) 0; +} diff --git a/runtime/autoconf-vm-area.c b/runtime/autoconf-vm-area.c new file mode 100644 index 00000000..920d103d --- /dev/null +++ b/runtime/autoconf-vm-area.c @@ -0,0 +1,9 @@ +#include <linux/vmalloc.h> +#include <asm/page.h> + +void foo (void) +{ + void *dummy; + dummy = alloc_vm_area (PAGE_SIZE); + free_vm_area (dummy); +} diff --git a/runtime/copy.c b/runtime/copy.c index 6bb22762..4fb87253 100644 --- a/runtime/copy.c +++ b/runtime/copy.c @@ -47,8 +47,7 @@ }) -long _stp_strncpy_from_user(char *dst, const char __user *src, long count); -//static long __stp_strncpy_from_user(char *dst, const char __user *src, long count); +static long __stp_strncpy_from_user(char *dst, const char __user *src, long count); #if defined (__i386__) #define __stp_strncpy_from_user(dst,src,count,res) \ @@ -131,7 +130,7 @@ do { \ * <i>count</i> bytes and returns <i>count</i>. */ -long _stp_strncpy_from_user(char *dst, const char __user *src, long count) +static long _stp_strncpy_from_user(char *dst, const char __user *src, long count) { long res = -EFAULT; if (access_ok(VERIFY_READ, src, count)) @@ -152,7 +151,7 @@ long _stp_strncpy_from_user(char *dst, const char __user *src, long count) * */ -unsigned long _stp_copy_from_user(char *dst, const char __user *src, unsigned long count) +static unsigned long _stp_copy_from_user(char *dst, const char __user *src, unsigned long count) { if (count) { if (access_ok(VERIFY_READ, src, count)) diff --git a/runtime/counter.c b/runtime/counter.c index a3c3669b..40ea66a0 100644 --- a/runtime/counter.c +++ b/runtime/counter.c @@ -52,7 +52,7 @@ typedef struct _counter *Counter; * * @return a Counter. Will be NULL on error. */ -Counter _stp_counter_init (void) +static Counter _stp_counter_init (void) { Counter cnt = _stp_alloc_percpu (struct _counter); #if NEED_COUNTER_LOCKS == 1 @@ -73,7 +73,7 @@ Counter _stp_counter_init (void) * @param cnt Counter * @param val int64 value */ -void _stp_counter_add (Counter cnt, int64_t val) +static void _stp_counter_add (Counter cnt, int64_t val) { Counter c = per_cpu_ptr (cnt, get_cpu()); COUNTER_LOCK(c); @@ -90,7 +90,7 @@ void _stp_counter_add (Counter cnt, int64_t val) * @param clear Set this to have the value cleared after reading. * @return An int64 value. */ -int64_t _stp_counter_get_cpu (Counter cnt, int cpu, int clear) +static int64_t _stp_counter_get_cpu (Counter cnt, int cpu, int clear) { int64_t val; Counter c = per_cpu_ptr (cnt, cpu); @@ -114,7 +114,7 @@ int64_t _stp_counter_get_cpu (Counter cnt, int cpu, int clear) * @param clear Set this to have the value cleared after reading. * @return An int64 value. */ -int64_t _stp_counter_get (Counter cnt, int clear) +static int64_t _stp_counter_get (Counter cnt, int clear) { int i; int64_t sum = 0; @@ -133,7 +133,7 @@ int64_t _stp_counter_get (Counter cnt, int clear) /** Free a Counter. * @param cnt Counter */ -void _stp_counter_free (Counter cnt) +static void _stp_counter_free (Counter cnt) { _stp_free_percpu (cnt); } diff --git a/runtime/debug.h b/runtime/debug.h index 9b2fe5c5..e8b2e701 100644 --- a/runtime/debug.h +++ b/runtime/debug.h @@ -14,7 +14,7 @@ * _dbug() writes to systemtap stderr. * errk() writes to the system log. */ -int _stp_transport_state = 0; +static int _stp_transport_state = 0; #define _dbug(args...) _stp_dbug(__FUNCTION__, __LINE__, args) diff --git a/runtime/io.c b/runtime/io.c index c49d86e6..8ddb53ac 100644 --- a/runtime/io.c +++ b/runtime/io.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * I/O for printing warnings, errors and debug messages - * Copyright (C) 2005-2008 Red Hat Inc. + * Copyright (C) 2005-2009 Red Hat Inc. * * This file is part of systemtap, and is free software. You can * redistribute it and/or modify it under the terms of the GNU General @@ -56,24 +56,6 @@ static void _stp_vlog (enum code type, const char *func, int line, const char *f put_cpu(); } -/** Logs Data. - * This function sends the message immediately to staprun. It - * will also be sent over the bulk transport (relayfs) if it is - * being used. If the last character is not a newline, then one - * is added. This function is not as efficient as _stp_printf() - * and should only be used for urgent messages. You probably want - * dbug(), or _stp_warn(). - * @param fmt A variable number of args. - * @todo Evaluate if this function is necessary. - */ -void _stp_log (const char *fmt, ...) -{ - va_list args; - va_start(args, fmt); - _stp_vlog (INFO, NULL, 0, fmt, args); - va_end(args); -} - /** Prints warning. * This function sends a warning message immediately to staprun. It * will also be sent over the bulk transport (relayfs) if it is @@ -81,7 +63,7 @@ void _stp_log (const char *fmt, ...) * is added. * @param fmt A variable number of args. */ -void _stp_warn (const char *fmt, ...) +static void _stp_warn (const char *fmt, ...) { va_list args; va_start(args, fmt); @@ -97,7 +79,7 @@ void _stp_warn (const char *fmt, ...) * call. You should probably call return immediately after * calling _stp_exit(). */ -void _stp_exit (void) +static void _stp_exit (void) { _stp_exit_flag = 1; } @@ -112,7 +94,7 @@ void _stp_exit (void) * @param fmt A variable number of args. * @sa _stp_exit(). */ -void _stp_error (const char *fmt, ...) +static void _stp_error (const char *fmt, ...) { va_list args; va_start(args, fmt); @@ -131,7 +113,7 @@ void _stp_error (const char *fmt, ...) * @param fmt A variable number of args. * @sa _stp_error */ -void _stp_softerror (const char *fmt, ...) +static void _stp_softerror (const char *fmt, ...) { va_list args; va_start(args, fmt); diff --git a/runtime/itrace.c b/runtime/itrace.c index 3ee48265..df18a400 100644 --- a/runtime/itrace.c +++ b/runtime/itrace.c @@ -187,7 +187,7 @@ done: } -int usr_itrace_init(int single_step, pid_t tid, struct stap_itrace_probe *p) +static int usr_itrace_init(int single_step, pid_t tid, struct stap_itrace_probe *p) { struct itrace_info *ui; struct task_struct *tsk; diff --git a/runtime/map-gen.c b/runtime/map-gen.c index ce6e8742..c4bdf2c7 100644 --- a/runtime/map-gen.c +++ b/runtime/map-gen.c @@ -336,7 +336,7 @@ static unsigned int KEYSYM(hash) (ALLKEYSD(key)) #if VALUE_TYPE == INT64 || VALUE_TYPE == STRING -MAP KEYSYM(_stp_map_new) (unsigned max_entries) +static MAP KEYSYM(_stp_map_new) (unsigned max_entries) { MAP m = _stp_map_new (max_entries, VALUE_TYPE, sizeof(struct KEYSYM(map_node)), 0); if (m) @@ -347,7 +347,7 @@ MAP KEYSYM(_stp_map_new) (unsigned max_entries) /* _stp_map_new_key1_key2...val (num, HIST_LINEAR, start, end, interval) */ /* _stp_map_new_key1_key2...val (num, HIST_LOG) */ -MAP KEYSYM(_stp_map_new) (unsigned max_entries, int htype, ...) +static MAP KEYSYM(_stp_map_new) (unsigned max_entries, int htype, ...) { int start=0, stop=0, interval=0; MAP m; @@ -384,7 +384,7 @@ MAP KEYSYM(_stp_map_new) (unsigned max_entries, int htype, ...) } #endif /* VALUE_TYPE */ -int KEYSYM(__stp_map_set) (MAP map, ALLKEYSD(key), VSTYPE val, int add) +static int KEYSYM(__stp_map_set) (MAP map, ALLKEYSD(key), VSTYPE val, int add) { unsigned int hv; struct hlist_head *head; @@ -427,18 +427,18 @@ int KEYSYM(__stp_map_set) (MAP map, ALLKEYSD(key), VSTYPE val, int add) return MAP_SET_VAL(map,(struct map_node *)n, val, 0); } -int KEYSYM(_stp_map_set) (MAP map, ALLKEYSD(key), VSTYPE val) +static int KEYSYM(_stp_map_set) (MAP map, ALLKEYSD(key), VSTYPE val) { return KEYSYM(__stp_map_set) (map, ALLKEYS(key), val, 0); } -int KEYSYM(_stp_map_add) (MAP map, ALLKEYSD(key), VSTYPE val) +static int KEYSYM(_stp_map_add) (MAP map, ALLKEYSD(key), VSTYPE val) { return KEYSYM(__stp_map_set) (map, ALLKEYS(key), val, 1); } -VALTYPE KEYSYM(_stp_map_get) (MAP map, ALLKEYSD(key)) +static VALTYPE KEYSYM(_stp_map_get) (MAP map, ALLKEYSD(key)) { unsigned int hv; struct hlist_head *head; @@ -474,7 +474,7 @@ VALTYPE KEYSYM(_stp_map_get) (MAP map, ALLKEYSD(key)) return NULLRET; } -int KEYSYM(_stp_map_del) (MAP map, ALLKEYSD(key)) +static int KEYSYM(_stp_map_del) (MAP map, ALLKEYSD(key)) { unsigned int hv; struct hlist_head *head; @@ -511,7 +511,7 @@ int KEYSYM(_stp_map_del) (MAP map, ALLKEYSD(key)) return 0; } -int KEYSYM(_stp_map_exists) (MAP map, ALLKEYSD(key)) +static int KEYSYM(_stp_map_exists) (MAP map, ALLKEYSD(key)) { unsigned int hv; struct hlist_head *head; diff --git a/runtime/map.c b/runtime/map.c index 5108e596..de25d6f3 100644 --- a/runtime/map.c +++ b/runtime/map.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * Map Functions - * Copyright (C) 2005, 2006, 2007, 2008 Red Hat Inc. + * Copyright (C) 2005-2009 Red Hat Inc. * * This file is part of systemtap, and is free software. You can * redistribute it and/or modify it under the terms of the GNU General @@ -26,17 +26,17 @@ static int map_sizes[] = { 0 }; -unsigned int int64_hash (const int64_t v) +static unsigned int int64_hash (const int64_t v) { return (unsigned int)hash_long ((unsigned long)v, HASH_TABLE_BITS); } -int int64_eq_p (int64_t key1, int64_t key2) +static int int64_eq_p (int64_t key1, int64_t key2) { return key1 == key2; } -void str_copy(char *dest, char *src) +static void str_copy(char *dest, char *src) { int len = 0; if (src) { @@ -48,7 +48,7 @@ void str_copy(char *dest, char *src) dest[len] = 0; } -void str_add(void *dest, char *val) +static void str_add(void *dest, char *val) { char *dst = (char *)dest; int len = strlen(val); @@ -61,12 +61,12 @@ void str_add(void *dest, char *val) dst[len + len1] = 0; } -int str_eq_p (char *key1, char *key2) +static int str_eq_p (char *key1, char *key2) { return strncmp(key1, key2, MAP_STRING_LENGTH - 1) == 0; } -unsigned int str_hash(const char *key1) +static unsigned int str_hash(const char *key1) { int hash = 0, count = 0; char *v1 = (char *)key1; @@ -88,7 +88,7 @@ unsigned int str_hash(const char *key1) * @param m pointer to the map_node. * @returns an int64 value. */ -int64_t _stp_get_int64(struct map_node *m) +static int64_t _stp_get_int64(struct map_node *m) { if (!m || m->map->type != INT64) return 0; @@ -102,7 +102,7 @@ int64_t _stp_get_int64(struct map_node *m) * @param m pointer to the map_node. * @returns a pointer to a string. */ -char *_stp_get_str(struct map_node *m) +static char *_stp_get_str(struct map_node *m) { if (!m || m->map->type != STRING) return "bad type"; @@ -116,7 +116,7 @@ char *_stp_get_str(struct map_node *m) * @param m pointer to the map_node. * @returns A pointer to the stats. */ -stat *_stp_get_stat(struct map_node *m) +static stat *_stp_get_stat(struct map_node *m) { if (!m || m->map->type != STAT) return 0; @@ -130,7 +130,7 @@ stat *_stp_get_stat(struct map_node *m) * @returns an int64 * @sa key1int(), key2int() */ -int64_t _stp_key_get_int64 (struct map_node *mn, int n) +static int64_t _stp_key_get_int64 (struct map_node *mn, int n) { int type; int64_t res = 0; @@ -150,7 +150,7 @@ int64_t _stp_key_get_int64 (struct map_node *mn, int n) * @returns a pointer to a string * @sa key1str(), key2str() */ -char *_stp_key_get_str (struct map_node *mn, int n) +static char *_stp_key_get_str (struct map_node *mn, int n) { int type; char *str = ""; @@ -290,7 +290,7 @@ err: * @sa foreach */ -struct map_node *_stp_map_start(MAP map) +static struct map_node *_stp_map_start(MAP map) { if (map == NULL) return NULL; @@ -313,7 +313,7 @@ struct map_node *_stp_map_start(MAP map) * @sa foreach */ -struct map_node *_stp_map_iter(MAP map, struct map_node *m) +static struct map_node *_stp_map_iter(MAP map, struct map_node *m) { if (map == NULL) return NULL; @@ -328,7 +328,7 @@ struct map_node *_stp_map_iter(MAP map, struct map_node *m) * @param map */ -void _stp_map_clear(MAP map) +static void _stp_map_clear(MAP map) { struct map_node *m; @@ -351,7 +351,7 @@ void _stp_map_clear(MAP map) } } -void _stp_pmap_clear(PMAP pmap) +static void _stp_pmap_clear(PMAP pmap) { int i; @@ -393,7 +393,7 @@ static void __stp_map_del(MAP map) * @param map */ -void _stp_map_del(MAP map) +static void _stp_map_del(MAP map) { if (map == NULL) return; @@ -403,7 +403,7 @@ void _stp_map_del(MAP map) _stp_kfree(map); } -void _stp_pmap_del(PMAP pmap) +static void _stp_pmap_del(PMAP pmap) { int i; @@ -444,7 +444,7 @@ static int _stp_cmp (struct list_head *a, struct list_head *b, int keynum, int d ret = 1; else ret = 0; - //_stp_log ("comparing %s and %s and returning %d\n", _stp_get_str(m1), _stp_get_str(m2), ret); + //dbug ("comparing %s and %s and returning %d\n", _stp_get_str(m1), _stp_get_str(m2), ret); return ret; } else { int64_t a,b; @@ -510,7 +510,7 @@ static inline void _stp_swap (struct list_head *a, struct list_head *b) * @sa _stp_map_sortn() */ -void _stp_map_sort (MAP map, int keynum, int dir) +static void _stp_map_sort (MAP map, int keynum, int dir) { struct list_head *p, *q, *e, *tail; int nmerges, psize, qsize, i, type, insize = 1; @@ -577,7 +577,7 @@ void _stp_map_sort (MAP map, int keynum, int dir) * @param dir Sort Direction. -1 for low-to-high. 1 for high-to-low. * @sa _stp_map_sort() */ -void _stp_map_sortn(MAP map, int n, int keynum, int dir) +static void _stp_map_sortn(MAP map, int n, int keynum, int dir) { if (n == 0 || n > 30) { _stp_map_sort(map, keynum, dir); @@ -726,7 +726,7 @@ static void _stp_add_agg(struct map_node *aptr, struct map_node *ptr) * @param map A pointer to a pmap. * @returns a pointer to the aggregated map. Null on failure. */ -MAP _stp_pmap_agg (PMAP pmap) +static MAP _stp_pmap_agg (PMAP pmap) { int i, hash; MAP m, agg; @@ -912,7 +912,7 @@ static int _new_map_set_stat (MAP map, struct map_node *n, int64_t val, int add) * @param pmap * @returns an int */ -int _stp_pmap_size (PMAP pmap) +static int _stp_pmap_size (PMAP pmap) { int i, num = 0; diff --git a/runtime/map.h b/runtime/map.h index 6cd6e119..6c1c855b 100644 --- a/runtime/map.h +++ b/runtime/map.h @@ -166,34 +166,34 @@ typedef struct pmap *PMAP; /** @cond DONT_INCLUDE */ /************* prototypes for map.c ****************/ -int int64_eq_p(int64_t key1, int64_t key2); +static int int64_eq_p(int64_t key1, int64_t key2); void int64_copy(void *dest, int64_t val); void int64_add(void *dest, int64_t val); int64_t int64_get(void *ptr); void stat_copy(void *dest, stat *src); void stat_add(void *dest, stat *src); stat *stat_get(void *ptr); -int64_t _stp_key_get_int64(struct map_node *mn, int n); -char * _stp_key_get_str(struct map_node *mn, int n); -unsigned int int64_hash(const int64_t v); +static int64_t _stp_key_get_int64(struct map_node *mn, int n); +static char * _stp_key_get_str(struct map_node *mn, int n); +static unsigned int int64_hash(const int64_t v); char * str_get(void *ptr); -void str_copy(char *dest, char *src); -void str_add(void *dest, char *val); -int str_eq_p(char *key1, char *key2); -int64_t _stp_get_int64(struct map_node *m); -char * _stp_get_str(struct map_node *m); -stat *_stp_get_stat(struct map_node *m); -unsigned int str_hash(const char *key1); +static void str_copy(char *dest, char *src); +static void str_add(void *dest, char *val); +static int str_eq_p(char *key1, char *key2); +static int64_t _stp_get_int64(struct map_node *m); +static char * _stp_get_str(struct map_node *m); +static stat *_stp_get_stat(struct map_node *m); +static unsigned int str_hash(const char *key1); static MAP _stp_map_new(unsigned max_entries, int type, int key_size, int data_size); static PMAP _stp_pmap_new(unsigned max_entries, int type, int key_size, int data_size); static int msb64(int64_t x); static MAP _stp_map_new_hstat_log(unsigned max_entries, int key_size); static MAP _stp_map_new_hstat_linear(unsigned max_entries, int ksize, int start, int stop, int interval); static void _stp_map_print_histogram(MAP map, stat *s); -struct map_node * _stp_map_start(MAP map); -struct map_node * _stp_map_iter(MAP map, struct map_node *m); -void _stp_map_del(MAP map); -void _stp_map_clear(MAP map); +static struct map_node * _stp_map_start(MAP map); +static struct map_node * _stp_map_iter(MAP map, struct map_node *m); +static void _stp_map_del(MAP map); +static void _stp_map_clear(MAP map); void _stp_map_print(MAP map, const char *fmt); static struct map_node *_new_map_create (MAP map, struct hlist_head *head); diff --git a/runtime/mempool.c b/runtime/mempool.c index 0fbb4326..f8831428 100644 --- a/runtime/mempool.c +++ b/runtime/mempool.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * Preallocated memory pools - * Copyright (C) 2008 Red Hat Inc. + * Copyright (C) 2008-2009 Red Hat Inc. * * This file is part of systemtap, and is free software. You can * redistribute it and/or modify it under the terms of the GNU General @@ -72,41 +72,6 @@ err: return NULL; } -/* Resize a memory pool */ -static int _stp_mempool_resize(_stp_mempool_t *pool, size_t num) -{ - int i; - unsigned long flags; - struct _stp_mem_buffer *m; - - if (unlikely(num == 0 || num == pool->num)) - return pool->num; - - if (num > pool->num) { - for (i = 0; i < num - pool->num; i++) { - m = (struct _stp_mem_buffer *)_stp_kmalloc(pool->size); - if (unlikely(m == NULL)) - goto done; - m->pool = pool; - pool->num++; - spin_lock_irqsave(&pool->lock, flags); - list_add((struct list_head *)m, &pool->free_list); - spin_unlock_irqrestore(&pool->lock, flags); - } - } else { - for (i = 0; i < pool->num - num; i++) { - spin_lock_irqsave(&pool->lock, flags); - m = (struct _stp_mem_buffer *)pool->free_list.next; - list_del(&m->list); - spin_unlock_irqrestore(&pool->lock, flags); - _stp_kfree(m); - } - pool->num = num; - } -done: - return num; -} - /* allocate a buffer from a memory pool */ static void *_stp_mempool_alloc(_stp_mempool_t *pool) { diff --git a/runtime/perf.c b/runtime/perf.c index 0b812630..9ac8b481 100644 --- a/runtime/perf.c +++ b/runtime/perf.c @@ -59,7 +59,7 @@ static struct pfarg_start start_args; * @param pmd_count, number of entries in pmd * @returns an int, 0 if no errors encountered during setup */ -int _stp_perfmon_setup(void **desc, +static int _stp_perfmon_setup(void **desc, struct pfarg_ctx *context, struct pfarg_pmc pmc[], int pmc_count, struct pfarg_pmd pmd[], int pmd_count) @@ -98,7 +98,7 @@ cleanup: *desc=NULL; * @param desc unique pointer to describe configuration * @returns an int, 0 if no errors encountered during shutdown */ -int _stp_perfmon_shutdown(void *desc) +static int _stp_perfmon_shutdown(void *desc) { int err=0; @@ -116,7 +116,7 @@ int _stp_perfmon_shutdown(void *desc) * @param desc unique pointer to describe configuration * @returns an int64, raw value of counter */ -int64_t _stp_perfmon_read(void *desc, int counter) +static int64_t _stp_perfmon_read(void *desc, int counter) { struct pfarg_pmd storage; diff --git a/runtime/perf.h b/runtime/perf.h index e3212228..6a87bff0 100644 --- a/runtime/perf.h +++ b/runtime/perf.h @@ -15,13 +15,13 @@ * @brief Header file for performance monitoring hardware support */ -int _stp_perfmon_setup(void **desc, +static int _stp_perfmon_setup(void **desc, struct pfarg_ctx *context, struct pfarg_pmc pmc[], int pmc_count, struct pfarg_pmd pmd[], int pmd_count); -int _stp_perfmon_shutdown(void *desc); +static int _stp_perfmon_shutdown(void *desc); -int64_t _stp_perfmon_read(void *desc, int counter); +static int64_t _stp_perfmon_read(void *desc, int counter); #endif /* _PERF_H_ */ diff --git a/runtime/pmap-gen.c b/runtime/pmap-gen.c index 7f7ddeb0..86c3dc42 100644 --- a/runtime/pmap-gen.c +++ b/runtime/pmap-gen.c @@ -400,7 +400,7 @@ static unsigned int KEYSYM(phash) (ALLKEYSD(key)) #if VALUE_TYPE == INT64 || VALUE_TYPE == STRING -PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries) +static PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries) { PMAP pmap = _stp_pmap_new (max_entries, VALUE_TYPE, sizeof(struct KEYSYM(pmap_node)), 0); if (pmap) { @@ -426,7 +426,7 @@ PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries) /* _stp_pmap_new_key1_key2...val (num, HIST_LINEAR, start, end, interval) */ /* _stp_pmap_new_key1_key2...val (num, HIST_LOG) */ -PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries, int htype, ...) +static PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries, int htype, ...) { int start=0, stop=0, interval=0; PMAP pmap; @@ -477,7 +477,7 @@ PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries, int htype, ...) } #endif /* VALUE_TYPE */ -int KEYSYM(__stp_pmap_set) (MAP map, ALLKEYSD(key), VSTYPE val, int add) +static int KEYSYM(__stp_pmap_set) (MAP map, ALLKEYSD(key), VSTYPE val, int add) { unsigned int hv; struct hlist_head *head; @@ -522,7 +522,7 @@ int KEYSYM(__stp_pmap_set) (MAP map, ALLKEYSD(key), VSTYPE val, int add) return MAP_SET_VAL(map,(struct map_node *)n, val, 0); } -int KEYSYM(_stp_pmap_set) (PMAP pmap, ALLKEYSD(key), VSTYPE val) +static int KEYSYM(_stp_pmap_set) (PMAP pmap, ALLKEYSD(key), VSTYPE val) { int res; MAP m = per_cpu_ptr (pmap->map, MAP_GET_CPU ()); @@ -538,7 +538,7 @@ int KEYSYM(_stp_pmap_set) (PMAP pmap, ALLKEYSD(key), VSTYPE val) return res; } -int KEYSYM(_stp_pmap_add) (PMAP pmap, ALLKEYSD(key), VSTYPE val) +static int KEYSYM(_stp_pmap_add) (PMAP pmap, ALLKEYSD(key), VSTYPE val) { int res; MAP m = per_cpu_ptr (pmap->map, MAP_GET_CPU()); @@ -555,7 +555,7 @@ int KEYSYM(_stp_pmap_add) (PMAP pmap, ALLKEYSD(key), VSTYPE val) } -VALTYPE KEYSYM(_stp_pmap_get_cpu) (PMAP pmap, ALLKEYSD(key)) +static VALTYPE KEYSYM(_stp_pmap_get_cpu) (PMAP pmap, ALLKEYSD(key)) { unsigned int hv; struct hlist_head *head; @@ -608,7 +608,7 @@ VALTYPE KEYSYM(_stp_pmap_get_cpu) (PMAP pmap, ALLKEYSD(key)) return NULLRET; } -VALTYPE KEYSYM(_stp_pmap_get) (PMAP pmap, ALLKEYSD(key)) +static VALTYPE KEYSYM(_stp_pmap_get) (PMAP pmap, ALLKEYSD(key)) { unsigned int hv; int cpu, clear_agg = 0; @@ -696,7 +696,7 @@ VALTYPE KEYSYM(_stp_pmap_get) (PMAP pmap, ALLKEYSD(key)) return NULLRET; } -int KEYSYM(__stp_pmap_del) (MAP map, ALLKEYSD(key)) +static int KEYSYM(__stp_pmap_del) (MAP map, ALLKEYSD(key)) { unsigned int hv; struct hlist_head *head; @@ -737,7 +737,7 @@ int KEYSYM(__stp_pmap_del) (MAP map, ALLKEYSD(key)) return 0; } -int KEYSYM(_stp_pmap_del) (PMAP pmap, ALLKEYSD(key)) +static int KEYSYM(_stp_pmap_del) (PMAP pmap, ALLKEYSD(key)) { int res; MAP m = per_cpu_ptr (pmap->map, MAP_GET_CPU ()); diff --git a/runtime/print.c b/runtime/print.c index 14a0820b..2c84d3c9 100644 --- a/runtime/print.c +++ b/runtime/print.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * Print Functions - * Copyright (C) 2007-2008 Red Hat Inc. + * Copyright (C) 2007-2009 Red Hat Inc. * * This file is part of systemtap, and is free software. You can * redistribute it and/or modify it under the terms of the GNU General @@ -39,16 +39,16 @@ typedef struct __stp_pbuf { char buf[STP_BUFFER_SIZE]; } _stp_pbuf; -void *Stp_pbuf = NULL; +static void *Stp_pbuf = NULL; -/** private buffer for _stp_log() */ +/** private buffer for _stp_vlog() */ #define STP_LOG_BUF_LEN 256 typedef char _stp_lbuf[STP_LOG_BUF_LEN]; -void *Stp_lbuf = NULL; +static void *Stp_lbuf = NULL; /* create percpu print and io buffers */ -int _stp_print_init (void) +static int _stp_print_init (void) { Stp_pbuf = _stp_alloc_percpu(sizeof(_stp_pbuf)); if (unlikely(Stp_pbuf == 0)) @@ -63,7 +63,7 @@ int _stp_print_init (void) return 0; } -void _stp_print_cleanup (void) +static void _stp_print_cleanup (void) { if (Stp_pbuf) _stp_free_percpu(Stp_pbuf); @@ -171,7 +171,7 @@ static void _stp_print_binary (int num, ...) * * @sa _stp_print_flush() */ -void _stp_printf (const char *fmt, ...) +static void _stp_printf (const char *fmt, ...) { int num; va_list args; @@ -207,7 +207,7 @@ void _stp_printf (const char *fmt, ...) * @param str A C string (char *) */ -void _stp_print (const char *str) +static void _stp_print (const char *str) { _stp_pbuf *pb = per_cpu_ptr(Stp_pbuf, smp_processor_id()); char *end = pb->buf + STP_BUFFER_SIZE; @@ -231,9 +231,8 @@ void _stp_print (const char *str) pb->len = ptr - pb->buf; } -void _stp_print_char (const char c) +static void _stp_print_char (const char c) { - char *buf; _stp_pbuf *pb = per_cpu_ptr(Stp_pbuf, smp_processor_id()); int size = STP_BUFFER_SIZE - pb->len; if (unlikely(1 >= size)) @@ -243,38 +242,7 @@ void _stp_print_char (const char c) pb->len ++; } -/* This function is used when printing maps or stats. */ -/* Probably belongs elsewhere, but is here for now. */ -/* It takes a format specification like those used for */ -/* printing maps and stats. It prints chars until it sees */ -/* a special format char (beginning with '%'. Then it */ -/* returns a pointer to that. */ -static char *next_fmt(char *fmt, int *num) -{ - char *f = fmt; - int in_fmt = 0; - *num = 0; - while (*f) { - if (in_fmt) { - if (*f == '%') { - _stp_print_char('%'); - in_fmt = 0; - } else if (*f > '0' && *f <= '9') { - *num = *f - '0'; - f++; - return f; - } else - return f; - } else if (*f == '%') - in_fmt = 1; - else - _stp_print_char(*f); - f++; - } - return f; -} - -void _stp_print_kernel_info(char *vstr, int ctx, int num_probes) +static void _stp_print_kernel_info(char *vstr, int ctx, int num_probes) { #ifdef DEBUG_MEM printk(KERN_DEBUG "%s: systemtap: %s, base: %p, memory: %lu+%lu+%u+%u+%u data+text+ctx+net+alloc, probes: %d\n", diff --git a/runtime/print_new.c b/runtime/print_new.c index 4136ecbe..fa7b4727 100644 --- a/runtime/print_new.c +++ b/runtime/print_new.c @@ -16,7 +16,7 @@ * @note Preemption must be disabled to use this. */ -DEFINE_SPINLOCK(_stp_print_lock); +static DEFINE_SPINLOCK(_stp_print_lock); void EXPORT_FN(stp_print_flush) (_stp_pbuf *pb) { diff --git a/runtime/procfs.c b/runtime/procfs.c index 0fe22aba..d6b75336 100644 --- a/runtime/procfs.c +++ b/runtime/procfs.c @@ -1,7 +1,7 @@ /* -*- linux-c -*- * * /proc command channels - * Copyright (C) 2007 Red Hat Inc. + * Copyright (C) 2007-2009 Red Hat Inc. * * This file is part of systemtap, and is free software. You can * redistribute it and/or modify it under the terms of the GNU General @@ -14,15 +14,17 @@ * number of needed files. */ +#ifndef _STP_PROCFS_C_ +#define _STP_PROCFS_C_ + #define STP_MAX_PROCFS_FILES 16 static int _stp_num_pde = 0; -static int _stp_num_procfs_files = 0; static struct proc_dir_entry *_stp_pde[STP_MAX_PROCFS_FILES]; static struct proc_dir_entry *_stp_procfs_files[STP_MAX_PROCFS_FILES]; static struct proc_dir_entry *_stp_proc_stap = NULL; static struct proc_dir_entry *_stp_proc_root = NULL; -void _stp_close_procfs(void); +static void _stp_close_procfs(void); // 2.6.24 fixed proc_dir_entry refcounting. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) @@ -34,7 +36,7 @@ void _stp_close_procfs(void); /* * Removes /proc/systemtap/{module_name} and /proc/systemtap (if empty) */ -void _stp_rmdir_proc_module(void) +static void _stp_rmdir_proc_module(void) { if (_stp_proc_root && _stp_proc_root->subdir == NULL) { if (atomic_read(&_stp_proc_root->count) != LAST_ENTRY_COUNT) @@ -45,7 +47,7 @@ void _stp_rmdir_proc_module(void) } if (_stp_proc_stap) { - if (!_stp_lock_debugfs()) { + if (!_stp_lock_transport_dir()) { errk("Unable to lock transport directory.\n"); return; } @@ -62,7 +64,7 @@ void _stp_rmdir_proc_module(void) _stp_proc_stap = NULL; } - _stp_unlock_debugfs(); + _stp_unlock_transport_dir(); } } @@ -71,12 +73,12 @@ void _stp_rmdir_proc_module(void) * Safely creates /proc/systemtap (if necessary) and * /proc/systemtap/{module_name}. */ -int _stp_mkdir_proc_module(void) +static int _stp_mkdir_proc_module(void) { if (_stp_proc_root == NULL) { struct nameidata nd; - if (!_stp_lock_debugfs()) { + if (!_stp_lock_transport_dir()) { errk("Unable to lock transport directory.\n"); goto done; } @@ -90,7 +92,7 @@ int _stp_mkdir_proc_module(void) /* doesn't exist, so create it */ _stp_proc_stap = proc_mkdir ("systemtap", NULL); if (_stp_proc_stap == NULL) { - _stp_unlock_debugfs(); + _stp_unlock_transport_dir(); goto done; } } else { @@ -105,10 +107,12 @@ int _stp_mkdir_proc_module(void) } _stp_proc_root = proc_mkdir(THIS_MODULE->name, _stp_proc_stap); +#ifdef AUTOCONF_PROCFS_OWNER if (_stp_proc_root != NULL) _stp_proc_root->owner = THIS_MODULE; +#endif - _stp_unlock_debugfs(); + _stp_unlock_transport_dir(); } done: return (_stp_proc_root) ? 1 : 0; @@ -128,7 +132,7 @@ static struct proc_dir_entry *_stp_procfs_lookup(const char *dir, struct proc_di return NULL; } -int _stp_create_procfs(const char *path, int num) +static int _stp_create_procfs(const char *path, int num) { const char *p; char *next; @@ -161,7 +165,9 @@ int _stp_create_procfs(const char *path, int num) goto err; } _stp_pde[_stp_num_pde++] = last_dir; +#ifdef AUTOCONF_PROCFS_OWNER last_dir->owner = THIS_MODULE; +#endif last_dir->uid = _stp_uid; last_dir->gid = _stp_gid; } else { @@ -195,7 +201,7 @@ err: return -1; } -void _stp_close_procfs(void) +static void _stp_close_procfs(void) { int i; for (i = _stp_num_pde-1; i >= 0; i--) { @@ -205,3 +211,5 @@ void _stp_close_procfs(void) _stp_num_pde = 0; _stp_rmdir_proc_module(); } + +#endif /* _STP_PROCFS_C_ */ diff --git a/runtime/regs.c b/runtime/regs.c index 81b865b1..e963affa 100644 --- a/runtime/regs.c +++ b/runtime/regs.c @@ -23,43 +23,6 @@ * @{ */ - -/** Get the current return address. - * Call from kprobes (not jprobes). - * @param regs The pt_regs saved by the kprobe. - * @return The return address saved in the stack pointer. - * @note i386 and x86_64 only so far. - */ - -unsigned long _stp_ret_addr (struct pt_regs *regs) -{ -#if defined (STAPCONF_X86_UNIREGS) && (defined (__x86_64__) || defined (__i386__)) - unsigned long *ra = (unsigned long *)regs->sp; - if (ra) - return *ra; - else - return 0; -#elif defined (__x86_64__) - unsigned long *ra = (unsigned long *)regs->rsp; - if (ra) - return *ra; - else - return 0; -#elif defined (__i386__) - return regs->esp; -#elif defined (__powerpc64__) || defined (__arm__) - return REG_LINK(regs); -#elif defined (__ia64__) - return regs->b0; -#elif defined (__s390__) || defined (__s390x__) - return regs->gprs[14]; -#elif defined (__arm__) - return regs->ARM_r0; -#else - #error Unimplemented architecture -#endif -} - /** Get the current return address for a return probe. * Call from kprobe return probe. * @param ri Pointer to the struct kretprobe_instance. @@ -85,7 +48,7 @@ unsigned long _stp_ret_addr (struct pt_regs *regs) #if defined (STAPCONF_X86_UNIREGS) && defined (__x86_64__) -void _stp_print_regs(struct pt_regs * regs) +static void _stp_print_regs(struct pt_regs * regs) { unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs; unsigned int fsindex,gsindex; @@ -126,7 +89,7 @@ void _stp_print_regs(struct pt_regs * regs) #elif defined (STAPCONF_X86_UNIREGS) && defined (__i386__) -void _stp_print_regs(struct pt_regs * regs) +static void _stp_print_regs(struct pt_regs * regs) { unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; @@ -153,7 +116,7 @@ void _stp_print_regs(struct pt_regs * regs) } #elif defined (__x86_64__) -void _stp_print_regs(struct pt_regs * regs) +static void _stp_print_regs(struct pt_regs * regs) { unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs; unsigned int fsindex,gsindex; @@ -193,7 +156,7 @@ void _stp_print_regs(struct pt_regs * regs) } #elif defined (__ia64__) -void _stp_print_regs(struct pt_regs * regs) +static void _stp_print_regs(struct pt_regs * regs) { unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri; @@ -228,7 +191,7 @@ void _stp_print_regs(struct pt_regs * regs) * @param regs The pt_regs saved by the kprobe. * @note i386 and x86_64 only so far. */ -void _stp_print_regs(struct pt_regs * regs) +static void _stp_print_regs(struct pt_regs * regs) { unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; @@ -263,7 +226,7 @@ static int _stp_probing_32bit_app(struct pt_regs *regs) return (user_mode(regs) && test_tsk_thread_flag(current, TIF_32BIT)); } -void _stp_print_regs(struct pt_regs * regs) +static void _stp_print_regs(struct pt_regs * regs) { int i; @@ -302,7 +265,7 @@ static const char *processor_modes[]= }; -void _stp_print_regs(struct pt_regs * regs) +static void _stp_print_regs(struct pt_regs * regs) { unsigned long flags = condition_codes(regs); @@ -365,7 +328,7 @@ void _stp_print_regs(struct pt_regs * regs) #define GPRSIZE "%08lX " #endif -void _stp_print_regs(struct pt_regs * regs) +static void _stp_print_regs(struct pt_regs * regs) { char *mode; int i; diff --git a/runtime/runtime.h b/runtime/runtime.h index 3ca43dc4..822562a2 100644 --- a/runtime/runtime.h +++ b/runtime/runtime.h @@ -44,7 +44,7 @@ #endif static void _stp_dbug (const char *func, int line, const char *fmt, ...); -void _stp_error (const char *fmt, ...); +static void _stp_error (const char *fmt, ...); #include "debug.h" @@ -96,7 +96,7 @@ static struct #include "addr-map.c" /* Support functions for int64_t module parameters. */ -int param_set_int64_t(const char *val, struct kernel_param *kp) +static int param_set_int64_t(const char *val, struct kernel_param *kp) { char *endp; long long ll; @@ -117,7 +117,7 @@ int param_set_int64_t(const char *val, struct kernel_param *kp) return 0; } -int param_get_int64_t(char *buffer, struct kernel_param *kp) +static int param_get_int64_t(char *buffer, struct kernel_param *kp) { return sprintf(buffer, "%lli", (long long)*((int64_t *)kp->arg)); } @@ -132,7 +132,7 @@ int init_module (void) return _stp_transport_init(); } -int probe_start(void); +static int probe_start(void); void cleanup_module(void) { diff --git a/runtime/sdt.h b/runtime/sdt.h deleted file mode 100644 index 9fe7b176..00000000 --- a/runtime/sdt.h +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright (C) 2005-2009 Red Hat Inc. -// Copyright (C) 2006 Intel Corporation. -// -// This file is part of systemtap, and is free software. You can -// redistribute it and/or modify it under the terms of the GNU General -// Public License (GPL); either version 2, or (at your option) any -// later version. - -#include <string.h> - -#if _LP64 -#define STAP_PROBE_STRUCT_ARG(arg) \ - __uint64_t arg; -#else -#define STAP_PROBE_STRUCT_ARG(arg) \ - long arg __attribute__ ((aligned(8))); -#endif - -#define STAP_SENTINEL 0x31425250 - -#define STAP_PROBE_STRUCT(probe,type,argc) \ -struct _probe_ ## probe \ -{ \ - int probe_type; \ - char *probe_name; \ - STAP_PROBE_STRUCT_ARG (probe_arg); \ -}; \ -static char probe_name [strlen(#probe)+1] \ - __attribute__ ((section (".probes"))) \ - = #probe; \ -static volatile struct _probe_ ## probe _probe_ ## probe __attribute__ ((section (".probes"))) = {STAP_SENTINEL,&probe_name[0],argc}; - -#define STAP_CONCAT(a,b) a ## b -#define STAP_LABEL(p,n) \ - STAP_CONCAT(_probe_ ## p ## _, n) - -// The goto _probe_ prevents the label from "drifting" -#ifdef USE_STAP_PROBE -#define STAP_PROBE(provider,probe) \ - STAP_PROBE_STRUCT(probe,0,0) \ - _stap_probe_0 (_probe_ ## probe.probe_name); -#else -#define STAP_PROBE(provider,probe) \ -STAP_LABEL(probe,__LINE__): \ - asm volatile ("nop"); \ - STAP_PROBE_STRUCT(probe,1,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \ - goto STAP_LABEL(probe,__LINE__); -#endif - -#ifdef USE_STAP_PROBE -#define STAP_PROBE1(provider,probe,arg1) \ - STAP_PROBE_STRUCT(probe,0,1) \ - _stap_probe_1 (_probe_ ## probe.probe_name,(size_t)arg1); -#else -#define STAP_PROBE1(provider,probe,parm1) \ - {volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ -STAP_LABEL(probe,__LINE__): \ - asm volatile ("nop" :: "r"(arg1)); \ - STAP_PROBE_STRUCT(probe,1,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \ - goto STAP_LABEL(probe,__LINE__);} -#endif - -#ifdef USE_STAP_PROBE -#define STAP_PROBE2(provider,probe,arg1,arg2) \ - STAP_PROBE_STRUCT(probe,0,2) \ - _stap_probe_2 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2); -#else -#define STAP_PROBE2(provider,probe,parm1,parm2) \ - {volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ -STAP_LABEL(probe,__LINE__): \ - asm volatile ("nop" :: "r"(arg1), "r"(arg2)); \ - STAP_PROBE_STRUCT(probe,1,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \ - goto STAP_LABEL(probe,__LINE__);} -#endif - -#ifdef USE_STAP_PROBE -#define STAP_PROBE3(provider,probe,arg1,arg2,arg3) \ - STAP_PROBE_STRUCT(probe,0,3) \ - _stap_probe_3 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2,(size_t)arg3); -#else -#define STAP_PROBE3(provider,probe,parm1,parm2,parm3) \ - {volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ -STAP_LABEL(probe,__LINE__): \ - asm volatile ("nop" :: "r"(arg1), "r"(arg2), "r"(arg3)); \ - STAP_PROBE_STRUCT(probe,1,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \ - goto STAP_LABEL(probe,__LINE__);} -#endif - -#ifdef USE_STAP_PROBE -#define STAP_PROBE4(provider,probe,arg1,arg2,arg3,arg4) \ - STAP_PROBE_STRUCT(probe,0,4) \ - _stap_probe_4 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2,(size_t)arg3,(size_t)arg4); -#else -#define STAP_PROBE4(provider,probe,parm1,parm2,parm3,parm4) \ - {volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ - volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ -STAP_LABEL(probe,__LINE__): \ - asm volatile ("nop" :: "r"(arg1), "r"(arg2), "r"(arg3), "r"(arg4)); \ - STAP_PROBE_STRUCT(probe,1,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \ - goto STAP_LABEL(probe,__LINE__);} -#endif - -#ifdef USE_STAP_PROBE -#define STAP_PROBE5(provider,probe,arg1,arg2,arg3,arg4,arg5) \ - STAP_PROBE_STRUCT(probe,0,5) \ - _stap_probe_5 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2,(size_t)arg3,(size_t)arg4,(size_t)arg5); -#else -#define STAP_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5) \ - {volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ - volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ - volatile typeof((parm5)) arg5 __attribute__ ((unused)) = parm5; \ -STAP_LABEL(probe,__LINE__): \ - asm volatile ("nop" :: "r"(arg1), "r"(arg2), "r"(arg3), "r"(arg4), "r"(arg5)); \ - STAP_PROBE_STRUCT(probe,1,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \ - goto STAP_LABEL(probe,__LINE__);} -#endif - -#ifdef USE_STAP_PROBE -#define STAP_PROBE6(provider,probe,arg1,arg2,arg3,arg4,arg5,arg6) \ - STAP_PROBE_STRUCT(probe,0,6) \ - _stap_probe_6 (_probe_ ## probe.probe_name,(size_t)arg1,(size_t)arg2,(size_t)arg3,(size_t)arg4,(size_t)arg5,(size_t)arg6); -#else -#define STAP_PROBE6(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6) \ - {volatile typeof((parm1)) arg1 __attribute__ ((unused)) = parm1; \ - volatile typeof((parm2)) arg2 __attribute__ ((unused)) = parm2; \ - volatile typeof((parm3)) arg3 __attribute__ ((unused)) = parm3; \ - volatile typeof((parm4)) arg4 __attribute__ ((unused)) = parm4; \ - volatile typeof((parm5)) arg5 __attribute__ ((unused)) = parm5; \ - volatile typeof((parm6)) arg6 __attribute__ ((unused)) = parm6; \ -STAP_LABEL(probe,__LINE__): \ - asm volatile ("nop" :: "r"(arg1), "r"(arg2), "r"(arg3), "r"(arg4), "r"(arg5), "r"(arg6)); \ - STAP_PROBE_STRUCT(probe,1,(size_t)&& STAP_LABEL(probe,__LINE__)) \ - if (__builtin_expect(_probe_ ## probe.probe_type < 0, 0)) \ - goto STAP_LABEL(probe,__LINE__);} -#endif - -#define DTRACE_PROBE(provider,probe) \ -STAP_PROBE(provider,probe) -#define DTRACE_PROBE1(provider,probe,parm1) \ -STAP_PROBE1(provider,probe,parm1) -#define DTRACE_PROBE2(provider,probe,parm1,parm2) \ -STAP_PROBE2(provider,probe,parm1,parm2) -#define DTRACE_PROBE3(provider,probe,parm1,parm2,parm3) \ -STAP_PROBE3(provider,probe,parm1,parm2,parm3) -#define DTRACE_PROBE4(provider,probe,parm1,parm2,parm3,parm4) \ -STAP_PROBE4(provider,probe,parm1,parm2,parm3,parm4) -#define DTRACE_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5) \ -STAP_PROBE4(provider,probe,parm1,parm2,parm3,parm4,parm5) -#define DTRACE_PROBE6(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6) \ -STAP_PROBE4(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6) diff --git a/runtime/stack-i386.c b/runtime/stack-i386.c index ed7e2ce1..206801d8 100644 --- a/runtime/stack-i386.c +++ b/runtime/stack-i386.c @@ -14,10 +14,11 @@ static int _stp_valid_stack_ptr(unsigned long context, unsigned long p) } /* DWARF unwinder failed. Just dump intereting addresses on kernel stack. */ -static void _stp_stack_print_fallback(unsigned long context, unsigned long stack, int verbose, int levels) +#if ! (defined(CONFIG_STACKTRACE) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)) +static void _stp_stack_print_fallback(unsigned long stack, int verbose, int levels) { unsigned long addr; - while (levels && _stp_valid_stack_ptr(context, stack)) { + while (levels && stack & (THREAD_SIZE-1)) { if (unlikely(_stp_read_address(addr, (unsigned long *)stack, KERNEL_DS))) { /* cannot access stack. give up. */ return; @@ -27,6 +28,7 @@ static void _stp_stack_print_fallback(unsigned long context, unsigned long stack stack++; } } +#endif static void __stp_stack_print (struct pt_regs *regs, int verbose, int levels) { @@ -69,11 +71,11 @@ static void __stp_stack_print (struct pt_regs *regs, int verbose, int levels) /* If an error happened or we hit a kretprobe trampoline, use fallback backtrace */ /* FIXME: is there a way to unwind across kretprobe trampolines? */ if (ret < 0 || (ret > 0 && UNW_PC(&info) == _stp_kretprobe_trampoline)) - _stp_stack_print_fallback(context, UNW_SP(&info), verbose, levels); + _stp_stack_print_fallback(UNW_SP(&info), verbose, levels); break; } #else /* ! STP_USE_DWARF_UNWINDER */ - _stp_stack_print_fallback(context, (unsigned long)®_SP(regs), verbose, levels); + _stp_stack_print_fallback((unsigned long)®_SP(regs), verbose, levels); #endif /* STP_USE_FRAME_POINTER */ #endif } diff --git a/runtime/stack-x86_64.c b/runtime/stack-x86_64.c index d3ec91cf..183de0a0 100644 --- a/runtime/stack-x86_64.c +++ b/runtime/stack-x86_64.c @@ -9,6 +9,8 @@ */ /* DWARF unwinder failed. Just dump intereting addresses on kernel stack. */ + +#if ! (defined(CONFIG_STACKTRACE) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)) static void _stp_stack_print_fallback(unsigned long stack, int verbose, int levels) { unsigned long addr; @@ -22,6 +24,8 @@ static void _stp_stack_print_fallback(unsigned long stack, int verbose, int leve stack++; } } +#endif + static void __stp_stack_print(struct pt_regs *regs, int verbose, int levels) { @@ -48,3 +52,5 @@ static void __stp_stack_print(struct pt_regs *regs, int verbose, int levels) _stp_stack_print_fallback(REG_SP(regs), verbose, levels); #endif } + + diff --git a/runtime/stack.c b/runtime/stack.c index 23ac2edc..aa0e6d65 100644 --- a/runtime/stack.c +++ b/runtime/stack.c @@ -27,6 +27,14 @@ #define MAXBACKTRACE 20 +#if defined(CONFIG_STACKTRACE) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26) +// XXX: PR9866: hacky temporarily restriction to recent kernels +#include <linux/stacktrace.h> +#include <asm/stacktrace.h> +#endif + +static void _stp_stack_print_fallback(unsigned long, int, int); + #if defined (__x86_64__) #include "stack-x86_64.c" #elif defined (__ia64__) @@ -43,11 +51,58 @@ #error "Unsupported architecture" #endif +#if defined(CONFIG_STACKTRACE) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26) + +struct print_stack_data +{ + int verbose; + int max_level; + int level; +}; + +static void print_stack_warning(void *data, char *msg) +{ +} + +static void +print_stack_warning_symbol(void *data, char *msg, unsigned long symbol) +{ +} + +static int print_stack_stack(void *data, char *name) +{ + return -1; +} + +static void print_stack_address(void *data, unsigned long addr, int reliable) +{ + struct print_stack_data *sdata = data; + if (sdata->level++ < sdata->max_level) + _stp_func_print(addr,sdata->verbose, 0); +} + +static const struct stacktrace_ops print_stack_ops = { + .warning = print_stack_warning, + .warning_symbol = print_stack_warning_symbol, + .stack = print_stack_stack, + .address = print_stack_address, +}; + +static void _stp_stack_print_fallback(unsigned long stack, int verbose, int levels) +{ + struct print_stack_data print_data; + print_data.verbose = verbose; + print_data.max_level = levels; + print_data.level = 0; + dump_trace(current, NULL, (long *)stack, 0, &print_stack_ops, + &print_data); +} +#endif /** Prints the stack backtrace * @param regs A pointer to the struct pt_regs. */ -void _stp_stack_print(struct pt_regs *regs, int verbose, struct kretprobe_instance *pi, int levels) +static void _stp_stack_print(struct pt_regs *regs, int verbose, struct kretprobe_instance *pi, int levels) { if (verbose) { /* print the current address */ @@ -75,7 +130,7 @@ void _stp_stack_print(struct pt_regs *regs, int verbose, struct kretprobe_instan * @param regs A pointer to the struct pt_regs. * @returns void */ -void _stp_stack_snprint(char *str, int size, struct pt_regs *regs, int verbose, struct kretprobe_instance *pi, int levels) +static void _stp_stack_snprint(char *str, int size, struct pt_regs *regs, int verbose, struct kretprobe_instance *pi, int levels) { /* To get a string, we use a simple trick. First flush the print buffer, */ /* then call _stp_stack_print, then copy the result into the output string */ @@ -93,7 +148,7 @@ void _stp_stack_snprint(char *str, int size, struct pt_regs *regs, int verbose, * @note Currently limited to a depth of two. Works from jprobes and kprobes. */ #if 0 -void _stp_ustack_print(char *str) +static void _stp_ustack_print(char *str) { struct pt_regs *nregs = ((struct pt_regs *)(THREAD_SIZE + (unsigned long)current->thread_info)) - 1; _stp_printf("%p : [user]\n", (int64_t) REG_IP(nregs)); @@ -103,4 +158,39 @@ void _stp_ustack_print(char *str) #endif /* 0 */ /** @} */ + +void _stp_stack_print_tsk(struct task_struct *tsk, int verbose, int levels) +{ +#if defined(CONFIG_STACKTRACE) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26) + int i; + unsigned long backtrace[MAXBACKTRACE]; + struct stack_trace trace; + int maxLevels = min(levels, MAXBACKTRACE); + memset(&trace, 0, sizeof(trace)); + trace.entries = &backtrace[0]; + trace.max_entries = maxLevels; + trace.skip = 0; + save_stack_trace_tsk(tsk, &trace); + for (i = 0; i < maxLevels; ++i) { + if (backtrace[i] == 0 || backtrace[i] == ULONG_MAX) + break; + _stp_printf("%lx ", backtrace[i]); + } +#endif +} + +/** Writes a task stack backtrace to a string + * + * @param str string + * @param tsk A pointer to the task_struct + * @returns void + */ +void _stp_stack_snprint_tsk(char *str, int size, struct task_struct *tsk, int verbose, int levels) +{ + _stp_pbuf *pb = per_cpu_ptr(Stp_pbuf, smp_processor_id()); + _stp_print_flush(); + _stp_stack_print_tsk(tsk, verbose, levels); + strlcpy(str, pb->buf, size < (int)pb->len ? size : (int)pb->len); + pb->len = 0; +} #endif /* _STACK_C_ */ diff --git a/runtime/staprun/ChangeLog b/runtime/staprun/ChangeLog deleted file mode 100644 index 6c2304ce..00000000 --- a/runtime/staprun/ChangeLog +++ /dev/null @@ -1,904 +0,0 @@ -2008-01-11 Mark Wielaard <mjw@redhat.com> - - * staprun.h: include config.h for dependency. - -2008-12-08 Frank Ch. Eigler <fche@elastic.org> - - PR7062 - * staprun.c (enable_uprobes): Find uprobes.ko based on - SYSTEMTAP_RUNTIME. - (main): Unset SYSTEMTAP_* environment vars if setuid. - -2008-12-03 Roland McGrath <roland@redhat.com> - - PR7063 - * staprun.c (main): Use $SYSTEMTAP_STAPIO instead of hard-coded path. - Remove SYSTEMTAP_STAPRUN and SYSTEMTAP_STAPIO - environment variables when setuid is in effect. - * mainloop.c (cleanup_and_exit): Use $SYSTEMTAP_STAPRUN to re-exec, - not hard-coded path. - -2008-12-03 Frank Ch. Eigler <fche@elastic.org> - - PR6925 - * staprun (init_staprun): If a stap_* module load fails, try - to unload possible leftover, and try again. - -2008-11-28 Frank Ch. Eigler <fche@elastic.org> - - PR4783 - * staprun.c (remove_module): Don't reset with setpriority(0), - as we never set it to high-priority any more anyway. - * mainloop.c (system_cmd): Ditto. - -2008-11-12 Frank Ch. Eigler <fche@elastic.org> - - PR6964 redux. - * mainloop (WORKAROUND_BZ467568): New macro to control - behavior. - (start_cmd, stp_main_loop): Use signal/pause-based - synchronization as a fallback for rhbz 467568. - -2008-10-28 Frank Ch. Eigler <fche@elastic.org> - - PR6964, from Wenji Huang <wenji.huang@oracle.com>: - * mainloop.c (start_cmd, stp_main_loop): Temporarily - disable ptrace calls. - -2008-10-15 Frank Ch. Eigler <fche@elastic.org> - - * mainloop.c (start_cmd): Fix wordexp error handling. - -2008-09-18 David Smith <dsmith@redhat.com> - - PR 6903. - * staprun_funcs.c (check_permissions): Instead of checking the - effective uid, check the real uid for root permissions. - -2008-09-06 Frank Ch. Eigler <fche@elastic.org> - - * mainloop.c (start_cmd): Rewrite to use wordexp/execvp/ptrace. - (stp_main_loop): Use ptrace detach to resume target process. - -2008-09-05 Frank Ch. Eigler <fche@elastic.org> - - * staprun.c (run_as): Teach it to exec too. Update callers. - Always do set[ug]id as dictated. - * staprun.h (do_cap): Remove. Update all callers. - * staprun_funcs.c: Ditto. - * cap.c: Removed. Update headers. - -2008-07-10 Frank Ch. Eigler <fche@elastic.org> - - PR 6736. - * common.c (send_request): Move here ... - * mainloop.c: from here. - * staprun.c (send_relocations): New function to send kernel - and module relocation bases to probe module. - * staprun.h: Corresponding changes. - -2008-06-03 Frank Ch. Eigler <fche@elastic.org> - - PR 6429. - * mainloop.c (stp_main_loop): Remove STP_UNWIND message support. - -2008-05-05 Martin Hunt <hunt@redhat.com> - - * mainloop.c (child_proc): Handle sig_chld - in the proper thread. - (signal_thread): Don't call send_request() - because it isn't thread-safe. - -2008-05-05 Martin Hunt <hunt@redhat.com> - - * mainloop.c (signal_thread): New thread to handle signals - better. - (setup_main_signals): Create signal thread. - -2008-04-30 Masami Hiramatsu <mhiramat@redhat.com> - - PR 6008 - * common.c (parse_args): Increase the limitation of the buffer size - to 4095MB. - * common.c (usage): Ditto. - -2008-04-30 Masami Hiramatsu <mhiramat@redhat.com> - - * stapio.c (main): Fix a typo in a debug message. - * staprun.c (main): Ditto. - -2008-04-24 Frank Ch. Eigler <fche@elastic.org> - - PR 6451. - * common.c (control_channel): Initialize to -1. - * ctl.c (close_ctl_channel): Tolerate fd=0. - -2008-04-22 Martin Hunt <hunt@redhat.com> - - * cap.c (init_cap): Detect capabilities failure and - run with them disabled. - -2008-04-22 Martin Hunt <hunt@redhat.com> - - * mainloop.c (send_request): Move here from common.c - staprun no longer send any messages. - -2008-04-22 hunt <hunt@redhat.com> - - * common.c (usage): Add -d option. - -2008-04-21 Martin Hunt <hunt@redhat.com> - - * staprun.c, stapio.c, staprun.h, mainloop.c, staprun_funcs.c, - ctl.c, common.c: Add "-d" option to have staprun remove - modules. Have staprun exec stapio and then have stapio - exec "staprun -d" to remove the module when finished. - -2008-04-16 Martin Hunt <hunt@redhat.com> - - * ctl.c (init_ctl_channel): Remove unused parameter. - Just opens one channel now. - -2008-02-21 David Smith <dsmith@redhat.com> - - * staprun_funcs.c (check_path): Small security fix. - -2008-01-21 Martin Hunt <hunt@redhat.com> - - * symbols.c (send_module): Simplify and use new send_data() - function to keep longword alignment. - -2008-01-14 Martin Hunt <hunt@redhat.com> - - PR4037 and fixes to better synchronize staprun and stapio. - * symbols.c (send_data): Send header and data seperately, saving - a memcpy and avoiding any alignment issues. - (get_sections): Return -1 on error instead of just exiting - and leaving stapio hanging. Send data in proper format even if kernel - pointers are different size. - (send_module): Return -1 on error instead of just exiting - and leaving stapio hanging. - (do_module): Ditto. - (compar): Removed. - (do_kernel_symbols): Rewrite to be more robust. Return -1 on - error instead of just exiting and leaving stapio hanging. - - * staprun_funcs.c (handle_symbols): Signal stapio if we error out. - Set kernel_ptr_size; - - * staprun.h (kernel_ptr_size): Declare. - - * mainloop.c (stp_main_loop): When ready, send STP_READY. - -2008-01-12 Frank Ch. Eigler <fche@elastic.org> - - PR 5603 horrible hack. - * symbols.c (do_kernel_symbols): Make buf[256] instead of [128]. - -2007-12-11 Martin Hunt <hunt@redhat.com> - PR5368 - * relay_old.c (init_oldrelayfs): Don't start threads - if load_only. - * relay.c (init_relayfs): Ditto. - -2007-11-09 Martin Hunt <hunt@redhat.com> - - * mainloop.c (stp_main_loop): Bump recvbuf to 8196 for - compatibility with old transport. - -2007-10-26 Martin Hunt <hunt@redhat.com> - PR5218 - * stapio.c (main): Set initialized properly when - attached. - -2007-10-12 Martin Hunt <hunt@redhat.com> - Changes to separate the symbols from the command channel. - - * cap.c (init_cap): Add CAP_DAC_OVERRIDE. - * staprun.h: Change init_ctl_channel prototype. - * ctl.c (init_ctl_channel): Modify to open either - a command or symbol channel. Use ".cmd" and ".symbols" - as the new names. - * mainloop.c (init_stapio): Call init_ctl_channel(0); - * staprun.c (cleanup): Call stop_symbol_thread(). - (main): Call start_symbol_thread(). - * staprun_funcs.c (handle_symbols): Make a thread. - (start_symbol_thread): New. - (stop_symbol_thread): New. - -2007-10-11 Frank Ch. Eigler <fche@elastic.org> - - * staprun.c (main): Move checks for init_cap and getuid - from just before command line argument parsing to just after. - -2007-10-09 Martin Hunt <hunt@redhat.com> - - * common.c (set_clexec): New. - * staprun.h: Add prototype for set_clexec. - * relay*.c, ctl.c: Call set_clexec after - file opens. - -2007-09-14 Martin Hunt <hunt@redhat.com> - - * ctl.c (init_ctl_channel): Return 1 if the ctl file opened - was for the old relayfs transport. - - * mainloop.c (init_stapio): Don't call using_old_transport(). - Use the return of init_ctl_channel() instead. - (using_old_transport): Deleted. - -2007-08-31 Martin Hunt <hunt@redhat.com> - - * mainloop.c (start_cmd): Set the priority to - forked processes back to normal. - (system_cmd): Ditto. - -2007-08-21 Martin Hunt <hunt@redhat.com> - - * mainloop.c (start_cmd): Send SIGINT to target_cmd, - not stapio. - -2007-08-20 David Smith <dsmith@redhat.com> - - From Lai Jiangshan <laijs@cn.fujitsu.com> - * common.c (parse_args): Make sure the '-c' and '-x' options can't - be specified together. - -2007-08-15 David Smith <dsmith@redhat.com> - - * staprun.c (main): Quit if effective uid is not root. - -2007-08-15 Martin Hunt <hunt@redhat.com> - PR4736 - * staprun.c (cleanup): Set priority back to normal - before removing module. - -2007-08-15 Martin Hunt <hunt@redhat.com> - - * stap_merge.tcl: New. - -2007-08-14 David Smith <dsmith@redhat.com> - - Merge from setuid-branch. Changes also by Martin Hunt - <hunt@redhat.com>. - - * staprun.c (init_staprun): Drop CAP_SYS_ADMIN when we're done - with it. - (main): Calls parse_modpath instead of path_parse_modname. Just - call parse_modpath with argv[optind]. Let it allocate and set - modpath and modname. If no modulename was given, display usage - and exit. Drop CAP_SYS_NICE when we're done with it. Set - atexit(exit_cleanup) so cleanup always gets called and modules get - removed. Call handle_symbols. - (run_stapio): Set argv[0] to stapio so that it executes as itself - instead of staprun. - (cleanup): Only do cleanups once and only try to remove module - when appropriate. - (exit_cleanup): New. Calls cleanup(). - (mountfs): Sets uid to root before making directory and then - restores uid. - (setup_ctl_channel): Uses DEBUGFS define and improved - error message. - (setup_relayfs): Ditto. - (setup_oldrelayfs): Uses DEBUGFS and RELAYFS defines. - (run_stp_check): Replaced by mountfs(). - (mountfs): New function. Replaces an external script with C code. - (init_staprun): Calls mountfs() instead of run_stp_check(). - - * staprun.h: Renamed path_parse_modname to parse_modpath. Added - MODULE_NAME_LEN define. Added [_][p]err macros. Removed - VERSION_CMD. - - * mainloop.c (cleanup_and_exit): Make sure initialized is 2 - before exiting with code 2. - (stp_main_loop): Set initialized to 2 when STP_TRANSPORT - is received. Call cleanup_and_exit() with proper status. - (start_cmd): exit 1 instead of -1. - (system_cmd): Ditto. - (init_staprun): Renamed init_stapio. - (cleanup_and_exit): Set exit status. - - * cap.c: New file. - * common.c: New file. - * stapio.c: New file. - * staprun_funcs.c: New file. - * Makefile: Removed. - - * symbols.c (get_sections): Move the filter code up so that - uninteresting section names are filtered out before - attempting to open them. - (do_kernel_symbols): Better detect overfow conditions and realloc - new space. - (do_module): After sending all modules, send a null message to - indicate we are finished. - - * ctl.c (init_ctl_channel): When attempting to attach, if the - control channel doesn't exist, print a better error message. - - * relay_old.c (init_oldrelayfs): Errors out if - open_relayfs_files() couldn't open any files. - - PR 4795 - * mainloop.c (send_request): Fixed buffer overflow check. - * staprun.h: Added buffer overflow checking versions of - strcpy/sprintf/snprintf. - * common.c (path_parse_modname): Checks for overflows on - strcpy/sprintf/snprintf. - (read_buffer_info): Ditto. - * ctl.c (init_ctl_channel): Ditto. - * relay.c (init_relayfs): Ditto. - * relay_old.c (open_relayfs_files): Ditto. - (init_oldrelayfs): Ditto. - * staprun_funcs.c (insert_module): Ditto. - (check_path): Ditto. - * symbols.c (get_sections): Ditto. - -2007-07-09 David Smith <dsmith@redhat.com> - - * relay.c (init_relayfs): Fixed a buffer size bug introduced by - the last change. - -2007-07-09 David Smith <dsmith@redhat.com> - - * relay.c (init_relayfs): Make sure buffers are big enough to hold - a full path. - * relay_old.c (init_oldrelayfs): Ditto. - -2007-07-09 David Smith <dsmith@redhat.com> - - * ctl.c (read_buffer_info): Make sure buffer is big enough to hold - a full path. - (init_ctl_channel): Ditto. - -2007-07-02 Martin Hunt <hunt@redhat.com> - - * symbols.c (get_sections): Set data pointer to the lowest address - of any data section. - -2007-06-21 Martin Hunt <hunt@redhat.com> - - * relay.c (init_relayfs): Send message to check for bulkmode. - -2007-06-20 Martin Hunt <hunt@redhat.com> - - * stap_merge.c (main): Add verbose option. Will realloc - buffer if current size is too small. Check return codes - from writes so gcc won't complain. - -2007-06-07 Martin Hunt <hunt@redhat.com> - - * relay_old.c (open_relayfs_files): Add support for - output file names (-o) with bulk (relayfs) mode. - -2007-06-04 Martin Hunt <hunt@redhat.com> - - * mainloop.c (cleanup_and_exit): Disable signals - while exiting. - (fatal_handler): Use return values from write() to - avoid warnings. - -2007-05-24 Martin Hunt <hunt@redhat.com> - - * mainloop.c (cleanup_and_exit): Fix typo. - -2007-05-22 Martin Hunt <hunt@redhat.com> - - * mainloop.c (init_staprun): Change dbug() call. - - * relay.c: Fix ppoll() call and some race conditions involving - signals. - -2007-05-10 Martin Hunt <hunt@redhat.com> - - * relay.c (reader_thread): Set timeout for streaming to - 200ms. - -2007-05-09 Martin Hunt <hunt@redhat.com> - - * relay.c (reader_thread): For bulk mode, set timeout to NULL - so ppoll never times out. - -2007-05-08 Martin Hunt <hunt@redhat.com> - - * relay.c (ppoll): Add a compatibility function for - glibc < 2.4. - -2007-05-08 Martin Hunt <hunt@redhat.com> - Signal handler cleanup. - * mainloop.c (fatal_handler): New. Cleanly handle - unexpected fatal signals. - (setup_main_signals): New. Set signals once mainloop - is entered. - (setup_signals): New. Block certain signals during initialization. - Set handler for fatal signals. - * relay.c (reader_thread): Use ppoll(). Terminate on - SIGUSR2 after reading any remaining data. - (close_relayfs): Remove sleep hack. Send SIGUSR2 to all threads. - - Runtime debug messages. - * staprun.h: Change dbug() to accept a debuglevel and - enable it. - * *.c: Modify dbug() calls. - -2007-05-07 Martin Hunt <hunt@redhat.com> - Patch from David Smith - * mainloop.c (stp_main_loop): Properly handle write() - return value. Fixes build problem with some compilers. - -2007-04-10 Martin Hunt <hunt@redhat.com> - - * relay.c (close_relayfs): Give threads some time to - run before closing. - -2007-04-06 Martin Hunt <hunt@redhat.com> - - * stp_merge.c (main): Remove extra newline in output. - * stap_merge.c: Renamed from stp_merge.c. - * Makefile: Updated. - -2007-04-02 Martin Hunt <hunt@redhat.com> - - * relay_old.c (close_oldrelayfs): If just detaching, call - pthread_cancel. - (open_relayfs_files): Just return 0 if relay_fd[cpu] not opened. - (init_oldrelayfs): Scan percpu files to calculate ncpus. - - * mainloop.c (init_staprun): Call old transport init when necessary. - (cleanup_and_exit): Ignore signals when cleaning up. - - * ctl.c (read_buffer_info): For old transport, need to read transport - parameters. - -2007-03-26 Martin Hunt <hunt@redhat.com> - - * mainloop.c (run_stp_check): Just use system() call. - (init_staprun): Remove _stp_pid module parameter. - (cleanup_and_exit): If closed==2, just exit without removing module. - (driver_poll): Remove. We no longer require stap running. - (_stp_main_loop): Remove call to driver_poll. - - * ctl.c (init_ctl_channel): Don't put files in systemtap_pid, - revert back to systemtap/modulename. - - * relay.c: Revert back to systemtap/modulename paths. - * relay_old.c: Ditto. - - * staprun.c: Add -L and -A args. - -2007-03-20 Martin Hunt <hunt@redhat.com> - - * symbols.c (send_module): If send returns < 0 then - cleanup and exit. - (do_kernel_symbols): Ditto. - -2007-03-18 Martin Hunt <hunt@redhat.com> - * staprun.h (err): Define. - * symbols.c (get_sections): More overflow checking. - -2007-03-18 Martin Hunt <hunt@redhat.com> - * symbols.c (get_sections): Filter out .gnu.linkonce.* sections - except for .gnu.linkonce.this_module. - -2007-03-18 Martin Hunt <hunt@redhat.com> - * staprun.h (VERSION_CMD): Command to use for version check. - Changes to support runtime decision on new or old transport. - * mainloop.c (init_staprun): Check the kernel version at runtime - instead of at compile time. - (cleanup_and_exit): Call the correct relayfs close function. - (stp_main_loop): Call the correct relayfs init function. - * relay.c: Remove ifdef wrapper. File is always compiled and used - if the kernel version is appropriate. - * relay_old.c: Ditto. - -2007-03-14 Martin Hunt <hunt@redhat.com> - - * staprun.c: Renamed from stpd.c. Removed quiet and print_only - options. Added "-x" option as an alias for "-t". Removed "-m" - option. Updated arg processing to leave 4 slots for modoptions[]. - Bump the priority of staprun. - * ctl.c: New. Transport control channel functions. - * relay.c: New. Relayfs control functions for new transport. - * relay_old.c: New. Relayfs control functions for older - versions of relayfs. - * mainloop.c: New. Staprun main loop. - * staprun.h: Renamed from librelay.h. Cleaned up. - - * stap_merge.c: Renamed. Updated for modified save format. - - -2006-12-11 Martin Hunt <hunt@redhat.com> - - * symbols.c (get_sections): Set buffer sizes to large enough - sizes to hold all possible values, but also include checks in case - we are wrong. - -2006-11-15 Martin Hunt <hunt@redhat.com> - - * symbols.c (do_kernel_symbols): Add sizeof(long) to sym_base - to preserve 64-bit alignment. - -2006-11-09 Martin Hunt <hunt@redhat.com> - - * librelay.c: Change all references to transport messages - to use the new names with "_stp" prefix. - (stp_main_loop): For STP_SYMBOLS, check pointer size and - endianess to confirm staprun is compatible with the kernel. - - * librelay.h: Move a bunch of common includes here. - * stpd.c: Cleanup includes. - * symbols.c: Ditto. - -2006-11-02 Martin Hunt <hunt@redhat.com> - - * symbols.c: New file. Sends symbol and module information to - the systemtap module. - - * librelay.c (stp_main_loop): Add STP_MODULE and STP_SYMBOLS - message handling. - - * librelay.h: Add some new function prototypes. - - * Makefile (CFLAGS): Set to be the same as for building modules. - Added symbols.c to sources. - -2006-10-10 Tom Zanussi <zanussi@us.ibm.com> - - * librelay.c (merge_output): Add check for min when writing - output, otherwise last write happens twice. - -2006-09-26 David Smith <dsmith@redhat.com> - - * Makefile: Changed 'stpd' references to 'staprun'. - * librelay.c: Ditto. - * stpd.c: Ditto. - -2006-09-25 Tom Zanussi <zanussi@us.ibm.com> - - * librelay.c (kill_percpu_threads): Remove printf. - (wait_for_percpu_threads): New. - (process_subbufs): Remove processing, processing_mutex, exit - thread if exiting flag set. - (read_last_buffers): Removed. - (cleanup_and_exit): Remove call to read_last_buffers, wait for - threads to read flushed buffers instead. - (stp_main_loop): Remove mutex init. - -2006-09-22 Tom Zanussi <zanussi@us.ibm.com> - - * librelay.c (init_relayfs): Cleanup if stp_check fails. - -2006-09-19 Tom Zanussi <zanussi@us.ibm.com> - - * librelay.c (init_relayfs): Add debugfs path to relay files and - add new systemtap directory to path. - (init_stp): rmmod module on failure. - (merge_output): Remove debugging printfs left in code. - (close_relay_files): Clear relay_file descriptor after close. - (cleanup_and_exit): Allow cleanup and exit even if there was an - error opening relay files. - (stp_main_loop): Call cleanup_and_exit() if init_relayfs() fails. - -2006-09-18 Martin Hunt <hunt@redhat.com> - - * stpd.c (usage): Remove "-m" option. - (main): Print warning if "-m" is used. - * librelay.c (merge_output): Rewrite to handle - new format that support binary. - (stp_main_loop): Read merge option from the - transport info message. - -2006-09-13 Martin Hunt <hunt@redhat.com> - - * librelay.c (init_relayfs): Exec stp_check and find - relay_filebase. - - * librelay.h (stp_main_loop): Fix declaration of init_stp(). - - * stpd.c (usage): Remove "-r" option. - (main): Don't find stpd_filebase and don't send it to init_stp(). - - -2006-08-02 Tom Zanussi <zanussi@us.ibm.com> - - * stpd.c (main): Use modname rather than driver_pid in - stpd_filebase. - -2006-07-20 Martin Hunt <hunt@redhat.com> - - * librelay.c (stp_main_loop): If module doesn't start, kill any - target command. - -2006-06-23 Tom Zanussi <zanussi@us.ibm.com> - - * librelay.c (cleanup_and_exit): Close relay files even if - not merging. - -2006-06-13 Martin Hunt <hunt@redhat.com> - - * librelay.c (start_cmd): Rewrite using sigwait() to eliminate - a race. - -2006-05-18 Martin Hunt <hunt@redhat.com> - - * librelay.c (stp_main_loop): Set output to always be line - buffered. - -2006-04-08 Martin Hunt <hunt@redhat.com> - - * librelay.c (stp_main_loop): Write with fwrite() instead - of fputs() so we can write binary data. - -2006-04-05 Martin Hunt <hunt@redhat.com> - * librelay.c (merge_output): Remove ANSI codes and write - warning to stderr. - -2006-04-05 Martin Hunt <hunt@redhat.com> - * librelay.c (merge_output): Set the output filename if necessary. - (merge_output): - - * stpd.c (main): Don't reset output_filename just because - relayfs is possible. Move that code to librelay.c. - -2006-04-04 Roland McGrath <roland@redhat.com> - - * stpd.c (main): Cast f_type when comparing; type differs by machine. - -2006-04-04 Tom Zanussi <zanussi@us.ibm.com> - - * stpd.c (main): Check that /mnt/relay is actually relayfs. - -2006-03-15 Tom Zanussi <zanussi@us.ibm.com> - - * stpd.c (main): Add runtime check for relayfs vs relay-on-proc. - -2006-03-06 Martin Hunt <hunt@redhat.com> - - * librelay.c (start_cmd): Set proper uid/gid before execing - command. - (system_cmd): New function. - (cleanup_and_exit): Wait for any child processes to complete. - (stp_main_loop): Recognize STP_SYSTEM message. - - * stpd.c (main): Add support for "-u username". - -2006-02-25 Martin Hunt <hunt@redhat.com> - - * librelay.c (init_stp): Better error handling and cleanup. - -2006-02-23 Frank Ch. Eigler <fche@elastic.org> - - PR 1304 - * stpd.c (mdooptions): New array. - (main): Populate it with leftover arguments. - * librelay.c (init_stp): Pass it to execve(). - -2005-12-08 Frank Ch. Eigler <fche@elastic.org> - - PR 1937 - * stpd.c (main): Support new "-d" option. - (usage): Document it. - * librelay.c (driver_poll): New function to react to death of - driver process. - (stp_main_loop): Call it if "-d PID" given. Treat SIGHUP like others. - -2005-10-19 Tom Zanussi <zanussi@us.ibm.com> - - * librelay.c: Move output_file var to stpd.c. - (stp_main_loop): If the output_file option was specified, - and streaming mode is being used, send output to the file - instead of stdout. If !streaming, send output to the file - instead of probe.out. - * stpd.c (usage): Add comment for -o option. - (main): Add -o option. - -2005-10-19 Tom Zanussi <zanussi@us.ibm.com> - - * librelay.c (merge_output): Switch to binary TIMESTAMP. - * stp_dump.c (main): Switch to binary TIMESTAMP. - * stp_merge.c (main): Switch to binary TIMESTAMP. - -2005-10-14 Tom Zanussi <zanussi@us.ibm.com> - - PR 1476 - * librelay.c: Add flag for buffer processing. - (reader_thread): Disable/enable cancel state around buffer - processing, and update flag to show we're busy processing. - (cleanup_and_exit): Wait for any threads busy processing. - (stp_main_loop): Initialize processing mutex. - -2005-09-06 Martin Hunt <hunt@redhat.com> - - * librelay.c: Remove all USE_PROCFS ifdefs. - (sig_usr): Signal handler for SIGUSR1. - (start_cmd): New function to handle "-c" option, forks() - off a new process then waits for SIGUSR1 to exec it. - (init_stp): Call start_cmd(). - (stp_main_loop): Set a signal handler for SIGCHLD. - - * stpd.c (main): Add "-t" and "-c" options. - (usage): Update with new options. - -2005-08-29 Martin Hunt <hunt@redhat.com> - - * stpd.c main): Add enable_relayfs flag. - Turn it off with "-r". - -2005-08-24 Martin Hunt <hunt@redhat.com> - - * librelay.c (sigproc): Removed the "Exiting..." - message for now. - -2005-08-24 Martin Hunt <hunt@redhat.com> - - * librelay.c (sigproc): Reestablish signal handler so - impatient people don't hit ^C twice and terminate the - program before it saves the data and removes the module. - Also print a message to stderr that it is exiting. - (stp_main_loop): Write OOB data (warnings, errors, etc) - to stderr instead of stdout. - * librelay.h: Write debug info to stderr. - * Makefile: add librelay.h to dependencies. - -2005-08-23 Martin Hunt <hunt@redhat.com> - - * librelay.c (merge_output): Don't add an extra \n. - -2005-08-23 Martin Hunt <hunt@redhat.com> - - * librelay.c (read_last_buffers): New function. Directly grab the - last buffers. - (info_pending): Deleted. - (request_last_buffers): Deleted. - -2005-08-22 Martin Hunt <hunt@redhat.com> - - * Makefile (debug): Add debug target. - * librelay.h (dbug): Define. - * librelay.c: Enable some dbug lines. - -2005-08-19 Martin Hunt <hunt@redhat.com> - - * librelay.c (reader_thread): Check the return value for write(). - -2005-08-19 Frank Ch. Eigler <fche@elastic.org> - - * librelay.c (modpath): New global. Use it for insmod only. - * stpd.c (main): Set both modpath and modname, to support - modules specified by full path name. - -2005-08-19 Martin Hunt <hunt@redhat.com> - - * stpd.c (main): Simplify buffer size code. - * librelay.c: Major changes to support procfs instead of netlink. - -2005-08-03 Tom Zanussi <trz@us.ibm.com> - - * librelay.c: Track subbuf info requests/replies - so we know unequivocally when it's ok to do final - processing. - (reader_thread): Remove buffer-full warning. - -2005-08-03 Martin Hunt <hunt@redhat.com> - * librelay.c (init_stp): Change variable name to eliminate shadow warning. - -2005-08-03 Martin Hunt <hunt@redhat.com> - * librelay.c (open_control_channel): Set the receive buffer - to 512K, or the max allowed. - - * stpd.c: Remove "-n" subbug option and change "-b" option - so you can specify buffering in different ways. Add a verbose option. - Exec the "stp_check" script. - -2005-08-01 Frank Ch. Eigler <fche@redhat.com> - - * librelay.c: Correct fwrite api usage. - * all: Correct copyright holder name. - -2005-08-01 Martin Hunt <hunt@redhat.com> - - * librelay.h: Get structs and enums from - ../transport/transport_msgs.h to eliminate duplication. - - * librelay.c (send_request): Retry if send fails. - (open_relayfs_files): Use fopen() instead of open() for the - percpu tmpfiles. - (request_last_buffers): Just send cpu number for STP_BUF_INFO request. - (reader_thread): Ditto. - (process_subbufs): Use fwrite_unlocked() instead of write(). - (sigchld): Removed. - (init_stp): Go back to using system() instead of fork and exec - to load module. When done, send a TRANSPORT_INFO request. - (cleanup_and_exit): Change parameter to simple flag to - indicate if the module needs removing. - (sigproc): Remove complicated logic and just send STP_EXIT. - (stp_main_loop): When receiving STP_TRANSPORT_INFO, set - the local params and reply with a STP_START. When - receiving STP_START, there was an error, so cleanup and exit. - - * stpd.c (main): Added new options to set number of - buffers and their size. - -2005-07-29 Roland McGrath <roland@redhat.com> - - * librelay.c (process_subbufs): Use unsigned for I. - (sigproc): Add __attribute__((unused)) on parameter. - (sigchld): Likewise. Avoid shadowing global variable name. - (stp_main_loop): Add a cast. - -2005-07-18 Martin Hunt <hunt@redhat.com> - - * stp_merge.c (main): Fix dropped count calculation. - -2005-07-14 Tom Zanussi <zanussi@us.ibm.com> - - * librelay.c (reader_thread): Add missing pthread_mutex_lock - -2005-07-14 Frank Ch. Eigler <fche@redhat.com> - - * stpd.c (main): Pass !quiet mode to init_stp(). - * librelay.c (init_relayfs): Be quiet if !print_totals. - -2005-07-13 Martin Hunt <hunt@redhat.com> - - * stpd.c (usage): Fix usage string. - - * librelay.c (init_stp): Change last arg to NULL, not 0. - -2005-07-08 Martin Hunt <hunt@redhat.com> - - * librelay.c (sigchld): Signal handler to detect - completion of module loading. - (init_stp): Use fork/exec instead of system() so - we can get async signal of module load success/failure. - (cleanup_and_exit): New function. - (sigproc): If module is not loaded, don't send message to it. - (stp_main_loop): Call cleanup_and_exit() when STP_EXIT - is received. Don't send a request for the transport - mode. The module will send notification to the daemon - when it is ready. - - * stpd.c (main): Don't print message until module - is loaded. - -2005-07-01 Martin Hunt <hunt@redhat.com> - - * librelay.c: Removed the color coding of cpu output. - -2005-06-28 Martin Hunt <hunt@redhat.com> - - * librelay.c (merge_output): Use unlocked stdio - to improve speed. - - * stp_merge.c: New file. - - * Makefile: Add stp_merge. - -2005-06-27 Martin Hunt <hunt@redhat.com> - - * stpd.c (main): Add new command line arg, "-m" - to disable the per-cpu merging. - - * librelay.c (merge_output): Replacement for sort_output(). - Efficiently merges per-cpu streams. - - -2005-06-20 Tom Zanussi <zanussi@us.ibm.com> - - * librelay.c: Large refactoring, important changes are - added transport_mode command, for relayfs transport - display results only when probe completes and/or write - output file, merge, sort and delete the per-cpu files - in postprocessing, refactor so that relayfs files aren't - created until transport command received, removed sigalrm, - read the final subbuffers on exit - - * stpd.c: Remove all command-line args except for -p - and -q as well as all code related to buffer sizes. - - * librelay.h: Add transport mode command and struct. - -2005-05-16 Martin Hunt <hunt@redhat.com> - - * librelay.c (sigproc): If STP_EXIT send fails, keep retrying - every 10ms. - (init_stp): Don't set n_subbufs and subbuf_size params. diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c index 2fb049b0..29eb4f1f 100644 --- a/runtime/staprun/mainloop.c +++ b/runtime/staprun/mainloop.c @@ -357,6 +357,8 @@ void cleanup_and_exit(int detach) err("\nDisconnecting from systemtap module.\n" "To reconnect, type \"staprun -A %s\"\n", modname); } else { const char *staprun = getenv ("SYSTEMTAP_STAPRUN") ?: BINDIR "/staprun"; +#define BUG9788_WORKAROUND +#ifndef BUG9788_WORKAROUND dbug(2, "removing %s\n", modname); if (execlp(staprun, basename (staprun), "-d", modname, NULL) < 0) { if (errno == ENOEXEC) { @@ -368,6 +370,51 @@ void cleanup_and_exit(int detach) perror(staprun); _exit(1); } +#else + pid_t pid; + int rstatus; + struct sigaction sa; + + dbug(2, "removing %s\n", modname); + + // So that waitpid() below will work correctly, we need to clear + // out our SIGCHLD handler. + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + sa.sa_handler = SIG_DFL; + sigaction(SIGCHLD, &sa, NULL); + + pid = fork(); + if (pid < 0) { + _perr("fork"); + _exit(-1); + } + + if (pid == 0) { /* child process */ + /* Run the command. */ + if (execlp(staprun, basename (staprun), "-d", modname, NULL) < 0) { + if (errno == ENOEXEC) { + char *cmd; + if (asprintf(&cmd, "%s -d '%s'", staprun, modname) > 0) + execl("/bin/sh", "sh", "-c", cmd, NULL); + free(cmd); + } + perror(staprun); + _exit(1); + } + } + + /* parent process */ + if (waitpid(pid, &rstatus, 0) < 0) { + _perr("waitpid"); + _exit(-1); + } + + if (WIFEXITED(rstatus)) { + _exit(WEXITSTATUS(rstatus)); + } + _exit(-1); +#endif } _exit(0); } diff --git a/runtime/stat.c b/runtime/stat.c index e40a4f2d..689a84fe 100644 --- a/runtime/stat.c +++ b/runtime/stat.c @@ -74,7 +74,7 @@ typedef struct _Stat *Stat; * @param stop - An integer. The stopping value. Should be > start. * @param interval - An integer. The interval. */ -Stat _stp_stat_init (int type, ...) +static Stat _stp_stat_init (int type, ...) { int size, buckets=0, start=0, stop=0, interval=0; stat *sd, *agg; @@ -141,7 +141,7 @@ exit1: * * @param st Stat */ -void _stp_stat_del (Stat st) +static void _stp_stat_del (Stat st) { if (st) { _stp_free_percpu (st->sd); @@ -156,7 +156,7 @@ void _stp_stat_del (Stat st) * @param st Stat * @param val Value to add */ -void _stp_stat_add (Stat st, int64_t val) +static void _stp_stat_add (Stat st, int64_t val) { stat *sd = per_cpu_ptr (st->sd, get_cpu()); STAT_LOCK(sd); @@ -175,7 +175,7 @@ void _stp_stat_add (Stat st, int64_t val) * @param cpu CPU number * @returns A pointer to a stat. */ -stat *_stp_stat_get_cpu (Stat st, int cpu) +static stat *_stp_stat_get_cpu (Stat st, int cpu) { stat *sd = per_cpu_ptr (st->sd, cpu); STAT_LOCK(sd); @@ -203,7 +203,7 @@ static void _stp_stat_clear_data (Stat st, stat *sd) * for polling. * @returns A pointer to a stat. */ -stat *_stp_stat_get (Stat st, int clear) +static stat *_stp_stat_get (Stat st, int clear) { int i, j; stat *agg = st->agg; @@ -242,7 +242,7 @@ stat *_stp_stat_get (Stat st, int clear) * * @param st Stat */ -void _stp_stat_clear (Stat st) +static void _stp_stat_clear (Stat st) { int i; stp_for_each_cpu(i) { diff --git a/runtime/string.c b/runtime/string.c index 13c46dda..cdafbf64 100644 --- a/runtime/string.c +++ b/runtime/string.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * String Functions - * Copyright (C) 2005, 2006, 2007 Red Hat Inc. + * Copyright (C) 2005, 2006, 2007, 2009 Red Hat Inc. * * This file is part of systemtap, and is free software. You can * redistribute it and/or modify it under the terms of the GNU General @@ -28,7 +28,7 @@ * variable number of args. */ -int _stp_snprintf(char *buf, size_t size, const char *fmt, ...) +static int _stp_snprintf(char *buf, size_t size, const char *fmt, ...) { va_list args; int i; @@ -39,7 +39,7 @@ int _stp_snprintf(char *buf, size_t size, const char *fmt, ...) return i; } -int _stp_vscnprintf(char *buf, size_t size, const char *fmt, va_list args) +static int _stp_vscnprintf(char *buf, size_t size, const char *fmt, va_list args) { unsigned i = _stp_vsnprintf(buf,size,fmt,args); return (i >= size) ? (size - 1) : i; @@ -60,9 +60,8 @@ int _stp_vscnprintf(char *buf, size_t size, const char *fmt, va_list args) * in will have "..." after the second quote. * @param user Set this to indicate the input string pointer is a userspace pointer. */ -void _stp_text_str(char *outstr, char *in, int len, int quoted, int user) +static void _stp_text_str(char *outstr, char *in, int len, int quoted, int user) { - const int length = len; char c, *out = outstr; if (len == 0 || len > MAXSTRINGLEN-1) diff --git a/runtime/string.h b/runtime/string.h index 6106b009..f4d4cc05 100644 --- a/runtime/string.h +++ b/runtime/string.h @@ -1,5 +1,5 @@ /* -*- linux-c -*- - * Copyright (C) 2005, 2007 Red Hat Inc. + * Copyright (C) 2005, 2007, 2009 Red Hat Inc. * * This file is part of systemtap, and is free software. You can * redistribute it and/or modify it under the terms of the GNU General @@ -9,12 +9,8 @@ #ifndef _STRING_H_ #define _STRING_H_ -/* set up a special stdout string */ -static char _stp_stdout[] = "_stdout_"; - #define to_oct_digit(c) ((c) + '0') -void _stp_vsprintf (char *str, const char *fmt, va_list args); -void _stp_text_str(char *out, char *in, int len, int quoted, int user); +static void _stp_text_str(char *out, char *in, int len, int quoted, int user); /* * Powerpc uses a paranoid user address check in __get_user() which diff --git a/runtime/sym.c b/runtime/sym.c index 82eef17d..3788544e 100644 --- a/runtime/sym.c +++ b/runtime/sym.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * Symbolic Lookup Functions - * Copyright (C) 2005-2008 Red Hat Inc. + * Copyright (C) 2005-2009 Red Hat Inc. * Copyright (C) 2006 Intel Corporation. * * This file is part of systemtap, and is free software. You can @@ -21,11 +21,10 @@ */ /* XXX: this needs to be address-space-specific. */ -unsigned long _stp_module_relocate(const char *module, const char *section, unsigned long offset) +static unsigned long _stp_module_relocate(const char *module, const char *section, unsigned long offset) { static struct _stp_module *last = NULL; static struct _stp_section *last_sec; - unsigned long flags; unsigned i, j; /* if module is -1, we invalidate last. _stp_del_module calls this when modules are deleted. */ @@ -134,7 +133,6 @@ static const char *_stp_kallsyms_lookup(unsigned long addr, unsigned long *symbo struct _stp_module *m = NULL; struct _stp_section *sec = NULL; struct _stp_symbol *s = NULL; - unsigned long flags; unsigned end, begin = 0; m = _stp_mod_sec_lookup(addr, task, &sec); @@ -256,7 +254,7 @@ static int _stp_module_check(void) * a probe because it is too time-consuming. Use at module exit time. */ -void _stp_symbol_print(unsigned long address) +static void _stp_symbol_print(unsigned long address) { const char *modname; const char *name; @@ -275,7 +273,7 @@ void _stp_symbol_print(unsigned long address) } /* Like _stp_symbol_print, except only print if the address is a valid function address */ -int _stp_func_print(unsigned long address, int verbose, int exact) +static int _stp_func_print(unsigned long address, int verbose, int exact) { const char *modname; const char *name; @@ -303,7 +301,7 @@ int _stp_func_print(unsigned long address, int verbose, int exact) return 0; } -void _stp_symbol_snprint(char *str, size_t len, unsigned long address, +static void _stp_symbol_snprint(char *str, size_t len, unsigned long address, struct task_struct *task) { const char *modname; diff --git a/runtime/sym.h b/runtime/sym.h index 9d6a4ded..e642cab4 100644 --- a/runtime/sym.h +++ b/runtime/sym.h @@ -54,15 +54,15 @@ struct _stp_module { /* Defined by translator-generated stap-symbols.h. */ -struct _stp_module *_stp_modules []; -unsigned _stp_num_modules; +static struct _stp_module *_stp_modules []; +static unsigned _stp_num_modules; /* the number of modules in the arrays */ static unsigned long _stp_kretprobe_trampoline = 0; -unsigned long _stp_module_relocate (const char *module, const char *section, unsigned long offset); +static unsigned long _stp_module_relocate (const char *module, const char *section, unsigned long offset); static struct _stp_module *_stp_get_unwind_info (unsigned long addr); #endif /* _STP_SYM_H_ */ diff --git a/runtime/task_finder.c b/runtime/task_finder.c index 31bccad8..ae381a41 100644 --- a/runtime/task_finder.c +++ b/runtime/task_finder.c @@ -22,14 +22,14 @@ struct stap_task_finder_target; #define __STP_TF_RUNNING 1 #define __STP_TF_STOPPING 2 #define __STP_TF_STOPPED 3 -atomic_t __stp_task_finder_state = ATOMIC_INIT(__STP_TF_STARTING); -atomic_t __stp_inuse_count = ATOMIC_INIT (0); +static atomic_t __stp_task_finder_state = ATOMIC_INIT(__STP_TF_STARTING); +static atomic_t __stp_inuse_count = ATOMIC_INIT (0); #define __stp_tf_handler_start() (atomic_inc(&__stp_inuse_count)) #define __stp_tf_handler_end() (atomic_dec(&__stp_inuse_count)) #ifdef DEBUG_TASK_FINDER -atomic_t __stp_attach_count = ATOMIC_INIT (0); +static atomic_t __stp_attach_count = ATOMIC_INIT (0); #define debug_task_finder_attach() (atomic_inc(&__stp_attach_count)) #define debug_task_finder_detach() (atomic_dec(&__stp_attach_count)) @@ -55,7 +55,7 @@ typedef int (*stap_task_finder_vm_callback)(struct stap_task_finder_target *tgt, unsigned long vm_end, unsigned long vm_pgoff); -int __stp_tf_vm_cb(struct stap_task_finder_target *tgt, +static int __stp_tf_vm_cb(struct stap_task_finder_target *tgt, struct task_struct *tsk, int map_p, char *vm_path, unsigned long vm_start, @@ -230,6 +230,14 @@ stap_utrace_detach(struct task_struct *tsk, if (tsk == NULL || tsk->pid <= 1) return 0; +#ifdef PF_KTHREAD + // Ignore kernel threads. On systems without PF_KTHREAD, + // we're ok, since kernel threads won't be matched by the + // utrace_attach_task() call below. + if (tsk->flags & PF_KTHREAD) + return 0; +#endif + // Notice we're not calling get_task_mm() here. Normally we // avoid tasks with no mm, because those are kernel threads. // So, why is this function different? When a thread is in @@ -302,6 +310,14 @@ stap_utrace_detach_ops(struct utrace_engine_ops *ops) rcu_read_lock(); do_each_thread(grp, tsk) { +#ifdef PF_KTHREAD + // Ignore kernel threads. On systems without + // PF_KTHREAD, we're ok, since kernel threads won't be + // matched by the stap_utrace_detach() call. + if (tsk->flags & PF_KTHREAD) + continue; +#endif + rc = stap_utrace_detach(tsk, ops); if (rc != 0) goto udo_err; @@ -414,7 +430,14 @@ __stp_utrace_attach(struct task_struct *tsk, if (tsk == NULL || tsk->pid <= 1) return EPERM; - // Ignore threads with no mm (which are kernel threads). +#ifdef PF_KTHREAD + // Ignore kernel threads + if (tsk->flags & PF_KTHREAD) + return EPERM; +#endif + + // Ignore threads with no mm (which are either kernel threads + // or "mortally wounded" threads). mm = get_task_mm(tsk); if (! mm) return EPERM; @@ -917,7 +940,7 @@ utftq_out: } -struct vm_area_struct * +static struct vm_area_struct * __stp_find_file_based_vma(struct mm_struct *mm, unsigned long addr) { struct vm_area_struct *vma = find_vma(mm, addr); @@ -1218,7 +1241,7 @@ struct utrace_engine_ops __stp_utrace_task_finder_ops = { .report_death = stap_utrace_task_finder_report_death, }; -int +static int stap_start_task_finder(void) { int rc = 0; diff --git a/runtime/time.c b/runtime/time.c index 15e205dd..ad7cef9d 100644 --- a/runtime/time.c +++ b/runtime/time.c @@ -54,10 +54,10 @@ typedef struct __stp_time_t { struct timer_list timer; } stp_time_t; -void *stp_time = NULL; +static void *stp_time = NULL; /* Flag to tell the timer callback whether to reregister */ -int stp_timer_reregister = 0; +static int stp_timer_reregister = 0; /* Try to estimate the number of CPU cycles in a millisecond - i.e. kHz. This * relies heavily on the accuracy of udelay. By calling udelay twice, we @@ -185,7 +185,7 @@ __stp_time_cpufreq_callback(struct notifier_block *self, return NOTIFY_OK; } -struct notifier_block __stp_time_notifier = { +static struct notifier_block __stp_time_notifier = { .notifier_call = __stp_time_cpufreq_callback, }; @@ -205,7 +205,7 @@ __stp_constant_freq(void) #endif /* CONFIG_CPU_FREQ */ /* This function is called during module unloading. */ -void +static void _stp_kill_time(void) { if (stp_time) { @@ -227,7 +227,7 @@ _stp_kill_time(void) } /* This function is called during module loading. */ -int +static int _stp_init_time(void) { int ret = 0; @@ -268,7 +268,7 @@ _stp_init_time(void) return ret; } -int64_t +static int64_t _stp_gettimeofday_ns(void) { int64_t base; diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog deleted file mode 100644 index e8e2a047..00000000 --- a/runtime/transport/ChangeLog +++ /dev/null @@ -1,807 +0,0 @@ -2009-01-06 Frank Ch. Eigler <fche@elastic.org> - - PR9699. - * transport.c (_stp_transport_init): Adapt to task_struct cred switch. - -2008-11-28 Frank Ch. Eigler <fche@elastic.org> - - PR5947: make code -Wpointer-arith clean - * symbols.c (generic_swap): Cast void* to char* as needed. - (_stp_sort): Ditto. - * utt.c (utt_switch_subbuf): Ditto. - * utt.h (utt_reserve): Ditto. - -2008-11-13 Masami Hiramatsu <mhiramat@redhat.com> - - * utt.c (utt_trace_setup): Use KERN_WARNING and show buffer size. - -2008-11-13 Masami Hiramatsu <mhiramat@redhat.com> - - PR7016 - * utt.c (utt_trace_setup): Check freeram and bufferram before - allocating relay buffers for avoiding OOM. - -2008-11-12 Frank Ch. Eigler <fche@elastic.org> - - * transport.c (_stp_cleanup_and_exit): Move debug print into - one-time conditional block to prevent spew. - -2008-10-07 Frank Ch. Eigler <fche@elastic.org> - - PR 4886 - * symbols.c (_stp_do_relocation): Simplify processing of build-id - note address. - -2008-09-17 Frank Ch. Eigler <fche@elastic.org> - - PR 6487, 6504. - From Masami Hiramatsu <mhiramat@redhat.com> - * utt.c (utt_switch_subbof, _utt_wakeup*, utt_reserve): New. - -2008-07-17 Frank Ch. Eigler <fche@elastic.org> - - * symbols.c (_stp_do_relocation): Adapt to stp_module decl changes. - -2008-07-12 Frank Ch. Eigler <fche@elastic.org> - - PR 6738. - * procfs.c (*): Remove code/data associated with symbol/unwind data - uploading. - (_stp_ctl_write_cmd): Support STP_RELOCATION message. - (kbug): Replace calls with dbug_trans(). - * relayfs.c (kbug): Ditto. - * transport.h: Corresponding changes. - -2008-07-10 Frank Ch. Eigler <fche@elastic.org> - - PR 6736. - * control.c (_stp_ctl_write_cmd): Accept STP_RELOCATION message. - * symbols.c: Gutted file. - (_stp_do_relocation): New function. - * transport.c (_stp_transport_init): Corresponding changes. - * transport_msgs.h: Ditto. - -2008-07-09 Frank Ch. Eigler <fche@elastic.org> - - PR5963 - * transport.c (_stp_work_queue): Don't signal a premature exit - if a begin probe happened to exit(). - -2008-06-23 Wenji Huang <wenji.huang@oracle.com> - PR 6646 - * symbols.c (_stp_validate_addr): Revert the previous code. - -2008-06-23 Wenji Huang <wenji.huang@oracle.com> - PR 6646 - * symbols.c (_stp_validate_addr): Add validating address in runtime. - -2008-06-13 Wenji Huang <wenji.huang@oracle.com> - - * control.c (_stp_ctl_write_dbug): Remove STP_UNWIND support. - -2008-06-03 Frank Ch. Eigler <fche@elastic.org> - - PR 6429 - * symbols.c (_stp_init_modules): Don't ask stapio for unwind data. - * control.c (_stp_ctl_write_cmd): Remove STP_UNWIND support. - * transport_msgs.h (STP_UNWIND): Remove declaration. - -2008-04-30 Masami Hiramatsu <mhiramat@redhat.com> - - PR 5645 - * transport.c (_stp_transport_init): Fix subbuffer size calculation - overflow. - -2008-04-21 hunt <hunt@redhat.com> - - * control.c (_stp_ctl_write): Return len + sizeof(int) so - sending an empty command doesn't return 0 and look like a failure. - * transport.c: _stp_cleanup_and_exit(): Cleanup. - -2008-04-15 Frank Ch. Eigler <fche@elastic.org> - - PR 6410 - * symbols.c (_stp_do_unwind_data): Tolerate !STP_USE_DWARF_UNWINDER. - -2008-04-15 Frank Ch. Eigler <fche@elastic.org> - - PR 6405 - * symbols.c (_stp_load_module_symbols): Support older kernels - without module->sect_attrs->nsections. - -2008-04-09 Martin Hunt <hunt@dragon> - - * symbols.c (_stp_init_kernel_symbols): Print error - messages and exit if symbol lookups fail. - (_stp_init_modules): Lookup modules_op. - -2008-03-31 Martin Hunt <hunt@redhat.com> - - * symbols.c (_stp_init_modules): Use STP_USE_DWARF_UNWINDER. - - * transport.c (_stp_get_root_dir): Remove misleading error message. - -2008-03-30 Martin Hunt <hunt@redhat.com> - - * symbols.c (_stp_init_modules): If using frames, don't - request unwind info. - -2008-03-25 Martin Hunt <hunt@redhat.com> - - * control.c (_stp_ctl_write_dbug): Insert missing break. - - 32-bit systems can't do 64-bit get_user(), so - * symbols.c (_stp_do_unwind_data): Change unwind_len to a u32. - * transport_msgs.h (struct _stp_msg_unwind): Ditto. - -2008-02-27 Martin Hunt <hunt@redhat.com> - - * symbols.c: Use rwlocks. Use new dbug macros. Handle - unwind info if present. - - * transport.c: Include mempool.c. Update dbug and kbug calls - to new macros. - * transport_msgs.h (_stp_command_name): Add - struct containing message names for debugging. - - * control.c, procfs.c: Use new dbug macros. Use - new mempool functions. - -2008-01-28 Martin Hunt <hunt@redhat.com> - - * control.c, procfs.c, symbols.c: Use DEFINE_SPINLOCK - -2008-01-15 Martin Hunt <hunt@redhat.com> - - PR4037 and fixes to better synchronize staprun and stapio. - * transport_msgs.h (struct _stp_symbol32): New. - (struct _stp_symbol64): New. - (struct _stp_msg_symbol_hdr): New. - (struct _stp_msg_module): New. - (STP_READY): Declare. - - * transport.c (_stp_handle_start): Don't set _stp_start_finished. - (_stp_work_queue): Don't use _stp_start_finished. - (_stp_transport_init): Don't call _stp_ask_for_symbols(). - - * symbols.c (_stp_do_symbols): Use _stp_msg_symbol_hdr; - - * control.c (_stp_sym_write_cmd): Allow sending of headers - and data in separate messages. - (_stp_ctl_write_cmd): Add STP_READY message. - - * procfs.c (_stp_sym_write_cmd): Allow sending of headers - and data in separate messages. - (_stp_ctl_write_cmd): Add STP_READY message. - -2008-01-15 Martin Hunt <hunt@redhat.com> - - Support for DEBUG_MEM - * transport.c (_stp_transport): Call stp_mem_debug_done(); - * (*.c): Call stp malloc and free functions. - -2007-11-09 Masami Hiramatsu <mhiramat@redhat.com> - - PR3858 - * transport.c (_stp_transport_init): Reduce relay buffer size to - 64KB*2 if -DRELAY_GUEST is specified. - -2007-11-09 Martin Hunt <hunt@redhat.com> - PR 5281 - * transport.c (_stp_detach, _stp_attach): Call utt_set_overwrite() - instead of setting a flag directly. - * utt.c (utt_set_overwrite): New. Set overwrite mode. - * relayfs.c (utt_set_overwrite): New. Set overwrite mode. - * utt.h: Remove global utt_overwrite_flag. - -2007-11-01 Martin Hunt <hunt@redhat.com> - - * procfs.c, control.c, transport.c: Recognize when stapio - is detached and disable delayed work. Enable when attached. - Cleanup code to destroy workqueue on exit. - -2007-10-12 Martin Hunt <hunt@redhat.com> - - * transport.c (_stp_ask_for_symbols): Don't ask for - transport_info yet. Need to wait until symbols are - received. - (_stp_work_queue): Rename _stp_ready_q to _stp_ctl_ready_q. - * procfs.c: Create a ".symbols" channel and use it for - STP_MODULE and STP_SYMBOLS. Rename "cmd" channel to ".cmd". - * control.c: Ditto. - -2007-09-21 Martin Hunt <hunt@redhat.com> - From Alan Brunelle - * control.c (_stp_ctl_read_cmd): Cast count to an int before printing. - -2007-09-20 Martin Hunt <hunt@redhat.com> - - * transport.h: Increase default buffer size. - * control.c (_stp_ctl_read_cmd): Check buffer size. - -2007-09-10 Martin Hunt <hunt@redhat.com> - - * procfs.c (_stp_register_ctl_channel): Call - _stp_mkdir_proc_module(). - (_stp_unregister_ctl_channel): Call _stp_rmdir_proc_module(). - * transport.c: Include ../procfs.c runtime procfs functions. - -2007-08-17 Martin Hunt <hunt@redhat.com> - PR3857 - From Masami Hiramatsu - * utt.c (utt_subbuf_start_callback): Use overwrite flag. - * control.c (_stp_ctl_open_cmd): Set overwrite_flag off. - (_stp_ctl_close_cmd): Set overwrite flag on. - -2007-08-14 David Smith <dsmith@redhat.com> - - Merge from setuid-branch. Changes also by Martin Hunt - <hunt@redhat.com>. - - * control.c (_stp_ctl_write): Make sure we don't overflow. - (_stp_ctl_open_cmd): Do not allow multiple opens of the control - file. - (_stp_ctl_write_cmd): Once STP_START is received, ignore - everything except STP_EXIT. Create another state variable - "initialized". Don't respond to STP_SYMBOLS or STP_MODULES unless - initialized is 0. Also check that current pid is the same as the - pid that did insmod. - (_stp_register_ctl_channel): Bug fix - sets owner/group after - checking for NULL. - - * procfs.c (_stp_ctl_write): Make sure we don't overflow. - (_stp_ctl_open_cmd): Do not allow multiple opens of the control - file. - (_stp_ctl_write_cmd): Once STP_START is received, ignore - everything except STP_EXIT. Create another state variable - "initialized". Don't respond to STP_SYMBOLS or STP_MODULES unless - initialized is 0. Also check that current pid is the same as the - pid that did insmod. - (_stp_register_ctl_channel): Set ownership of cmd file and percpu - files for bulkmode. - - * relayfs.c (utt_trace_setup): Set ownership of percpu files. - Improved error handling. - (utt_trace_remove): Improved error checking. - - * utt.c (utt_remove_tree): Improved error checking. - (utt_trace_cleanup): Ditto. - (utt_create_buf_file_callback): Set file ownership. - (utt_create_global_buf_file_callback): Set file ownership. - - * transport.h: Delcare _stp_uid, _stp_gid, and _stp_init_pid. - * transport.c (_stp_transport_init): Set _stp_uid, _stp_gid, and - _stp_init_pid. - -2007-07-26 Martin Hunt <hunt@redhat.com> - - Spotted by Ming Chang. - * procfs.c (_stp_register_ctl_channel): Fix iterator when removing - proc entries when an error occurs. - -2007-07-10 Michal Schmidt <mschmidt@redhat.com> - - * symbols.c (_stp_del_module): Split freeing of module memory into - a separate function _stp_free_module(). - (_stp_do_module): Free module memory if _stp_ins_module() fails. - -2007-07-09 Martin Hunt <hunt@redhat.com> - - * symbols.c (_stp_ins_module): Check for overflow of - modules array. - (_stp_do_module): If _stp_ins_module() fails, return an error. - -2007-07-02 Martin Hunt <hunt@redhat.com> - - * symbols.c (_stp_do_symbols): Set "data" pointer for kernel to _etext. - (_stp_sort): New. sort function from the kernel. - (_stp_load_module_symbols): Use _stp_sort(). - -2007-06-21 Martin Hunt <hunt@redhat.com> - - * control.c (_stp_ctl_write_cmd): Add support for STP_BULK. - * transport_msgs.h (enum): Add STP_BULK. - -2007-06-18 Martin Hunt <hunt@redhat.com> - - * control.c (_stp_register_ctl_channel): Fix mode of cmd file. - -2007-05-16 Will Cohen <wcohen@redhat.com> - - * control.c: Explicit type cast for picky compilers. - -2007-05-15 Martin Hunt <hunt@redhat.com> - - * control.c: Change default buffer number and size. - (_stp_ctl_write): Add debug statements. Check size of - message to avoid overwriting buffer. - -2007-04-27 Martin Hunt <hunt@redhat.com> - - * utt.h (struct utt_trace): Remove sequence. - * utt.c (utt_trace_cleanup): Remove free of utt->sequence. - (utt_dropped_open): PR 4415. Use STAPCONF_INODE_PRIVATE to detect - correct inode struct. - (utt_trace_setup): Do not allocate utt->sequence. - -2007-04-02 Martin Hunt <hunt@redhat.com> - - * transport_msgs.h (struct _stp_msg_trans): Deleted. - Transport parameters are now read from procfs. - - * transport.c (_stp_ask_for_symbols): STP_TRANSPORT - message is empty. - - * procfs.c (_stp_ctl_open_cmd): New. Set _stp_ pid. - (_stp_ctl_close_cmd): New. Unset _stp_pid. - (_stp_proc_fops_cmd): Add pointers to above funcs. - (_stp_ctl_read_bufsize): New. - (_stp_register_ctl_channel): Create a proc read entry - "bufsize" containing transport buffer sizes. - -2007-03-28 Martin Hunt <hunt@redhat.com> - - * control.c (_stp_ctl_open_cmd): Set _stp_pid. - (stp_ctl_close_cmd): Clear _stp_pid. - * transport.h: Declare _stp_pid; - -2007-03-26 Frank Ch. Eigler <fche@elastic.org> - - * transport.c: Add #include <linux/namei.h> for lookup_one_len. - -2007-03-26 Martin Hunt <hunt@redhat.com> - - * symbols.c (_stp_do_module): If a module has no symbols, just - return NULL instead of an errorcode. - - * control.c, procfs.c, relayfs.c, transport.c, utt.c, utt.h: - Revert back to using systemtap/modulename instead of systemtap_pid. - -2007-03-21 Martin Hunt <hunt@redhat.com> - - * symbols.c (_stp_del_module): Add a call to _stp_module_relocate - to clear its cache. - -2007-03-20 Frank Ch. Eigler <fche@elastic.org> - - * symbols.c (_stp_do_symbols): Add cautionary blurb for important - setup of _stp_modules[0]->text. - -2007-03-20 Martin Hunt <hunt@redhat.com> - - * symbols.c (_stp_alloc_module): Fix up error - cleanup when malloc fails. - -2007-03-14 Martin Hunt <hunt@redhat.com> - - * transport_msgs.h: ifdef old messages as such. - Add support for new transport. - * relayfs.c: Simplify and add new interface to look - like utt. - * utt.[ch]: New files. Similar to the proposed utt interface. - These setup and teardown relayfs on debugfs. - * control.c: New file. Implements a simple control channel. - A small subset of procfs.c. - * procfs.c: This is now only used for old kernels lacking newer - relayfs. Change STP_RELAYFS to STP_BULKMODE. Use new - messages from transport_msgs.h. Don't support - RELAYFS_CHANNEL_VERSION >= 4. CHanges all control channel functions - to new names. Use pids instead of module names in /proc names. - -2007-03-12 Frank Ch. Eigler <fche@elastic.org> - - * procfs.c (_stp_register_procfs): Use /proc/MODULE rather than - /proc/systemtap/MODULE. - -2007-03-12 Frank Ch. Eigler <fche@redhat.com> - - PR 4179. - Based on patch from Vasily Averin <vvs@sw.ru>: - * procfs.c (_stp_register_procfs): Recover from partial failures. - * transport.c (_stp_transport_open): Ditto. - -2007-01-30 Martin Hunt <hunt@redhat.com> - - * symbols.c: Comment out many debug lines. - -2007-01-29 Martin Hunt <hunt@redhat.com> - - * procfs.c: Count allocated IO memory. - * symbols.c: Use _stp_kmalloc() and _stp_kzalloc(). - * transport.c: Count allocated IO memory. - -2007-01-09 Martin Hunt <hunt@redhat.com> - - * symbols.c (_stp_del_module): Fix so memory allocated - for module 0 (kernel) is freed. - (_stp_free_modules): No need to lock module list. - -2006-12-20 Martin Hunt <hunt@redhat.com> - - * transport.c: Fixes to use the new 2.6.20 workqueue API. - -2006-11-15 Martin Hunt <hunt@redhat.com> - - * procfs.c (_stp_proc_write_cmd): For STP_SYMBOLS, - type field is a long to preserve alignment. - Use STP_ALLOC_FLAGS. - - * symbols.c: Use STP_ALLOC_FLAGS. - -2006-11-09 Martin Hunt <hunt@redhat.com> - - * transport_msgs.h: Change all ints to int32_t. Prefix - all struct names with "_stp". - * transport.c: Use new struct names. - (_stp_handle_start): Send pointer size and endianess. - * procfs.c: Use new struct names. - -2006-11-02 Martin Hunt <hunt@redhat.com> - * symbols.c (_stp_do_module): Fix error message. - -2006-11-02 Martin Hunt <hunt@redhat.com> - - * symbols.c: New file. Get the STP_SYMBOLS and STP_MODULE - messages, allocate memory and store the data. - - * procfs.c (_stp_proc_write_cmd): When STP_SYMBOLS or STP_MODULE - request is received, call the appropriate functions. - - * transport.c (_stp_handle_start): If necessary, ask staprun for - symbols and modules. - (_stp_cleanup_and_exit): Unregister module notifier. - (_stp_transport_close): Unregister module notifier and free module - memory. - * transport_msgs.h (enum): Add STP_MODULE and STP_SYMBOLS. - -2006-09-26 David Smith <dsmith@redhat.com> - - * transport.c: Changed 'stpd' references to 'staprun'. - * transport.txt: Ditto. - -2006-09-26 Martin Hunt <hunt@redhat.com> - - * transport.c (_stp_handle_start): Don't initialize timers here. - (_stp_transport_init): Initialize timers here. - (_stp_cleanup_and_exit): Don't kill timers or free print buffers here. - (_stp_transport_close): kill timers and free print buffers here. - -2006-09-25 Tom Zanussi <zanussi@us.ibm.com> - - * procfs.c (_stp_proc_read): Set buf_info flushing flag. - * transport.c (_stp_cleanup_and_exit): Remove braces. - * transport_msgs.h: Add flushing flag to buf_info. - -2006-09-22 Martin Hunt <hunt@redhat.com> - - * transport.c (_stp_work_queue): Reenable some cleanup - code. - -2006-09-21 Martin Hunt <hunt@redhat.com> - - * transport.c (_stp_transport_init): Call _stp_print_init(). - (_stp_cleanup_and_exit): Call _stp_print_cleanup(). - -2006-09-21 Tom Zanussi <zanussi@us.ibm.com> - - * relayfs.c (_stp_get_relay_root): Call new mutex lock/unlock - wrappers instead. - (_stp_lock_inode): New. - (_stp_unlock_inode): New. - -2006-09-19 Tom Zanussi <zanussi@us.ibm.com> - - * procfs.c (_stp_get_proc_root): Removed. - (_stp_force_dir_creation): Removed. - (_stp_register_procfs): Remove unneeded procfs dentry code. * - relayfs.c (_stp_create_buf_file): Remove code to create relay - files in procfs, add code to create in debugfs. - (_stp_remove_buf_file): Remove code to delete relay files in - procfs, add code to delete from debugfs. - (_stp_create_relay_dir): New. - (_stp_remove_relay_dir): New. - (_stp_get_relay_root): New. - (_stp_relayfs_close): Use new functions. - (_stp_relayfs_open): Consolidate alternative versions and remove - extraneous version. * relayfs.h: Remove extraneous - _stp_relayfs_open prototype. - * transport.c (_stp_transport_open): Remove extraneous call to - _stp_relayfs_open() and remove call to _stp_unregister_procfs() on - failure - since it's called from cmd write, cmd can't be removed; - it's removed in normal shutdown anyway. - -2006-09-18 Martin Hunt <hunt@redhat.com> - - * transport_msgs.h (struct transport_info): Add merge field. - * transport.c (_stp_transport_open): Set merge field. - -2006-06-21 Josh Stone <joshua.i.stone@intel.com> - - PR 2525 - * transport.c (_stp_handle_start): Initialize timer functions. - * transport.c (_stp_cleanup_and_exit): Teardown timer functions. - -2006-06-13 Martin Hunt <hunt@redhat.com> - - * transport.c (_stp_transport_close): Destroy workqueue when - done. - -2006-06-09 Martin Hunt <hunt@redhat.com> - - * transport.c: Using the default workqueue was causing problems - because of the long delays on probe_exit(). Created a new - systemtap work queue and used that instead. - -2006-06-05 Martin Hunt <hunt@redhat.com> - - * procfs.c (_stp_write): Always use spin_lock_irqsave() because - this function can sometimes be called with interrupts enabled. - -2006-04-10 Martin Hunt <hunt@redhat.com> - - * procfs.c (_stp_write): More fixes because buffers - are no longer null-terminated. - -2006-03-20 Martin Hunt <hunt@redhat.com> - - * procfs.c (_stp_write): Combine buffers only for REALTIME_DATA. - -2006-03-16 Tom Zanussi <zanussi@us.ibm.com> - - * procfs.c (_stp_proc_read): Change ifdef for relayfs version. - * relayfs.c: Change ifdefs for relayfs version. - * relayfs.h: Remove relayfs-config.h include. - * transport.c (_stp_handle_buf_info.c): Change ifdef for relayfs - version. - * relayfs-config.h.in: Removed. - -2006-03-15 Tom Zanussi <zanussi@us.ibm.com> - - * procfs.c (_stp_proc_read): Add ifdef for CONFIG_RELAY. - (_stp_get_proc_root): New function. - (_stp_force_dir_create): New function. - (_stp_register_procfs): Add support for CONFIG_RELAY files in - proc. - - * relayfs.c (_stp_subbuf_start): Fix ppc64 compilation error - mentioned in bug #2406. - (_stp_create_buf_file): New function. - (_stp_remove_buf_file): New function. - (_stp_relayfs_close): Add support for CONFIG_RELAY. - (_stp_relayfs_open): Add support for CONFIG_RELAY. - - * relayfs.h: Add support for CONFIG_RELAY and - RELAYFS_VERSION_GE_4. - * transport.c (_stp_handle_buf_info.c): Add support for - CONFIG_RELAY. - * transport (_stp_transport_open.c): Add support for CONFIG_RELAY. - - * relayfs-config.h.in: New file. - -2006-03-15 Martin Hunt <hunt@redhat.com> - - * procfs.c (STP_DEFAULT_BUFFERS): Bump up to 256. - -2006-03-06 Martin Hunt <hunt@redhat.com> - - * transport_msgs.h (struct cmd_info): New message. - -2006-02-25 Martin Hunt <hunt@redhat.com> - - * procfs.c (_stp_proc_write_cmd): Check return code for - _stp_transport_open(). - - * transport.c (_stp_transport_write): This function - can now sleep because it is - (_stp_handle_start): Don't use a mutex when a simple atomic - will do. - (_stp_work_queue): Check atomic to see if probe_start() - has finished before attempting exit. - (_stp_transport_close): PR2391. Cancel work queue. - (_stp_transport_init): If _stp_register_procfs() fails, - return an error code. - - * transport.txt: New file. Documents transport initialization and - shutdown sequence. - -2006-02-24 Martin Hunt <hunt@redhat.com> - - * transport.c (_stp_transport_init): Fail if - _stp_register_procfs() fails. - -2006-02-17 Martin Hunt <hunt@redhat.com> - - * procfs.c (_stp_proc_read_cmd): Change spin_lock() - to spin_lock_irqsave(). - - * transport.c (_stp_work_queue): Ditto. - -2005-12-02 Martin Hunt <hunt@redhat.com> - - * procfs.c (_stp_set_buffers): kmalloc the buffers instead - of vmalloc. - (_stp_register_procfs): Ditto. - (_stp_unregister_procfs): kfree the buffers. - -2005-11-30 Martin Hunt <hunt@redhat.com> - - * transport.h (STP_WORK_TIMER): Declare. - * transport.c (_stp_work_queue): Wake up every STP_WORK_QUEUE - jiffies and check IO and exit status. - (_stp_handle_exit): Deleted. - * procfs.c (_stp_proc_write_cmd): Just set exit flag on STP_EXIT. - (_stp_write): Don't call wake_up_interruptible. - -2005-10-17 Martin Hunt <hunt@redhat.com> - - * transport.c (_stp_handle_start): Grab semaphore before - calling probe_start() and release after it is done. - (_stp_handle_exit): Ditto for exiting. This prevents - exiting before probe_start() is finished. - -2005-10-14 Tom Zanussi <zanussi@us.ibm.com> - - * relayfs.h: Add ifdef'ed relayfs_fs.h include for mainline - relayfs version. If you're running a kernel with a version - of relayfs >= 4 (the version # can be found in - /include/linux/relayfs_fs.h) configured in, adding a - #define RELAYFS_VERSION_GE_4 at the top of transport/relayfs.h - will make systemtap use it instead of the packaged version. - - * relayfs.c: Add ifdef'ed relayfs callback functions for - mainline relayfs version. - (_stp_relayfs_open): Add ifdef'ed code for mainline - relayfs version. - * procfs.c (_stp_proc_read): Ditto. - * transport.c (_handle_buf_info): Ditto. - -2005-10-05 Tom Zanussi <zanussi@us.ibm.com> - - * transport.c (_stp_transport_open): Add kbug message. - * transport.h: Change default n_subbufs to 16. - -2005-09-08 Martin Hunt <hunt@redhat.com> - - * procfs.c (_stp_register_procfs): Change ifdefs to eliminate - unused variable warnings. - (_stp_unregister_procfs): Ditto. - -2005-09-06 Martin Hunt <hunt@redhat.com> - - * transport.c (_stp_handle_start): Always reply to - a start message with STP_START. - -2005-08-24 Martin Hunt <hunt@redhat.com> - - * transport_msgs.h (enum): New type, STP_OOB_DATA. - -2005-08-23 Martin Hunt <hunt@redhat.com> - - * transport.c (_stp_cleanup_and_exit): Remove a 2 second sleep - that should no longer be necessary. - - * procfs.c (_stp_write): If the ready queue is not empty - then attempt to grab the last buffer in it and append our data - to it. - -2005-08-22 Martin Hunt <hunt@redhat.com> - - * transport.h: Don't define _stp_transport_write. - * transport.c (_stp_transport_write): Use - _stp_transport_send() when in probe_exit(). - -2005-08-19 Martin Hunt <hunt@redhat.com> - - * transport.c (_stp_cmd_handler): Remove. This was used by - stp-control. - - * procfs.c (_stp_proc_write_cmd): Call schedule_work() instead - of running _stp_exit_handler immediately. Fixes a problem where - the module couldn't exit if all the output buffers were full. - Set .owner for the filesystem entries. - -2005-08-19 Martin Hunt <hunt@redhat.com> - - * transport.h: Remove netlink references. - * transport.c: Remove netlink references. Ifdef relayfs code. - * procfs.c: New file. - * Makefile: Deleted. - * control.c: Deleted. - * control.h: Deleted. - * netlink.c: Deleted. - * netlink.h: Deleted. - -2005-08-03 Martin Hunt <hunt@redhat.com> - - * transport.c: Comment out a couple printks. - -2005-08-01 Martin Hunt <hunt@redhat.com> - - * control.h: Remove STP commands from here and put in - transport_msgs. - - * transport_msgs.h: New file containing the structs and - values for the messages exchanged between stpd and transport. - - * transport.h: Moved stuff shared with stpd to transport_msgs.h - - * transport.c: Complete rewrite to better handle complicated - initialization involving exchanging data with stpd. Supports - buffer size negotiation and more. - -2005-07-18 Martin Hunt <hunt@redhat.com> - - * transport.h (_stp_transport_write): Call _stp_relay_write(). - - * transport.c (_stp_cleanup_and_exit): Print transport - failure count. - (_stp_relay_write): Like relay_write() except returns - -1 on error. - -2005-07-14 Tom Zanussi <zanussi@us.ibm.com> - - * netlink.c (_stp_netlink_open): Add missing delayed_pkts - initialization. - -2005-07-08 Martin Hunt <hunt@redhat.com> - - * transport.c: Rename pid to _stp_pid. - Rename t to _stp_tport. - (_stp_cleanup_and_exit): New internal function. - (stp_exit_helper): Call _stp_cleanup_and_exit(). - (_stp_transport_cleanup): New function. - (_stp_cmd_handler): Remove handler for STP_TRANSPORT_MODE. - The transport now notifies the daemon of the transport. - (_stp_transport_close): No longer calls _stp_exit_helper(). - That is done by _stp_transport_cleanup(). - (_stp_transport_open): When done, call _stp_handle_transport() - to notify the daemon what our transport is. - (_stp_transport_send): Put a retry limit on sends. - - * transport.h: Rename pid to _stp_pid. - (_stp_transport_cleanup): Add prototype. - -2005-06-23 Martin Hunt <hunt@redhat.com> - - * transport.h: Move all the transport open stuff here - and provide a convenient macro. - - * control.c: Replace macro DEFINE_SPINLOCK because - some kernels don't have it. - -2005-06-20 Tom Zanussi <zanussi@us.ibm.com> - - * control.h: Added STP_TRANSPORT_MODE command. - - * transport.c: Lots of changes, most importantly - added transport mode command, which also sends buffer - sizes to daemon, added limit to number of attempts to - sending STP_EXIT (in case there is no daemon), moved - exit helper call. - - * transport.h: Added transport type enum and transport - info struct for communication with userspace, changed and - moved a couple functions to transport.c. - -2005-05-17 Martin Hunt <hunt@redhat.com> - - * transport.c (_stp_transport_close): Call stp_exit_helper() - directly instead of using work queue. - -2005-05-16 Martin Hunt <hunt@redhat.com> - - * transport.c (_stp_cmd_handler): For STP_EXIT, schedule a - work queue to do the exit functions. - (_stp_transport_close): Call work queue for STP_EXIT. - (_stp_transport_send): Call _stp_ctrl_send() like before, except - when in probe_exit(). In that case, keep retrying on send errors - until we succeed. - - * transport.h (_stp_transport_write): Change to call - _stp_transport_send() for NETLINK_ONLY. - - * Makefile (KDIR): set to /lib/modules/... instead of - /usr/local/src/... - - - diff --git a/runtime/transport/control.c b/runtime/transport/control.c index 7d78cca4..edde244d 100644 --- a/runtime/transport/control.c +++ b/runtime/transport/control.c @@ -1,7 +1,7 @@ /* -*- linux-c -*- * - * debugfs control channel - * Copyright (C) 2007-2008 Red Hat Inc. + * control channel + * Copyright (C) 2007-2009 Red Hat Inc. * * This file is part of systemtap, and is free software. You can * redistribute it and/or modify it under the terms of the GNU General @@ -9,12 +9,9 @@ * later version. */ -#define STP_DEFAULT_BUFFERS 50 -static int _stp_current_buffers = STP_DEFAULT_BUFFERS; - static _stp_mempool_t *_stp_pool_q; static struct list_head _stp_ctl_ready_q; -DEFINE_SPINLOCK(_stp_ctl_ready_lock); +static DEFINE_SPINLOCK(_stp_ctl_ready_lock); static ssize_t _stp_ctl_write_cmd(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { @@ -72,13 +69,6 @@ static ssize_t _stp_ctl_write_cmd(struct file *file, const char __user *buf, siz return count; /* Pretend that we absorbed the entire message. */ } -struct _stp_buffer { - struct list_head list; - int len; - int type; - char buf[STP_CTL_BUFFER_SIZE]; -}; - static DECLARE_WAIT_QUEUE_HEAD(_stp_ctl_wq); #ifdef DEBUG_TRANS @@ -114,11 +104,16 @@ static int _stp_ctl_write(int type, void *data, unsigned len) { struct _stp_buffer *bptr; unsigned long flags; + unsigned hlen; #ifdef DEBUG_TRANS _stp_ctl_write_dbug(type, data, len); #endif + hlen = _stp_ctl_write_fs(type, data, len); + if (hlen > 0) + return hlen; + /* make sure we won't overflow the buffer */ if (unlikely(len > STP_CTL_BUFFER_SIZE)) return 0; @@ -153,7 +148,8 @@ static int _stp_ctl_send(int type, void *data, int len) return err; } -static ssize_t _stp_ctl_read_cmd(struct file *file, char __user *buf, size_t count, loff_t *ppos) +static ssize_t _stp_ctl_read_cmd(struct file *file, char __user *buf, + size_t count, loff_t *ppos) { struct _stp_buffer *bptr; int len; @@ -178,10 +174,12 @@ static ssize_t _stp_ctl_read_cmd(struct file *file, char __user *buf, size_t cou /* write it out */ len = bptr->len + 4; if (len > count || copy_to_user(buf, &bptr->type, len)) { - /* now what? We took it off the queue then failed to send it */ - /* we can't put it back on the queue because it will likely be out-of-order */ - /* fortunately this should never happen */ - /* FIXME need to mark this as a transport failure */ + /* Now what? We took it off the queue then failed to + * send it. We can't put it back on the queue because + * it will likely be out-of-order. Fortunately, this + * should never happen. + * + * FIXME: need to mark this as a transport failure. */ errk("Supplied buffer too small. count:%d len:%d\n", (int)count, len); return -EFAULT; } @@ -215,47 +213,33 @@ static struct file_operations _stp_ctl_fops_cmd = { .release = _stp_ctl_close_cmd, }; -static struct dentry *_stp_cmd_file = NULL; - static int _stp_register_ctl_channel(void) { - int i; - struct list_head *p, *tmp; - char buf[32]; - - if (_stp_utt == NULL) { - errk("_expected _stp_utt to be set.\n"); - return -1; - } - INIT_LIST_HEAD(&_stp_ctl_ready_q); /* allocate buffers */ - _stp_pool_q = _stp_mempool_init(sizeof(struct _stp_buffer), STP_DEFAULT_BUFFERS); + _stp_pool_q = _stp_mempool_init(sizeof(struct _stp_buffer), + STP_DEFAULT_BUFFERS); if (unlikely(_stp_pool_q == NULL)) goto err0; _stp_allocated_net_memory += sizeof(struct _stp_buffer) * STP_DEFAULT_BUFFERS; - /* create [debugfs]/systemtap/module_name/.cmd */ - _stp_cmd_file = debugfs_create_file(".cmd", 0600, _stp_utt->dir, NULL, &_stp_ctl_fops_cmd); - if (_stp_cmd_file == NULL) + if (_stp_register_ctl_channel_fs() != 0) goto err0; - _stp_cmd_file->d_inode->i_uid = _stp_uid; - _stp_cmd_file->d_inode->i_gid = _stp_gid; return 0; err0: _stp_mempool_destroy(_stp_pool_q); - errk("Error creating systemtap debugfs entries.\n"); + errk("Error creating systemtap control channel.\n"); return -1; } static void _stp_unregister_ctl_channel(void) { struct list_head *p, *tmp; - if (_stp_cmd_file) - debugfs_remove(_stp_cmd_file); + + _stp_unregister_ctl_channel_fs(); /* Return memory to pool and free it. */ list_for_each_safe(p, tmp, &_stp_ctl_ready_q) { diff --git a/runtime/transport/control.h b/runtime/transport/control.h new file mode 100644 index 00000000..5e7204ee --- /dev/null +++ b/runtime/transport/control.h @@ -0,0 +1,42 @@ +/* -*- linux-c -*- + * + * control channel header + * Copyright (C) 2009 Red Hat Inc. + * + * This file is part of systemtap, and is free software. You can + * redistribute it and/or modify it under the terms of the GNU General + * Public License (GPL); either version 2, or (at your option) any + * later version. + */ + +#ifndef _CONTROL_H_ +#define _CONTROL_H_ + +#include <linux/spinlock.h> +#include <linux/list.h> + +static _stp_mempool_t *_stp_pool_q; +static struct list_head _stp_ctl_ready_q; +static spinlock_t _stp_ctl_ready_lock; +static wait_queue_head_t _stp_ctl_wq; + +struct _stp_buffer { + struct list_head list; + int len; + int type; + char buf[STP_CTL_BUFFER_SIZE]; +}; + +static struct file_operations _stp_ctl_fops_cmd; + +static int _stp_ctl_send(int type, void *data, int len); + +static int _stp_ctl_write_fs(int type, void *data, unsigned len); + +static int _stp_register_ctl_channel(void); +static void _stp_unregister_ctl_channel(void); + +static int _stp_register_ctl_channel_fs(void); +static void _stp_unregister_ctl_channel_fs(void); + +#endif /* _CONTROL_H_ */ diff --git a/runtime/transport/debugfs.c b/runtime/transport/debugfs.c new file mode 100644 index 00000000..dc651a56 --- /dev/null +++ b/runtime/transport/debugfs.c @@ -0,0 +1,45 @@ +/* -*- linux-c -*- + * + * debugfs functions + * Copyright (C) 2009 Red Hat Inc. + * + * This file is part of systemtap, and is free software. You can + * redistribute it and/or modify it under the terms of the GNU General + * Public License (GPL); either version 2, or (at your option) any + * later version. + */ + +#define STP_DEFAULT_BUFFERS 50 + +inline static int _stp_ctl_write_fs(int type, void *data, unsigned len) +{ + return 0; +} + +static struct dentry *_stp_cmd_file = NULL; + +static int _stp_register_ctl_channel_fs(void) +{ + if (_stp_utt == NULL) { + errk("_expected _stp_utt to be set.\n"); + return -1; + } + + /* create [debugfs]/systemtap/module_name/.cmd */ + _stp_cmd_file = debugfs_create_file(".cmd", 0600, _stp_utt->dir, + NULL, &_stp_ctl_fops_cmd); + if (_stp_cmd_file == NULL) { + errk("Error creating systemtap debugfs entries.\n"); + return -1; + } + _stp_cmd_file->d_inode->i_uid = _stp_uid; + _stp_cmd_file->d_inode->i_gid = _stp_gid; + + return 0; +} + +static void _stp_unregister_ctl_channel_fs(void) +{ + if (_stp_cmd_file) + debugfs_remove(_stp_cmd_file); +} diff --git a/runtime/transport/procfs.c b/runtime/transport/procfs.c index ca33e0fd..6afbdea1 100644 --- a/runtime/transport/procfs.c +++ b/runtime/transport/procfs.c @@ -1,7 +1,7 @@ /* -*- linux-c -*- * * /proc transport and control - * Copyright (C) 2005-2008 Red Hat Inc. + * Copyright (C) 2005-2009 Red Hat Inc. * * This file is part of systemtap, and is free software. You can * redistribute it and/or modify it under the terms of the GNU General @@ -9,12 +9,9 @@ * later version. */ -#define STP_DEFAULT_BUFFERS 256 -static int _stp_current_buffers = STP_DEFAULT_BUFFERS; +#include "../procfs.c" // for _stp_mkdir_proc_module() -static _stp_mempool_t *_stp_pool_q; -static struct list_head _stp_ctl_ready_q; -DEFINE_SPINLOCK(_stp_ctl_ready_lock); +#define STP_DEFAULT_BUFFERS 256 #ifdef STP_BULKMODE extern int _stp_relay_flushing; @@ -60,112 +57,19 @@ static struct file_operations _stp_proc_fops = { }; #endif /* STP_BULKMODE */ - -static ssize_t _stp_ctl_write_cmd(struct file *file, const char __user *buf, size_t count, loff_t *ppos) -{ - int type; - static int started = 0; - - if (count < sizeof(int)) - return 0; - - if (get_user(type, (int __user *)buf)) - return -EFAULT; - -#if DEBUG_TRANSPORT > 0 - if (type < STP_MAX_CMD) - _dbug("Got %s. len=%d\n", _stp_command_name[type], (int)count); -#endif - - count -= sizeof(int); - buf += sizeof(int); - - switch (type) { - case STP_START: - if (started == 0) { - struct _stp_msg_start st; - if (count < sizeof(st)) - return 0; - if (copy_from_user(&st, buf, sizeof(st))) - return -EFAULT; - _stp_handle_start(&st); - started = 1; - } - break; - - case STP_EXIT: - _stp_exit_flag = 1; - break; - - case STP_RELOCATION: - _stp_do_relocation (buf, count); - break; - - case STP_READY: - break; - - default: - errk("invalid command type %d\n", type); - return -EINVAL; - } - - return count; -} - -struct _stp_buffer { - struct list_head list; - int len; - int type; - char buf[STP_CTL_BUFFER_SIZE]; -}; - -static DECLARE_WAIT_QUEUE_HEAD(_stp_ctl_wq); - -#if DEBUG_TRANSPORT > 0 -static void _stp_ctl_write_dbug(int type, void *data, int len) -{ - char buf[64]; - switch (type) { - case STP_START: - _dbug("sending STP_START\n"); - break; - case STP_EXIT: - _dbug("sending STP_EXIT\n"); - break; - case STP_OOB_DATA: - snprintf(buf, sizeof(buf), "%s", (char *)data); - _dbug("sending %d bytes of STP_OOB_DATA: %s\n", len, buf); - break; - case STP_SYSTEM: - snprintf(buf, sizeof(buf), "%s", (char *)data); - _dbug("sending STP_SYSTEM: %s\n", buf); - break; - case STP_TRANSPORT: - _dbug("sending STP_TRANSPORT\n"); - break; - default: - _dbug("ERROR: unknown message type: %d\n", type); - break; - } -} -#endif - -static int _stp_ctl_write(int type, void *data, int len) +inline static int _stp_ctl_write_fs(int type, void *data, unsigned len) { struct _stp_buffer *bptr; unsigned long flags; -#if DEBUG_TRANSPORT > 0 - _stp_ctl_write_dbug(type, data, len); -#endif - #define WRITE_AGG #ifdef WRITE_AGG - spin_lock_irqsave(&_stp_ctl_ready_lock, flags); if (!list_empty(&_stp_ctl_ready_q)) { bptr = (struct _stp_buffer *)_stp_ctl_ready_q.prev; - if (bptr->len + len <= STP_BUFFER_SIZE && type == STP_REALTIME_DATA && bptr->type == STP_REALTIME_DATA) { + if ((bptr->len + len) <= STP_CTL_BUFFER_SIZE + && type == STP_REALTIME_DATA + && bptr->type == STP_REALTIME_DATA) { memcpy(bptr->buf + bptr->len, data, len); bptr->len += len; spin_unlock_irqrestore(&_stp_ctl_ready_lock, flags); @@ -174,121 +78,9 @@ static int _stp_ctl_write(int type, void *data, int len) } spin_unlock_irqrestore(&_stp_ctl_ready_lock, flags); #endif - - /* make sure we won't overflow the buffer */ - if (unlikely(len > STP_BUFFER_SIZE)) - return 0; - - /* get a buffer from the free pool */ - bptr = _stp_mempool_alloc(_stp_pool_q); - if (unlikely(bptr == NULL)) - return -1; - - bptr->type = type; - memcpy(bptr->buf, data, len); - bptr->len = len; - - /* put it on the pool of ready buffers */ - spin_lock_irqsave(&_stp_ctl_ready_lock, flags); - list_add_tail(&bptr->list, &_stp_ctl_ready_q); - spin_unlock_irqrestore(&_stp_ctl_ready_lock, flags); - - return len; -} - - -/* send commands with timeout and retry */ -static int _stp_ctl_send(int type, void *data, int len) -{ - int err, trylimit = 50; - dbug_trans(1, "ctl_send: type=%d len=%d\n", type, len); - while ((err = _stp_ctl_write(type, data, len)) < 0 && trylimit--) - msleep(5); - if (err > 0) - wake_up_interruptible(&_stp_ctl_wq); - dbug_trans(1, "returning %d\n", err); - return err; -} - - -static ssize_t _stp_ctl_read_cmd(struct file *file, char __user *buf, size_t count, loff_t *ppos) -{ - struct _stp_buffer *bptr; - int len; - unsigned long flags; - - /* wait for nonempty ready queue */ - spin_lock_irqsave(&_stp_ctl_ready_lock, flags); - while (list_empty(&_stp_ctl_ready_q)) { - spin_unlock_irqrestore(&_stp_ctl_ready_lock, flags); - if (file->f_flags & O_NONBLOCK) - return -EAGAIN; - if (wait_event_interruptible(_stp_ctl_wq, !list_empty(&_stp_ctl_ready_q))) - return -ERESTARTSYS; - spin_lock_irqsave(&_stp_ctl_ready_lock, flags); - } - - /* get the next buffer off the ready list */ - bptr = (struct _stp_buffer *)_stp_ctl_ready_q.next; - list_del_init(&bptr->list); - spin_unlock_irqrestore(&_stp_ctl_ready_lock, flags); - - /* write it out */ - len = bptr->len + 4; - if (len > count || copy_to_user(buf, &bptr->type, len)) { - /* now what? We took it off the queue then failed to send it */ - /* we can't put it back on the queue because it will likely be out-of-order */ - /* fortunately this should never happen */ - /* FIXME need to mark this as a transport failure */ - errk("Supplied buffer too small. count:%d len:%d\n", (int)count, len); - return -EFAULT; - } - - /* put it on the pool of free buffers */ - _stp_mempool_free(bptr); - - return len; -} - -static int _stp_ctl_open_cmd(struct inode *inode, struct file *file) -{ - if (_stp_attached) - return -1; - - _stp_attach(); return 0; } -static int _stp_ctl_close_cmd(struct inode *inode, struct file *file) -{ - if (_stp_attached) - _stp_detach(); - return 0; -} - -static struct file_operations _stp_proc_fops_cmd = { - .owner = THIS_MODULE, - .read = _stp_ctl_read_cmd, - .write = _stp_ctl_write_cmd, - .open = _stp_ctl_open_cmd, - .release = _stp_ctl_close_cmd, -}; - -/* copy since proc_match is not MODULE_EXPORT'd */ -static int my_proc_match(int len, const char *name, struct proc_dir_entry *de) -{ - if (de->namelen != len) - return 0; - return !memcmp(name, de->name, len); -} - -/* set the number of buffers to use to 'num' */ -static int _stp_set_buffers(int num) -{ - dbug_trans(1, "stp_set_buffers %d\n", num); - return _stp_mempool_resize(_stp_pool_q, num); -} - static int _stp_ctl_read_bufsize(char *page, char **start, off_t off, int count, int *eof, void *data) { int len = sprintf(page, "%d,%d\n", _stp_nsubbufs, _stp_subbuf_size); @@ -303,25 +95,15 @@ static int _stp_ctl_read_bufsize(char *page, char **start, off_t off, int count, return len; } -static int _stp_register_ctl_channel(void) +static int _stp_register_ctl_channel_fs(void) { - int i; - const char *dirname = "systemtap"; - char buf[32]; #ifdef STP_BULKMODE + int i; int j; + char buf[32]; + struct proc_dir_entry *bs = NULL; #endif - - struct proc_dir_entry *de, *bs = NULL; - struct list_head *p, *tmp; - - INIT_LIST_HEAD(&_stp_ctl_ready_q); - - /* allocate buffers */ - _stp_pool_q = _stp_mempool_init(sizeof(struct _stp_buffer), STP_DEFAULT_BUFFERS); - if (unlikely(_stp_pool_q == NULL)) - goto err0; - _stp_allocated_net_memory += sizeof(struct _stp_buffer) * STP_DEFAULT_BUFFERS; + struct proc_dir_entry *de; if (!_stp_mkdir_proc_module()) goto err0; @@ -352,11 +134,10 @@ static int _stp_register_ctl_channel(void) goto err1; de->uid = _stp_uid; de->gid = _stp_gid; - de->proc_fops = &_stp_proc_fops_cmd; + de->proc_fops = &_stp_ctl_fops_cmd; return 0; -err2: - remove_proc_entry(".cmd", _stp_proc_root); + err1: #ifdef STP_BULKMODE for (de = _stp_proc_root->subdir; de; de = de->next) @@ -373,18 +154,16 @@ err1: #endif /* STP_BULKMODE */ _stp_rmdir_proc_module(); err0: - _stp_mempool_destroy(_stp_pool_q); - errk("Error creating systemtap /proc entries.\n"); return -1; } -static void _stp_unregister_ctl_channel(void) +static void _stp_unregister_ctl_channel_fs(void) { - struct list_head *p, *tmp; - char buf[32]; #ifdef STP_BULKMODE + char buf[32]; int i; struct proc_dir_entry *de; + dbug_trans(1, "unregistering procfs\n"); for (de = _stp_proc_root->subdir; de; de = de->next) _stp_kfree(de->data); @@ -396,14 +175,6 @@ static void _stp_unregister_ctl_channel(void) remove_proc_entry("bufsize", _stp_proc_root); #endif /* STP_BULKMODE */ - remove_proc_entry(".symbols", _stp_proc_root); remove_proc_entry(".cmd", _stp_proc_root); _stp_rmdir_proc_module(); - - /* Return memory to pool and free it. */ - list_for_each_safe(p, tmp, &_stp_ctl_ready_q) { - list_del(p); - _stp_mempool_free(p); - } - _stp_mempool_destroy(_stp_pool_q); } diff --git a/runtime/transport/relayfs.c b/runtime/transport/relayfs.c index 6c516d66..6eefda8d 100644 --- a/runtime/transport/relayfs.c +++ b/runtime/transport/relayfs.c @@ -68,16 +68,16 @@ static void _stp_remove_relay_dir(struct dentry *dir) static void _stp_remove_relay_root(struct dentry *root) { if (root) { - if (!_stp_lock_debugfs()) { + if (!_stp_lock_transport_dir()) { errk("Unable to lock transport directory.\n"); return; } _stp_remove_relay_dir(root); - _stp_unlock_debugfs(); + _stp_unlock_transport_dir(); } } -struct utt_trace *utt_trace_setup(struct utt_trace_setup *utts) +static struct utt_trace *utt_trace_setup(struct utt_trace_setup *utts) { struct utt_trace *utt; int i; @@ -122,13 +122,13 @@ err: return NULL; } -void utt_set_overwrite(int overwrite) +static void utt_set_overwrite(int overwrite) { if (_stp_utt) _stp_utt->rchan->overwrite = overwrite; } -int utt_trace_startstop(struct utt_trace *utt, int start, +static int utt_trace_startstop(struct utt_trace *utt, int start, unsigned int *trace_seq) { int ret; @@ -163,7 +163,7 @@ int utt_trace_startstop(struct utt_trace *utt, int start, } -int utt_trace_remove(struct utt_trace *utt) +static int utt_trace_remove(struct utt_trace *utt) { dbug_trans(1, "removing relayfs files. %d\n", utt->trace_state); if (utt && (utt->trace_state == Utt_trace_setup || utt->trace_state == Utt_trace_stopped)) { diff --git a/runtime/transport/relayfs.h b/runtime/transport/relayfs.h index c47f4b98..c33e9b08 100644 --- a/runtime/transport/relayfs.h +++ b/runtime/transport/relayfs.h @@ -16,11 +16,11 @@ # include <linux/namei.h> -struct rchan *_stp_relayfs_open(unsigned n_subbufs, +static struct rchan *_stp_relayfs_open(unsigned n_subbufs, unsigned subbuf_size, int pid, struct dentry **outdir); -void _stp_relayfs_close(struct rchan *chan, struct dentry *dir); +static void _stp_relayfs_close(struct rchan *chan, struct dentry *dir); #endif /* _TRANSPORT_RELAYFS_H_ */ diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c index 72f9ad80..a329effe 100644 --- a/runtime/transport/symbols.c +++ b/runtime/transport/symbols.c @@ -1,26 +1,18 @@ /* -*- linux-c -*- * symbols.c - stp symbol and module functions * - * Copyright (C) Red Hat Inc, 2006-2008 + * Copyright (C) Red Hat Inc, 2006-2009 * * This file is part of systemtap, and is free software. You can * redistribute it and/or modify it under the terms of the GNU General * Public License (GPL); either version 2, or (at your option) any * later version. - * - * The u32_swap(), generic_swap(), and sort() functions were adapted from - * lib/sort.c of kernel 2.6.22-rc5. It was written by Matt Mackall. */ #ifndef _STP_SYMBOLS_C_ #define _STP_SYMBOLS_C_ #include "../sym.h" - - -static void _stp_create_unwind_hdr(struct _stp_module *m); - - static void _stp_do_relocation(const char __user *buf, size_t count) { struct _stp_msg_relocation msg; @@ -68,89 +60,4 @@ static void _stp_do_relocation(const char __user *buf, size_t count) } /* loop over modules */ } - -static void u32_swap(void *a, void *b, int size) -{ - u32 t = *(u32 *)a; - *(u32 *)a = *(u32 *)b; - *(u32 *)b = t; -} - -static void generic_swap(void *a, void *b, int size) -{ - char *aa = a; - char *bb = b; - do { - char t = *aa; - *aa++ = *bb; - *bb++ = t; - } while (--size > 0); -} - -/** - * sort - sort an array of elements - * @base: pointer to data to sort - * @num: number of elements - * @size: size of each element - * @cmp_func: pointer to comparison function - * @swap_func: pointer to swap function or NULL - * - * This function does a heapsort on the given array. You may provide a - * swap function optimized to your element type. - * - * Sorting time is O(n log n) both on average and worst-case. While - * qsort is about 20% faster on average, it suffers from exploitable - * O(n*n) worst-case behavior and extra memory requirements that make - * it less suitable for kernel use. -*/ -void _stp_sort(void *_base, size_t num, size_t size, - int (*cmp_func) (const void *, const void *), void (*swap_func) (void *, void *, int size)) -{ - char *base = (char*) _base; - /* pre-scale counters for performance */ - int i = (num / 2 - 1) * size, n = num * size, c, r; - - if (!swap_func) - swap_func = (size == 4 ? u32_swap : generic_swap); - - /* heapify */ - for (; i >= 0; i -= size) { - for (r = i; r * 2 + size < n; r = c) { - c = r * 2 + size; - if (c < n - size && cmp_func(base + c, base + c + size) < 0) - c += size; - if (cmp_func(base + r, base + c) >= 0) - break; - swap_func(base + r, base + c, size); - } - } - - /* sort */ - for (i = n - size; i >= 0; i -= size) { - swap_func(base, base + i, size); - for (r = 0; r * 2 + size < i; r = c) { - c = r * 2 + size; - if (c < i - size && cmp_func(base + c, base + c + size) < 0) - c += size; - if (cmp_func(base + r, base + c) >= 0) - break; - swap_func(base + r, base + c, size); - } - } -} - -/* filter out section names we don't care about */ -static int _stp_section_is_interesting(const char *name) -{ - int ret = 1; - if (!strncmp("__", name, 2) - || (!strncmp(".note", name, 5) - && strncmp(".note.gnu.build-id", name, 18)) - || !strncmp(".gnu", name, 4) - || !strncmp(".mod", name, 4)) - ret = 0; - return ret; -} - - #endif /* _STP_SYMBOLS_C_ */ diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c index f5ee2c36..0755781e 100644 --- a/runtime/transport/transport.c +++ b/runtime/transport/transport.c @@ -20,21 +20,22 @@ #include "time.c" #include "../mempool.c" #include "symbols.c" -#include "../procfs.c" static struct utt_trace *_stp_utt = NULL; static unsigned int utt_seq = 1; static int _stp_probes_started = 0; -pid_t _stp_target = 0; +static pid_t _stp_target = 0; static int _stp_exit_called = 0; -int _stp_exit_flag = 0; +static int _stp_exit_flag = 0; +#include "control.h" #ifdef STP_OLD_TRANSPORT #include "relayfs.c" #include "procfs.c" #else #include "utt.c" -#include "control.c" +#include "debugfs.c" #endif +#include "control.c" /* module parameters */ static int _stp_bufsize; @@ -42,9 +43,9 @@ module_param(_stp_bufsize, int, 0); MODULE_PARM_DESC(_stp_bufsize, "buffer size"); /* forward declarations */ -void probe_exit(void); -int probe_start(void); -void _stp_exit(void); +static void probe_exit(void); +static int probe_start(void); +static void _stp_exit(void); /* check for new workqueue API */ #ifdef DECLARE_DELAYED_WORK @@ -61,9 +62,18 @@ static struct workqueue_struct *_stp_wq; * _stp_handle_start - handle STP_START */ -void _stp_handle_start(struct _stp_msg_start *st) +static void _stp_handle_start(struct _stp_msg_start *st) { dbug_trans(1, "stp_handle_start\n"); + +#ifdef STAPCONF_VM_AREA + { /* PR9740: workaround for kernel valloc bug. */ + void *dummy; + dummy = alloc_vm_area (PAGE_SIZE); + free_vm_area (dummy); + } +#endif + _stp_target = st->target; st->res = probe_start(); if (st->res >= 0) @@ -170,7 +180,7 @@ static void _stp_work_queue(void *data) * This is called automatically when the module is unloaded. * */ -void _stp_transport_close() +static void _stp_transport_close() { dbug_trans(1, "%d: ************** transport_close *************\n", current->pid); _stp_cleanup_and_exit(0); @@ -205,10 +215,8 @@ static struct utt_trace *_stp_utt_open(void) * _stp_transport_init() is called from the module initialization. * It does the bare minimum to exchange commands with staprun */ -int _stp_transport_init(void) +static int _stp_transport_init(void) { - int ret; - dbug_trans(1, "transport_init\n"); _stp_init_pid = current->pid; #ifdef STAPCONF_TASK_UID @@ -247,7 +255,7 @@ int _stp_transport_init(void) goto err0; #endif - /* create debugfs/procfs control channel */ + /* create control channel */ if (_stp_register_ctl_channel() < 0) goto err1; @@ -302,7 +310,7 @@ static inline void _stp_unlock_inode(struct inode *inode) static struct dentry *_stp_lockfile = NULL; -static int _stp_lock_debugfs(void) +static int _stp_lock_transport_dir(void) { int numtries = 0; #ifdef STP_OLD_TRANSPORT @@ -317,7 +325,7 @@ static int _stp_lock_debugfs(void) return 1; } -static void _stp_unlock_debugfs(void) +static void _stp_unlock_transport_dir(void) { if (_stp_lockfile) { #ifdef STP_OLD_TRANSPORT @@ -350,7 +358,7 @@ static struct dentry *_stp_get_root_dir(const char *name) return NULL; } - if (!_stp_lock_debugfs()) { + if (!_stp_lock_transport_dir()) { errk("Couldn't lock transport directory.\n"); return NULL; } @@ -372,7 +380,7 @@ static struct dentry *_stp_get_root_dir(const char *name) errk("Could not create or find transport directory.\n"); } } - _stp_unlock_debugfs(); + _stp_unlock_transport_dir(); return root; } diff --git a/runtime/transport/transport.h b/runtime/transport/transport.h index 421a65c2..7d249c45 100644 --- a/runtime/transport/transport.h +++ b/runtime/transport/transport.h @@ -26,20 +26,24 @@ static unsigned _stp_nsubbufs = 8; static unsigned _stp_subbuf_size = 65536*4; -void _stp_warn (const char *fmt, ...); -extern void _stp_transport_close(void); -extern int _stp_print_init(void); -extern void _stp_print_cleanup(void); +static int _stp_transport_init(void); +static void _stp_transport_close(void); + +static void _stp_warn (const char *fmt, ...); +static int _stp_print_init(void); +static void _stp_print_cleanup(void); static struct dentry *_stp_get_root_dir(const char *name); -static int _stp_lock_debugfs(void); -static void _stp_unlock_debugfs(void); + +static int _stp_lock_transport_dir(void); +static void _stp_unlock_transport_dir(void); + static void _stp_attach(void); static void _stp_detach(void); -void _stp_handle_start(struct _stp_msg_start *st); +static void _stp_handle_start(struct _stp_msg_start *st); -int _stp_pid = 0; -uid_t _stp_uid = 0; -gid_t _stp_gid = 0; -pid_t _stp_init_pid = 0; -int _stp_attached = 0; +static int _stp_pid = 0; +static uid_t _stp_uid = 0; +static gid_t _stp_gid = 0; +static pid_t _stp_init_pid = 0; +static int _stp_attached = 0; #endif /* _TRANSPORT_TRANSPORT_H_ */ diff --git a/runtime/transport/utt.c b/runtime/transport/utt.c index 21d2ab8a..915662b2 100644 --- a/runtime/transport/utt.c +++ b/runtime/transport/utt.c @@ -37,7 +37,7 @@ static int utt_overwrite_flag = 0; * * Most of this function is deadcopy of relay_switch_subbuf. */ -size_t utt_switch_subbuf(struct utt_trace *utt, struct rchan_buf *buf, +static size_t utt_switch_subbuf(struct utt_trace *utt, struct rchan_buf *buf, size_t length) { char *old, *new; @@ -122,7 +122,7 @@ static void __utt_timer_init(struct utt_trace * utt) add_timer(&utt->timer); } -void utt_set_overwrite(int overwrite) +static void utt_set_overwrite(int overwrite) { utt_overwrite_flag = overwrite; } @@ -130,13 +130,13 @@ void utt_set_overwrite(int overwrite) static void utt_remove_root(struct utt_trace *utt) { if (utt->utt_tree_root) { - if (!_stp_lock_debugfs()) { + if (!_stp_lock_transport_dir()) { errk("Unable to lock transport directory.\n"); return; } if (simple_empty(utt->utt_tree_root)) debugfs_remove(utt->utt_tree_root); - _stp_unlock_debugfs(); + _stp_unlock_transport_dir(); utt->utt_tree_root = NULL; } } @@ -170,7 +170,7 @@ err: } -void utt_trace_cleanup(struct utt_trace *utt) +static void utt_trace_cleanup(struct utt_trace *utt) { if (utt == NULL) return; @@ -182,7 +182,7 @@ void utt_trace_cleanup(struct utt_trace *utt) _stp_kfree(utt); } -int utt_trace_remove(struct utt_trace *utt) +static int utt_trace_remove(struct utt_trace *utt) { if (utt->trace_state == Utt_trace_setup || utt->trace_state == Utt_trace_stopped) @@ -288,7 +288,7 @@ static struct rchan_callbacks utt_relay_callbacks_global = { /* * Setup everything required to start tracing */ -struct utt_trace *utt_trace_setup(struct utt_trace_setup *utts) +static struct utt_trace *utt_trace_setup(struct utt_trace_setup *utts) { struct utt_trace *utt = NULL; struct dentry *dir = NULL; @@ -373,7 +373,7 @@ err: return NULL; } -int utt_trace_startstop(struct utt_trace *utt, int start, +static int utt_trace_startstop(struct utt_trace *utt, int start, unsigned int *trace_seq) { int ret; diff --git a/runtime/transport/utt.h b/runtime/transport/utt.h index df225b3c..40e54919 100644 --- a/runtime/transport/utt.h +++ b/runtime/transport/utt.h @@ -40,14 +40,14 @@ struct utt_trace_setup { }; -extern struct utt_trace *utt_trace_setup(struct utt_trace_setup *utts); -extern int utt_trace_startstop(struct utt_trace *utt, int start, +static struct utt_trace *utt_trace_setup(struct utt_trace_setup *utts); +static int utt_trace_startstop(struct utt_trace *utt, int start, unsigned int *trace_seq); -extern void utt_trace_cleanup(struct utt_trace *utt); -extern int utt_trace_remove(struct utt_trace *utt); +static void utt_trace_cleanup(struct utt_trace *utt); +static int utt_trace_remove(struct utt_trace *utt); #ifndef STP_OLD_TRANSPORT -extern size_t utt_switch_subbuf(struct utt_trace *utt, struct rchan_buf *buf, +static size_t utt_switch_subbuf(struct utt_trace *utt, struct rchan_buf *buf, size_t length); /** * utt_reserve - reserve slot in channel buffer diff --git a/runtime/unwind.c b/runtime/unwind.c index bc8a93dc..9c704e28 100644 --- a/runtime/unwind.c +++ b/runtime/unwind.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * kernel stack unwinding - * Copyright (C) 2008 Red Hat Inc. + * Copyright (C) 2008-2009 Red Hat Inc. * * Based on old kernel code that is * Copyright (C) 2002-2006 Novell, Inc. @@ -42,129 +42,6 @@ static void swap_eh_frame_hdr_table_entries(void *p1, void *p2, int size) e2->fde = v; } -/* Build a binary-searchable unwind header. Also do some - * validity checks. In the future we might use */ -/* .eh_frame_hdr if it is already present. */ -static void _stp_create_unwind_hdr(struct _stp_module *m) -{ - const u8 *ptr; - unsigned long tableSize, hdrSize, last; - unsigned n = 0; - const u32 *fde; - int bad_order = 0; - struct { - u8 version; - u8 eh_frame_ptr_enc; - u8 fde_count_enc; - u8 table_enc; - unsigned long eh_frame_ptr; - unsigned int fde_count; - struct eh_frame_hdr_table_entry table[]; - } __attribute__ ((__packed__)) * header = NULL; - - /* already did this or no data? */ - if (m->unwind_hdr || m->unwind_data_len == 0) - return; - - tableSize = m->unwind_data_len; - if (tableSize & (sizeof(*fde) - 1)) { - dbug_unwind(1, "tableSize=0x%x not a multiple of 0x%x\n", (int)tableSize, (int)sizeof(*fde)); - goto bad; - } - - /* count the FDEs */ - for (fde = m->unwind_data; - tableSize > sizeof(*fde) && tableSize - sizeof(*fde) >= *fde; - tableSize -= sizeof(*fde) + *fde, fde += 1 + *fde / sizeof(*fde)) { - signed ptrType; - const u32 *cie; - - /* check for extended length */ - if ((*fde & 0xfffffff0) == 0xfffffff0) { - dbug_unwind(1, "Module %s has extended-length CIE or FDE."); - dbug_unwind(1, "This is not supported at this time."); - goto bad; - } - cie = cie_for_fde(fde, m); - if (cie == ¬_fde) - continue; /* fde was a CIE. That's OK, just skip it. */ - if (cie == NULL || cie == &bad_cie || (ptrType = fde_pointer_type(cie)) < 0) - goto bad; - /* we have a real FDE */ - ptr = (const u8 *)(fde + 2); - if (!read_pointer(&ptr, (const u8 *)(fde + 1) + *fde, ptrType)) - goto bad; - ++n; - } - - if (tableSize || !n) { - dbug_unwind(1, "%s: tableSize=%ld, n=%d\n", m->name, tableSize, n); - goto bad; - } - - hdrSize = 4 + sizeof(unsigned long) + sizeof(unsigned int) + 2 * n * sizeof(unsigned long); - header = _stp_kmalloc(hdrSize); - if (header == NULL) { - header = _stp_vmalloc(hdrSize); - if (header == NULL) - return; - } - - header->version = 1; - header->eh_frame_ptr_enc = DW_EH_PE_absptr; - header->fde_count_enc = DW_EH_PE_data4; - header->table_enc = DW_EH_PE_absptr; - _stp_put_unaligned((unsigned long)m->unwind_data, &header->eh_frame_ptr); - - BUILD_BUG_ON(offsetof(typeof(*header), fde_count) - % __alignof(typeof(header->fde_count))); - header->fde_count = n; - - BUILD_BUG_ON(offsetof(typeof(*header), table) % __alignof(typeof(*header->table))); - - n = 0; - last = 0; - tableSize = m->unwind_data_len; - for (fde = m->unwind_data; tableSize; tableSize -= sizeof(*fde) + *fde, fde += 1 + *fde / sizeof(*fde)) { - const u32 *cie = cie_for_fde(fde, m); - if (cie == ¬_fde) - continue; - if (cie == NULL || cie == &bad_cie) - goto bad; - /* we have a real FDE */ - ptr = (const u8 *)(fde + 2); - header->table[n].start = read_pointer(&ptr, (const u8 *)(fde + 1) + *fde, fde_pointer_type(cie)); - header->table[n].fde = (unsigned long)fde; - if (header->table[n].start < last) - bad_order++; - last = header->table[n].start; - ++n; - } - WARN_ON(n != header->fde_count); - - /* Is sort ever necessary? */ - if (bad_order) - _stp_sort(header->table, n, sizeof(*header->table), cmp_eh_frame_hdr_table_entries, - swap_eh_frame_hdr_table_entries); - - m->unwind_hdr_len = hdrSize; - m->unwind_hdr = header; - return; - - /* unwind data is not acceptable. free it and return */ -bad: - dbug_unwind(1, "unwind data for %s is unacceptable. Freeing.", m->name); - if (header) { - _stp_vfree(header); - } - if (m->unwind_data) { - _stp_vfree(m->unwind_data); - m->unwind_data = NULL; - m->unwind_data_len = 0; - } - return; -} - static uleb128_t get_uleb128(const u8 **pcur, const u8 *end) { const u8 *cur = *pcur; @@ -655,7 +532,7 @@ static const char *_stp_enc_lo_name[] = { "DW_EH_PE_sdata4", "DW_EH_PE_sdata8" }; -char *_stp_eh_enc_name(signed type) +static char *_stp_eh_enc_name(signed type) { static char buf[64]; int hi, low; @@ -685,7 +562,7 @@ char *_stp_eh_enc_name(signed type) /* Unwind to previous to frame. Returns 0 if successful, negative * number in case of an error. A positive return means unwinding is finished; * don't try to fallback to dumping addresses on the stack. */ -int unwind(struct unwind_frame_info *frame) +static int unwind(struct unwind_frame_info *frame) { #define FRAME_REG(r, t) (((t *)frame)[reg_info[r].offs]) const u32 *fde, *cie = NULL; diff --git a/runtime/vsprintf.c b/runtime/vsprintf.c index 2c3067cf..bd58d760 100644 --- a/runtime/vsprintf.c +++ b/runtime/vsprintf.c @@ -131,7 +131,7 @@ static int check_binary_precision (int precision) { return precision; } -int _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) +static int _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) { int len; uint64_t num; |