aboutsummaryrefslogtreecommitdiff
path: root/tools/lib/traceevent
AgeCommit message (Collapse)AuthorFilesLines
2015-03-24tools lib traceevent: Free filter tokens in process_filter()Steven Rostedt (Red Hat)1-0/+2
valgrind showed that the filter token wasn't being freed properly in process_filter(). Signed-off-by: Steven Rostedt <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2015-03-24tools lib traceevent: Add way to find sub buffer boundarySteven Rostedt (Red Hat)2-0/+12
For debugging purposes, it may be helpful for the kbuffer library to flag when crossing a sub buffer. Signed-off-by: Steven Rostedt <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2015-03-24tools lib traceevent kbuffer: Remove extra update to data pointer in PADDINGSteven Rostedt (Red Hat)1-1/+0
When a event PADDING is hit (a deleted event that is still in the ring buffer), translate_data() sets the length of the padding and also updates the data pointer which is passed back to the caller. This is unneeded because the caller also updates the data pointer with the passed back length. translate_data() should not update the pointer, only set the length. Signed-off-by: Steven Rostedt <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: [email protected] # 3.12+ Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2015-03-24tools lib traceevent: Make plugin options either string or booleanSteven Rostedt2-7/+59
When a plugin option is defined, by default it is a boolean (true or false). If the option is something else, then it needs to set its "value" field to a default string other than NULL (can be just ""). If the value is not set then the option is considered boolean, and the updating of the option value will be handled accordingly. Signed-off-by: Steven Rostedt <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2015-03-24tools lib traceevent: Add pevent_data_pid_from_comm()Steven Rostedt (Red Hat)2-0/+95
There is a pevent_data_comm_from_pid() that returns the cmdline stored for a given pid in order for users to map pids to comms, but there's no method to convert a comm back to a pid. This is useful for filters that specify a comm instead of a PID (it's faster than searching each individual event). Add a way to retrieve a comm from a pid. Since there can be more than one pid associated to a comm, it returns a data structure that lets the user iterate over all the saved comms for a given pid. Signed-off-by: Steven Rostedt <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2015-03-24tools lib traceevent: Handle %z in bprint formatSteven Rostedt (Red Hat)1-0/+4
The %z printf specifier was not handled making trace_printk()s in the kernel that used this break on output. Reported-by: Shawn Bohrer <[email protected]> Signed-off-by: Steven Rostedt <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Shawn Bohrer <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2015-03-24tools lib traceevent: Copy trace_clock and free itSteven Rostedt (Red Hat)2-3/+9
The pevent->trace_clock should not be a direct pointer to what was given. It should be copied and freed. Note, valgrind pointed this out when a caller passed in a pointer that needed to be freed and it never was. Ideally, pevent should copy it (which this change does), and free the copy. It's up to the caller to free the clock string passed in. Signed-off-by: Steven Rostedt <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2015-03-24tools lib traceevent: Handle NULL comm nameJosef Bacik1-1/+4
It is possible that a pid has no associated comm attached to it, although it can still be passed to pevent_register_comm(). But if comm is NULL, it will cause strdup() to segfault. To prevent this from happening, if comm is NULL use the default "<...>" name for the pid. Signed-off-by: Josef Bacik <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/p/[email protected] Signed-off-by: Steven Rostedt <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2015-03-24tools lib traceevent: Factor out allocating and processing argsJavi Merino1-37/+40
The sequence of allocating the print_arg field, calling process_arg() and verifying that the next event delimiter is repeated twice in process_hex() and will also be used for process_int_array(). Factor it out to a function to avoid writing the same code again and again. Signed-off-by: Javi Merino <[email protected]> Acked-by: Namhyung Kim <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Jiri Olsa <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2015-03-21tools lib traceevent: Add destructor for format_fieldDavid Ahern2-3/+9
Move the calls that frees the resources allocated for a struct format_field to a separate routine. Signed-off-by: David Ahern <[email protected]> Acked-by: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] [ Split this part from a larger patch, added pevent_ prefix as requested by Steven ] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2015-02-12tools lib traceevent: Use tools build frameworkJiri Olsa2-124/+62
Move the libtraceevent library building under tools build framework. Signed-off-by: Jiri Olsa <[email protected]> Tested-by: Sukadev Bhattiprolu <[email protected]> Tested-by: Will Deacon <[email protected]> Cc: Alexis Berlemont <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Corey Ashford <[email protected]> Cc: David Ahern <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2015-02-06tools lib traceevent: Introduce trace_seq_do_fprintf functionArnaldo Carvalho de Melo2-4/+11
So that we can specify a FILE object where to direct the formatted output. Cc: Adrian Hunter <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: David Ahern <[email protected]> Cc: Don Zickus <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2015-01-26tools lib traceevent: Add support for IP address formatsDavid Ahern1-0/+328
Add helpers for the following kernel formats: %pi4 print an IPv4 address with leading zeros %pI4 print an IPv4 address without leading zeros %pi6 print an IPv6 address without colons %pI6 print an IPv6 address with colons %pI6c print an IPv6 address in compressed form with colons %pISpc print an IP address from a sockaddr Allows these formats to be used in tracepoints. Quite a bit of this is adapted from code in lib/vsprintf.c. v4: - fixed pI6c description in git commit message per Valdis' comment v3: - use of 'c' and 'p' requires 'I' v2: - pass ptr+1 to print_ip_arg per Namhyung's comments - added field length checks to sockaddr function Signed-off-by: David Ahern <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-11-24scsi: add SPC-3 command definitionsHannes Reinecke1-1/+4
SPC-3 defines SERVICE ACTION IN(12), SERVICE_ACTION OUT(12), SERVICE ACTION OUT(16), and SERVICE ACTION BIDIRECTIONAL. And READ MEDIA SERIAL NUMBER has long since been deprecated. So update callers to refer to the new cdb name. Signed-off-by: Hannes Reinecke <[email protected]> Tested-by: Robert Elliott <[email protected]> Reviewed-by: Robert Elliott <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
2014-11-24scsi: rename SERVICE_ACTION_IN to SERVICE_ACTION_IN_16Hannes Reinecke1-2/+2
SPC-3 defines SERVICE ACTION IN(12) and SERVICE ACTION IN(16). So rename SERVICE_ACTION_IN to SERVICE_ACTION_IN_16 to be consistent with SPC and to allow for better distinction. Signed-off-by: Hannes Reinecke <[email protected]> Tested-by: Robert Elliott <[email protected]> Reviewed-by: Robert Elliott <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
2014-06-27tools lib traceevent: Fix a risk for doing free on uninitialized pointerRickard Strandqvist1-3/+3
Fix a risk of doing free on an uninitialized pointer. This was found using a static code analysis program called cppcheck. Acked-by: Namhyung Kim <[email protected]> Signed-off-by: Rickard Strandqvist <[email protected]> Link: http://lkml.kernel.org/r/1403608150-13037-1-git-send-email-rickard_strandqvist@spectrumdigital.se Signed-off-by: Jiri Olsa <[email protected]>
2014-06-19tools lib traceevent: Clean up format of args in jbd2 pluginSteven Rostedt1-4/+2
While synchronizing what's in trace-cmd vs what's in perf, I came across a change that was made when entering the jbd2 plugin into the tools/lib/traceevent directory. For example, one of the function prototypes went from: unsigned long long process_jbd2_dev_to_name(struct trace_seq *s, unsigned long long *args) to: static unsigned long long process_jbd2_dev_to_name(struct trace_seq *s, unsigned long long *args) I can understand the line break after the long long, but there's no reason to keep args on a separate line. Signed-off-by: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Jiri Olsa <[email protected]>
2014-06-19tools lib traceevent: Clean up format of args in cfg80211 pluginSteven Rostedt1-2/+1
While synchronizing what's in trace-cmd vs what's in perf, I came across a change that was made when entering the cfg80211 plugin into the tools/lib/traceevent directory. The function prototype went from: static unsigned long long process___le16_to_cpup(struct trace_seq *s, unsigned long long *args) to: static unsigned long long process___le16_to_cpup(struct trace_seq *s, unsigned long long *args) I can understand the line break after the long long, but there's no reason to keep args on a separate line. Signed-off-by: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Jiri Olsa <[email protected]>
2014-06-19tools lib traceevent: Fix format in plugin_kvmSteven Rostedt1-1/+1
The format field argument passed to the format in pevent_print_num_field() will be of type long long. That means that %ll must be used instead of %l. Acked-by: Namhyung Kim <[email protected]> Reported-by: Namhyung Kim <[email protected]> Signed-off-by: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Jiri Olsa <[email protected]>
2014-06-19tools lib traceevent: Fix and cleanup kvm_nested_vmexit tracepointsJan Kiszka1-12/+6
Fix several issues of kvm_nested_vmexit[_inject]: field width aren't supported with pevent_print, rip was printed twice/incorrectly, SVM ISA was hard-coded, we don't use ':' to separate field names. Link: http://lkml.kernel.org/r/8e6c02b22ea8136c139a91c69d6cc73b8c5c184b.1388855989.git.jan.kiszka@web.de Acked-by: Namhyung Kim <[email protected]> Signed-off-by: Jan Kiszka <[email protected]> Signed-off-by: Steven Rostedt <[email protected]> Signed-off-by: Jiri Olsa <[email protected]>
2014-06-19tools lib traceevent: Add back in kvm plugins nested_vmexit eventsSteven Rostedt (Red Hat)1-0/+41
The nested vmexit events were removed from the backport from trace-cmd because they were considered buggy. They have since been updated in trace-cmd but are still missing from the traceevent library. Add back in the buggy version to be able to backport the fixes. Acked-by: Namhyung Kim <[email protected]> Signed-off-by: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Jiri Olsa <[email protected]>
2014-06-19tools lib traceevent: Factor out print_exit_reason in kvm pluginJan Kiszka1-4/+13
We will reuse it for nested vmexit tracepoints. Link: http://lkml.kernel.org/r/619c418c8af87f03027b8c8013b0443996605700.1388855989.git.jan.kiszka@web.de Acked-by: Namhyung Kim <[email protected]> Signed-off-by: Jan Kiszka <[email protected]> Signed-off-by: Steven Rostedt <[email protected]> Signed-off-by: Jiri Olsa <[email protected]>
2014-06-19tools lib traceevent: Report unknown VMX exit reasons with codeJan Kiszka1-4/+8
Allows to parse the result even if the KVM plugin does not yet understand a specific exit code. Link: http://lkml.kernel.org/r/[email protected] Acked-by: Namhyung Kim <[email protected]> Signed-off-by: Jan Kiszka <[email protected]> Signed-off-by: Steven Rostedt <[email protected]> Signed-off-by: Jiri Olsa <[email protected]>
2014-06-07tools lib traceevent: Added support for __get_bitmask() macroSteven Rostedt (Red Hat)2-0/+120
Coming in v3.16, trace events will be able to save bitmasks in raw format in the ring buffer and output it with the __get_bitmask() macro. In order for userspace tools to parse this, it must be able to handle the __get_bitmask() call and be able to convert the data that's in the ring buffer into a nice bitmask format. The output is similar to what the kernel uses to print bitmasks, with a comma separator every 4 bytes (8 characters). This allows for cpumasks to also be saved efficiently. The first user is the thermal:thermal_power_limit event which has the following output: thermal_power_limit: cpus=0000000f freq=1900000 cdev_state=0 power=5252 Link: http://lkml.kernel.org/r/[email protected] Suggested-by: Javi Merino <[email protected]> Signed-off-by: Steven Rostedt <[email protected]> Acked-by: Namhyung Kim <[email protected]> Tested-by: Javi Merino <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Jiri Olsa <[email protected]>
2014-06-07tools lib traceevent: Add options to function pluginSteven Rostedt (Red Hat)1-6/+37
Add the options "parent" and "indent" to the function plugin. When parent is set, the output looks like this: function: fsnotify_modify <-- vfs_write function: zone_statistics <-- get_page_from_freelist function: __inc_zone_state <-- zone_statistics function: inotify_inode_queue_event <-- fsnotify_modify function: fsnotify_parent <-- fsnotify_modify function: __inc_zone_state <-- zone_statistics function: __fsnotify_parent <-- fsnotify_parent function: inotify_dentry_parent_queue_event <-- fsnotify_parent function: add_to_page_cache_lru <-- do_read_cache_page When it's not set, it looks like: function: fsnotify_modify function: zone_statistics function: __inc_zone_state function: inotify_inode_queue_event function: fsnotify_parent function: __inc_zone_state function: __fsnotify_parent function: inotify_dentry_parent_queue_event function: add_to_page_cache_lru When the otpion "indent" is not set, it looks like this: function: fsnotify_modify <-- vfs_write function: zone_statistics <-- get_page_from_freelist function: __inc_zone_state <-- zone_statistics function: inotify_inode_queue_event <-- fsnotify_modify function: fsnotify_parent <-- fsnotify_modify function: __inc_zone_state <-- zone_statistics function: __fsnotify_parent <-- fsnotify_parent function: inotify_dentry_parent_queue_event <-- fsnotify_parent function: add_to_page_cache_lru <-- do_read_cache_page Signed-off-by: Steven Rostedt <[email protected]> Acked-by: Namhyung Kim <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Jiri Olsa <[email protected]>
2014-06-07tools lib traceevent: Add options to pluginsSteven Rostedt2-3/+209
The traceevent plugins allows developers to have their events print out information that is more advanced than what can be achieved by the trace event format files. As these plugins are used on the userspace side of the tracing tools, it is only logical that the tools should be able to produce different types of output for the events. The types of events still need to be defined by the plugins thus we need a way to pass information from the tool to the plugin to specify what type of information to be shown. Not only does the information need to be passed by the tool to plugin, but the plugin also requires a way to notify the tool of what options it can provide. This builds the plugin option infrastructure that is taken from trace-cmd that is used to allow plugins to produce different output based on the options specified by the tool. Signed-off-by: Steven Rostedt <[email protected]> Acked-by: Namhyung Kim <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Jiri Olsa <[email protected]>
2014-06-07tools lib traceevent: Add flag to not load event pluginsSteven Rostedt (Red Hat)2-1/+8
Add a flag to pevent that will let the callers be able to set it and keep the system, and perhaps even normal plugins from being loaded. This is useful when plugins might hide certain information and seeing the raw events shows what may be going on. Signed-off-by: Steven Rostedt <[email protected]> Acked-by: Namhyung Kim <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Jiri Olsa <[email protected]>
2014-04-23tools lib traceevent: Fix memory leak in pretty_print()Steven Rostedt1-0/+1
Commit 12e55569a244 "tools lib traceevent: Use helper trace-seq in print functions like kernel does" added a extra trace_seq helper to process string arguments like the kernel does it. But the difference between the kernel and the userspace library is that the kernel's trace_seq structure has a static allocated buffer. The userspace one has a dynamically allocated one. It requires a trace_seq_destroy(), otherwise it produces a nasty memory leak. Cc: [email protected] # 3.14+ Signed-off-by: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Jiri Olsa <[email protected]>
2014-04-23tools lib traceevent: Fix backward compatibility macros for pevent filter enumsSteven Rostedt1-2/+2
The return value for pevent_filter_match() is suppose to return FILTER_NONE if the event doesn't have a filter, and FILTER_NOEXIST if there is no filter at all. But the change 41e12e580a7 "tools lib traceevent: Refactor pevent_filter_match() to get rid of die()" replaced the return value with PEVENT_ERRNO__* values and added "backward compatibility" macros that used the old names. Unfortunately, the NOEXIST and NONE macros were swapped, and this broke users that use the old return names. Signed-off-by: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Jiri Olsa <[email protected]>
2014-04-14tools lib traceevent: Do not call warning() directlyNamhyung Kim1-2/+4
The patch 3a3ffa2e82205 ("tools lib traceevent: Report better error message on bad function args") added the error message but it seems there's no reason to call warning() directly. So change it to do_warning_event() to provide event information too. Signed-off-by: Namhyung Kim <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Jiri Olsa <[email protected]>
2014-04-14tools lib traceevent: Print event name when show warning if possibleNamhyung Kim1-41/+62
It's sometimes useful to know where the parse failure was occurred. Add do_warning_event() macro to see the failing event. It now shows the messages like below: $ perf test 5 5: parse events tests : Warning: [kvmmmu:kvm_mmu_get_page] bad op token { Warning: [kvmmmu:kvm_mmu_sync_page] bad op token { Warning: [kvmmmu:kvm_mmu_unsync_page] bad op token { Warning: [kvmmmu:kvm_mmu_prepare_zap_page] bad op token { Warning: [kvmmmu:fast_page_fault] function is_writable_pte not defined Warning: [xen:xen_mmu_ptep_modify_prot_commit] function sizeof not defined Warning: [xen:xen_mmu_ptep_modify_prot_start] function sizeof not defined Warning: [xen:xen_mmu_set_pgd] function sizeof not defined Warning: [xen:xen_mmu_set_pud] function sizeof not defined Warning: [xen:xen_mmu_set_pmd] function sizeof not defined ... Signed-off-by: Namhyung Kim <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ramkumar Ramachandra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Jiri Olsa <[email protected]>
2014-01-23perf tools: Fix traceevent plugin path definitionsJosh Boyer1-1/+1
The plugindir_SQ definition contains $(prefix) which is not needed as the $(libdir) definition already contains prefix in it. This leads to the path including an extra prefix in it, e.g. /usr/usr/lib64. The -DPLUGIN_DIR defintion includes DESTDIR. This is incorrect, as it sets the plugin search path to include the value of DESTDIR. DESTDIR is a mechanism to install in a non-standard location such as a chroot or an RPM build root. In the RPM case, this leads to the search path being incorrect after the resulting RPM is installed (or in some cases an RPM build failure). Remove both of these unnecessary inclusions. Signed-off-by: Josh Boyer <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-16tools lib traceevent: Unregister handler when xen plugin is unloadedNamhyung Kim1-0/+6
The function handler should be unregistered when the plugin is unloaded otherwise it'll try to access invalid memory. Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-16tools lib traceevent: Unregister handler when scsi plugin is unloadedNamhyung Kim1-0/+6
The function handler should be unregistered when the plugin is unloaded otherwise it'll try to access invalid memory. Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-16tools lib traceevent: Unregister handler when jbd2 plugin is is unloadedNamhyung Kim1-0/+9
The function handlers should be unregistered when the plugin unloaded otherwise they'll try to access invalid memory. Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-16tools lib traceevent: Unregister handler when cfg80211 plugin is unloadedNamhyung Kim1-0/+6
The function handler should be unregistered when the plugin is unloaded otherwise it'll try to access invalid memory. Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-16tools lib traceevent: Unregister handler when mac80211 plugin is unloadedNamhyung Kim1-0/+7
The event handler should be unregistered when the plugin is unloaded otherwise it'll try to access invalid memory. Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-16tools lib traceevent: Unregister handler when sched_switch plugin is unloadedNamhyung Kim1-0/+12
The event handlers should be unregistered when the plugin is unloaded otherwise they'll try to access invalid memory. Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-16tools lib traceevent: Unregister handler when kvm plugin is unloadedNamhyung Kim1-0/+29
The kvm handlers should be unregistered when the plugin is unloaded otherwise they'll try to access invalid memory. Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-16tools lib traceevent: Unregister handler when kmem plugin is unloadedNamhyung Kim1-0/+22
The kmem handlers should be unregistered when the plugin is unloaded otherwise they'll try to access invalid memory. Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-16tools lib traceevent: Unregister handler when hrtimer plugin is unloadedNamhyung Kim1-0/+10
The timer handlers should be unregistered when the plugin is unloaded otherwise they'll try to access invalid memory. Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-16tools lib traceevent: Unregister handler when function plugin is unloadedNamhyung Kim1-0/+3
The function handler should be unregistered when the plugin is unloaded otherwise it'll try to access invalid memory. Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-16tools lib traceevent: Add pevent_unregister_print_function()Namhyung Kim2-0/+25
When a plugin unloaded it needs to unregister its print handler from pevent. So add an unregister function to do it. Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-16tools lib traceevent: Add pevent_unregister_event_handler()Namhyung Kim2-14/+102
When a plugin is unloaded it needs to unregister its handler from pevent. So add an unregister function to do it. Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-15tools lib traceevent: fix pointer-integer size mismatchMark Rutland2-2/+2
The scsi and cfg80211 plugins cast between unsigned long long and pointers, which is problematic for architectures where unsigned long long is wider than the native pointer size: linux/tools/lib/traceevent/plugin_scsi.c: In function ‘process_scsi_trace_parse_cdb’: linux/tools/lib/traceevent/plugin_scsi.c:408:26: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] scsi_trace_parse_cdb(s, (unsigned char *) args[1], args[2]); linux/tools/lib/traceevent/plugin_cfg80211.c: In function ‘process___le16_to_cpup’: linux/tools/lib/traceevent/plugin_cfg80211.c:11:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] uint16_t *val = (uint16_t *) args[0]; This patch adds an intermediate cast to unsigned long, silencing the warning. Signed-off-by: Mark Rutland <[email protected]> Acked-by: Jiri Olsa <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Will Deacon <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-15tools lib traceevent: Make plugin unload function receive peventNamhyung Kim3-6/+7
The PEVENT_PLUGIN_UNLOADER function might need some cleanup using pevent like unregister some handlers. So pass pevent as argument. Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-15tools lib traceevent: Get rid of die() finally!!Namhyung Kim2-48/+0
Now all of its users were gone. :) Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-15tools lib traceevent: Get rid of malloc_or_die() in trace_seq_init()Namhyung Kim1-2/+5
Use plain malloc() and check its return value. Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-15tools lib traceevent: Check return value of realloc()Namhyung Kim1-4/+9
If realloc() fails, it'll leak the buffer. Also increate buffer size only if the allocation succeeded. Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2014-01-15tools lib traceevent: Add state member to struct trace_seqNamhyung Kim3-14/+50
The trace_seq->state is for tracking errors during the use of trace_seq APIs and getting rid of die() in it. Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>