aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-11-04tracefs: Fix refcount imbalance in start_creating()Daniel Borkmann1-1/+5
In tracefs' start_creating(), we pin the file system to safely access its root. When we failed to create a file, we unpin the file system via failed_creating() to release the mount count and eventually the reference of the singleton vfsmount. However, when we run into an error during lookup_one_len() when still in start_creating(), we only release the parent's mutex but not so the reference on the mount. F.e., in securityfs_create_file(), after doing simple_pin_fs() when lookup_one_len() fails there, we infact do simple_release_fs(). This seems necessary here as well. Same issue seen in debugfs due to 190afd81e4a5 ("debugfs: split the beginning and the end of __create_file() off"), which seemed to got carried over into tracefs, too. Noticed during code review. Link: http://lkml.kernel.org/r/68efa86101b778cf7517ed7c6ad573bd69f60ec6.1446672850.git.daniel@iogearbox.net Fixes: 4282d60689d4 ("tracefs: Add new tracefs file system") Cc: [email protected] # 4.1+ Signed-off-by: Daniel Borkmann <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-03tracing: Put back comma for empty fields in boot string parsingSteven Rostedt (Red Hat)2-11/+10
Both early_enable_events() and apply_trace_boot_options() parse a boot string that may get parsed later on. They both use strsep() which converts a comma into a nul character. To still allow the boot string to be parsed again the same way, the nul character gets converted back to a comma after the token is processed. The problem is that these two functions check for an empty parameter (two commas in a row ",,"), and continue the loop if the parameter is empty, but fails to place the comma back. In this case, the second parsing will end at this blank field, and not process fields afterward. In most cases, users should not have an empty field, but if its going to be checked, the code might as well be correct. Signed-off-by: Steven Rostedt <[email protected]>
2015-11-03tracing: Apply tracer specific options from kernel command line.Jiaxing Wang1-9/+36
Currently, the trace_options parameter is only applied in tracer_alloc_buffers() when global_trace.current_trace is nop_trace, so a tracer specific option will not be applied even when the specific tracer is also enabled from kernel command line. For example, the 'func_stack_trace' option can't be enabled with the following kernel parameter: ftrace=function ftrace_filter=kfree trace_options=func_stack_trace We can enable tracer specific options by simply apply the options again if the specific tracer is also supplied from command line and started in register_tracer(). To make trace_boot_options_buf can be parsed again, a comma and a space is put back if they were replaced by strsep and strstrip respectively. Also make register_tracer() be __init to access the __init data, and in fact register_tracer is only called from __init code. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Jiaxing Wang <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-03tracing: Add some documentation about set_event_pidSteven Rostedt (Red Hat)2-0/+24
Update Documentation to include some comments about how to use set_event_pid. Signed-off-by: Steven Rostedt <[email protected]>
2015-11-03ring_buffer: Remove unneeded smp_wmb() before wakeup of reader benchmarkSteven Rostedt (Red Hat)1-2/+0
wake_up_process() has a memory barrier before doing anything, thus adding a memory barrier before calling it is redundant. Signed-off-by: Steven Rostedt <[email protected]>
2015-11-03tracing: Allow dumping traces without tracking trace started cpusSasha Levin1-2/+3
We don't init iter->started when dumping the ftrace buffer, and there's no real need to do so - so allow skipping that check if the iter doesn't have an initialized ->started cpumask. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-03ring_buffer: Fix more races when terminating the producer in the benchmarkPetr Mladek1-25/+29
The commit b44754d8262d3aab8 ("ring_buffer: Allow to exit the ring buffer benchmark immediately") added a hack into ring_buffer_producer() that set @kill_test when kthread_should_stop() returned true. It improved the situation a lot. It stopped the kthread in most cases because the producer spent most of the time in the patched while cycle. But there are still few possible races when kthread_should_stop() is set outside of the cycle. Then we do not set @kill_test and some other checks pass. This patch adds a better fix. It renames @test_kill/TEST_KILL() into a better descriptive @test_error/TEST_ERROR(). Also it introduces break_test() function that checks for both @test_error and kthread_should_stop(). The new function is used in the producer when the check for @test_error is not enough. It is not used in the consumer because its state is manipulated by the producer via the "reader_finish" variable. Also we add a missing check into ring_buffer_producer_thread() between setting TASK_INTERRUPTIBLE and calling schedule_timeout(). Otherwise, we might miss a wakeup from kthread_stop(). Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Petr Mladek <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-03ring_buffer: Do no not complete benchmark reader too earlyPetr Mladek1-9/+16
It seems that complete(&read_done) might be called too early in some situations. 1st scenario: ------------- CPU0 CPU1 ring_buffer_producer_thread() wake_up_process(consumer); wait_for_completion(&read_start); ring_buffer_consumer_thread() complete(&read_start); ring_buffer_producer() # producing data in # the do-while cycle ring_buffer_consumer(); # reading data # got error # set kill_test = 1; set_current_state( TASK_INTERRUPTIBLE); if (reader_finish) # false schedule(); # producer still in the middle of # do-while cycle if (consumer && !(cnt % wakeup_interval)) wake_up_process(consumer); # spurious wakeup while (!reader_finish && !kill_test) # leaving because # kill_test == 1 reader_finish = 0; complete(&read_done); 1st BANG: We might access uninitialized "read_done" if this is the the first round. # producer finally leaving # the do-while cycle because kill_test == 1; if (consumer) { reader_finish = 1; wake_up_process(consumer); wait_for_completion(&read_done); 2nd BANG: This will never complete because consumer already did the completion. 2nd scenario: ------------- CPU0 CPU1 ring_buffer_producer_thread() wake_up_process(consumer); wait_for_completion(&read_start); ring_buffer_consumer_thread() complete(&read_start); ring_buffer_producer() # CPU3 removes the module <--- difference from # and stops producer <--- the 1st scenario if (kthread_should_stop()) kill_test = 1; ring_buffer_consumer(); while (!reader_finish && !kill_test) # kill_test == 1 => we never go # into the top level while() reader_finish = 0; complete(&read_done); # producer still in the middle of # do-while cycle if (consumer && !(cnt % wakeup_interval)) wake_up_process(consumer); # spurious wakeup while (!reader_finish && !kill_test) # leaving because kill_test == 1 reader_finish = 0; complete(&read_done); BANG: We are in the same "bang" situations as in the 1st scenario. Root of the problem: -------------------- ring_buffer_consumer() must complete "read_done" only when "reader_finish" variable is set. It must not be skipped due to other conditions. Note that we still must keep the check for "reader_finish" in a loop because there might be spurious wakeups as described in the above scenarios. Solution: ---------- The top level cycle in ring_buffer_consumer() will finish only when "reader_finish" is set. The data will be read in "while-do" cycle so that they are not read after an error (kill_test == 1) or a spurious wake up. In addition, "reader_finish" is manipulated by the producer thread. Therefore we add READ_ONCE() to make sure that the fresh value is read in each cycle. Also we add the corresponding barrier to synchronize the sleep check. Next we set the state back to TASK_RUNNING for the situation where we did not sleep. Just from paranoid reasons, we initialize both completions statically. This is safer, in case there are other races that we are unaware of. As a side effect we could remove the memory barrier from ring_buffer_producer_thread(). IMHO, this was the reason for the barrier. ring_buffer_reset() uses spin locks that should provide the needed memory barrier for using the buffer. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Petr Mladek <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-03tracing: Remove redundant TP_ARGS redefiningDmitry Safonov1-3/+0
TP_ARGS is not used anywhere in trace.h nor trace_entries.h Firstly, I left just #undef TP_ARGS and had no errors - remove it. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Dmitry Safonov <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-03tracing: Rename max_stack_lock to stack_trace_max_lockSteven Rostedt (Red Hat)2-9/+9
Now that max_stack_lock is a global variable, it requires a naming convention that is unlikely to collide. Rename it to the same naming convention that the other stack_trace variables have. Signed-off-by: Steven Rostedt <[email protected]>
2015-11-03tracing: Allow arch-specific stack tracerAKASHI Takahiro2-37/+54
A stack frame may be used in a different way depending on cpu architecture. Thus it is not always appropriate to slurp the stack contents, as current check_stack() does, in order to calcurate a stack index (height) at a given function call. At least not on arm64. In addition, there is a possibility that we will mistakenly detect a stale stack frame which has not been overwritten. This patch makes check_stack() a weak function so as to later implement arch-specific version. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: AKASHI Takahiro <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-03recordmcount: arm64: Replace the ignored mcount call into nopLi Bin1-1/+23
By now, the recordmcount only records the function that in following sections: .text/.ref.text/.sched.text/.spinlock.text/.irqentry.text/ .kprobes.text/.text.unlikely For the function that not in these sections, the call mcount will be in place and not be replaced when kernel boot up. And it will bring performance overhead, such as do_mem_abort (in .exception.text section). This patch make the call mcount to nop for this case in recordmcount. Link: http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/r/[email protected] Cc: <[email protected]> Cc: <[email protected]> Cc: <[email protected]> Cc: <[email protected]> # 3.18+ Acked-by: Will Deacon <[email protected]> Signed-off-by: Li Bin <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-03recordmcount: Fix endianness handling bug for nop_mcountlibin1-1/+1
In nop_mcount, shdr->sh_offset and welp->r_offset should handle endianness properly, otherwise it will trigger Segmentation fault if the recordmcount main and file.o have different endianness. Link: http://lkml.kernel.org/r/[email protected] Cc: <[email protected]> # 3.0+ Signed-off-by: Li Bin <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-02tracepoints: Fix documentation of RCU lockdep checksMathieu Desnoyers1-4/+5
The documentation on top of __DECLARE_TRACE() does not match its implementation since the condition check has been added to the RCU lockdep checks. Update the documentation to match its implementation. Link: http://lkml.kernel.org/r/[email protected] CC: Dave Hansen <[email protected]> Fixes: a05d59a56733 "tracing: Add condition check to RCU lockdep checks" Signed-off-by: Mathieu Desnoyers <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-02tracing: ftrace_event_is_function() can return booleanYaowei Bai2-2/+2
Make ftrace_event_is_function() return bool to improve readability due to this particular function only using either one or zero as its return value. No functional change. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Yaowei Bai <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-02tracing: is_legal_op() can return booleanYaowei Bai1-4/+4
Make is_legal_op() return bool to improve readability due to this particular function only using either one or zero as its return value. No functional change. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Yaowei Bai <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-02ring-buffer: rb_event_is_commit() can return booleanYaowei Bai1-2/+2
Make rb_event_is_commit() return bool to improve readability due to this particular function only using either one or zero as its return value. No functional change. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Yaowei Bai <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-02ring-buffer: rb_per_cpu_empty() can return booleanYaowei Bai1-2/+2
Makes rb_per_cpu_empty() return bool to improve readability. No functional change. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Yaowei Bai <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-02ring_buffer: ring_buffer_empty{cpu}() can return booleanYaowei Bai2-7/+7
Make ring_buffer_empty() and ring_buffer_empty_cpu() return bool. No functional change. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Yaowei Bai <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-02ring-buffer: rb_is_reader_page() can return booleanYaowei Bai1-1/+1
Make rb_is_reader_page() return bool to improve readability due to this particular function only using either true or false as its return value. No functional change. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Yaowei Bai <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-02tracing: report_latency() in trace_irqsoff.c can return booleanYaowei Bai1-4/+4
This patch makes report_latency return bool due to this particular function only using either one or zero as its return value. No functional change. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Yaowei Bai <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-02tracing: report_latency() in trace_sched_wakeup.c can return booleanYaowei Bai1-4/+4
This patch makes report_latency return bool to improve readability, indicating whether this new latency should be reported/recorded. No functional change. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Yaowei Bai <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-02Sample: Trace_event: Correct the commentsChunyan Zhang1-3/+3
The commit 889204278ccf ("tracing: Update trace-event-sample with TRACE_SYSTEM_VAR documentation") changed TRACE_SYSTEM to 'sample-trace', but didn't make the according change of its name in the comments. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Chunyan Zhang <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-02tracing: Update instance_rmdir() to use tracefs_remove_recursiveJiaxing Wang1-1/+1
Update instancd_rmdir to use tracefs_remove_recursive instead of debugfs_remove_recursive.This was left in the transition from debugfs to tracefs. Link: http://lkml.kernel.org/r/[email protected] Cc: [email protected] # 4.1+ Fixes: 8434dc9340cd2 ("tracing: Convert the tracing facility over to use tracefs") Signed-off-by: Jiaxing Wang <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-02tracing: Only benchmark the time tracepoints take if tracing is onChunyan Zhang1-1/+1
There's no need to record the time tracepoints take when tracing is off. This is because: 1) We cannot see these records since ring_buffer record is off at that moment. 2) If tracing is off and benchmark tracepoint is enabled, the time tracepoint takes is fewer than the same situation when tracing is on, since the tracepoints need to be wrote into ring_buffer, it would take more time. If turn on tracing at this moment, the average and standard deviation cannot exactly present the time that tracepoints take to write data into ring_buffer. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Chunyan Zhang <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-02recordmcount: x86: Assign a meaningful value to rel_type_nopLi Bin1-0/+2
Although, the default value of rel_type_nop is zero, and the value of R_386_NONE/R_X86_64_NONE is zero too, but it should be assigned a meaningful value explicitly, otherwise it looks confused. Assign R_386_NONE to rel_type_nop for 386, assign R_X86_64_NONE to rel_type_nop for x86_64. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Li Bin <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-11-02tracing: Call on_each_cpu() when adding or removing single pids from ↵Steven Rostedt (Red Hat)1-6/+7
set_event_pid For the case where pids are already in set_event_pid, and one is added or removed then each CPU should be checked to make sure that the new or old pid is on or not on a CPU. For example: # echo 123 >> set_event_pid or # echo '!123' >> set_event_pid Link: http://lkml.kernel.org/r/20151030061643.GA19480@cac Suggested-by: Jiaxing Wang <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-10-26tracing: Fix sparse RCU warningSteven Rostedt (Red Hat)1-0/+2
p_start() and p_stop() are seq_file functions that match. Teach sparse to know that rcu_read_lock_sched() that is taken by p_start() is released by p_stop. Reported-by: kbuild test robot <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-10-25tracing: Check all tasks on each CPU when filtering pidsSteven Rostedt (Red Hat)1-0/+22
My tests found that if a task is running but not filtered when set_event_pid is modified, then it can still be traced. Call on_each_cpu() to check if the current running task should be filtered and update the per cpu flags of tr->data appropriately. Signed-off-by: Steven Rostedt <[email protected]>
2015-10-25tracing: Implement event pid filteringSteven Rostedt (Red Hat)3-3/+154
Add the necessary hooks to use the pids loaded in set_event_pid to filter all the events enabled in the tracing instance that match the pids listed. Two probes are added to both sched_switch and sched_wakeup tracepoints to be called before other probes are called and after the other probes are called. The first is used to set the necessary flags to let the probes know to test if they should be traced or not. The sched_switch pre probe will set the "ignore_pid" flag if neither the previous or next task has a matching pid. The sched_switch probe will set the "ignore_pid" flag if the next task does not match the matching pid. The pre probe allows for probes tracing sched_switch to be traced if necessary. The sched_wakeup pre probe will set the "ignore_pid" flag if neither the current task nor the wakee task has a matching pid. The sched_wakeup post probe will set the "ignore_pid" flag if the current task does not have a matching pid. Cc: "Paul E. McKenney" <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-10-25tracing: Add set_event_pid directory for future useSteven Rostedt (Red Hat)2-0/+294
Create a tracing directory called set_event_pid, which currently has no function, but will be used to filter all events for the tracing instance or the pids that are added to the file. The reason no functionality is added with this commit is that this commit focuses on the creation and removal of the pids in a safe manner. And tests can be made against this change to make sure things are correct before hooking features to the list of pids. Cc: "Paul E. McKenney" <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-10-25tracepoint: Give priority to probes of tracepointsSteven Rostedt (Red Hat)2-11/+63
In order to guarantee that a probe will be called before other probes that are attached to a tracepoint, there needs to be a mechanism to provide priority of one probe over the others. Adding a prio field to the struct tracepoint_func, which lets the probes be sorted by the priority set in the structure. If no priority is specified, then a priority of 10 is given (this is a macro, and perhaps may be changed in the future). Now probes may be added to affect other probes that are attached to a tracepoint with a guaranteed order. One use case would be to allow tracing of tracepoints be able to filter by pid. A special (higher priority probe) may be added to the sched_switch tracepoint and set the necessary flags of the other tracepoints to notify them if they should be traced or not. In case a tracepoint is enabled at the sched_switch tracepoint too, the order of the two are not random. Cc: Mathieu Desnoyers <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-10-22ftrace: Calculate the correct dyn_ftrace number to report to the userspaceMinfei Huang1-0/+4
Now, ftrace only calculate the dyn_ftrace number in the adding breakpoint loop, not in adding update and finish update loop. Calculate the correct dyn_ftrace, once ftrace reports the failure message to the userspace. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Minfei Huang <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-10-21tracing: Remove {start,stop}_branch_traceDmitry Safonov1-13/+2
Both start_branch_trace() and stop_branch_trace() are used in only one location, and are both static. As they are small functions there is no need to keep them separated out. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Dmitry Safonov <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-10-20tracing: gpio: Add Kconfig option for enabling/disabling trace eventsTal Shorer2-0/+11
Add a new options to trace Kconfig, CONFIG_TRACING_EVENTS_GPIO, that is used for enabling/disabling compilation of gpio function trace events. Link: http://lkml.kernel.org/r/[email protected] Acked-by: Linus Walleij <[email protected]> Signed-off-by: Tal Shorer <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-10-20tracing: Allow disabling compilation of specific trace systemsTal Shorer2-4/+15
Allow a trace events header file to disable compilation of its trace events by defining the preprocessor macro NOTRACE. This could be done, for example, according to a Kconfig option. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Tal Shorer <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-10-20Documentation: ftrace: Module globbing usageDmitry Safonov1-0/+17
Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Dmitry Safonov <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-10-20ftrace: add module globbingDmitry Safonov1-15/+36
Extend module command for function filter selection with globbing. It uses the same globbing as function filter. sh# echo '*alloc*:mod:*' > set_ftrace_filter Will trace any function with the letters 'alloc' in the name in any module but not in kernel. sh# echo '!*alloc*:mod:ipv6' >> set_ftrace_filter Will prevent from tracing functions with 'alloc' in the name from module ipv6 (do not forget to append to set_ftrace_filter file). sh# echo '*alloc*:mod:!ipv6' > set_ftrace_filter Will trace functions with 'alloc' in the name from kernel and any module except ipv6. sh# echo '*alloc*:mod:!*' > set_ftrace_filter Will trace any function with the letters 'alloc' in the name only from kernel, but not from any module. sh# echo '*:mod:!*' > set_ftrace_filter or sh# echo ':mod:!' > set_ftrace_filter Will trace every function in the kernel, but will not trace functions from any module. sh# echo '*:mod:*' > set_ftrace_filter or sh# echo ':mod:' > set_ftrace_filter As the opposite will trace all functions from all modules, but not from kernel. sh# echo '*:mod:*snd*' > set_ftrace_filter Will trace your sound drivers only (if any). Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Dmitry Safonov <[email protected]> [ Made format changes ] Signed-off-by: Steven Rostedt <[email protected]>
2015-10-20ftrace: Introduce ftrace_glob structureDmitry Safonov1-38/+46
ftrace_match parameters are very related and I reduce the number of local variables & parameters with it. This is also preparation for module globbing as it would introduce more realated variables & parameters. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Dmitry Safonov <[email protected]> [ Made some formatting changes ] Signed-off-by: Steven Rostedt <[email protected]>
2015-10-16ftrace: Clarify code for mod commandDmitry Safonov1-27/+10
"Not" is too abstract variable name - changed to clear_filter. Removed ftrace_match_module_records function: comparison with !* or * not does the general code in filter_parse_regex() as it works without mod command for sh# echo '!*' > /sys/kernel/debug/tracing/set_ftrace_filter Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Dmitry Safonov <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-10-13ftrace: Remove redundant strsep in mod_callbackDmitry Safonov1-10/+5
By now there isn't any subcommand for mod. Before: sh$ echo '*:mod:ipv6:a' > set_ftrace_filter sh$ echo '*:mod:ipv6' > set_ftrace_filter had the same results, but now first will result in: sh$ echo '*:mod:ipv6:a' > set_ftrace_filter -bash: echo: write error: Invalid argument Also, I clarified ftrace_mod_callback code a little. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Dmitry Safonov <[email protected]> [ converted 'if (ret == 0)' to 'if (!ret)' ] Signed-off-by: Steven Rostedt <[email protected]>
2015-10-01ftrace: Remove redundant swap functionRasmus Villemoes1-12/+1
To cover the common case of sorting an array of pointers, Daniel Wagner recently modified the library sort() to use a specific swap function for size==8, in addition to the size==4 case which was already handled. Since sizeof(long) is either 4 or 8, ftrace_swap_ips() is redundant and we can just let sort() pick an appropriate and fast swap callback. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Rasmus Villemoes <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-10-01tracing: Use kstrdup_const instead of private implementationRasmus Villemoes1-16/+8
The kernel now has kstrdup_const/kfree_const for reusing .rodata (typically string literals) when possible; there's no reason to duplicate that logic in the tracing system. Moreover, as the comment above core_kernel_data states, it may not always return true for .rodata - that is for example the case on x86_64, where we thus end up kstrdup'ing all the passed-in strings. Arguably, testing for .rodata explicitly (as kstrdup_const does) is also more correct: I don't think one is supposed to be able to change the name after creating the event_subsystem by passing the address of a static char (but non-const) array. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Rasmus Villemoes <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-09-30tracing: Add trace options for tracer options to instancesSteven Rostedt (Red Hat)2-22/+67
Add the tracer options to instances options directory as well. Only add the options for tracers that are allowed to be enabled by an instance. But note, that tracer options are global. That is, tracer options enabled in an instance, also take affect at the top level and in other instances. Signed-off-by: Steven Rostedt <[email protected]>
2015-09-30tracing: Add trace options for core options to instancesSteven Rostedt (Red Hat)1-5/+14
Allow instances to have their own options, at least for the core options (non tracer specific ones). There are a few global options that should not be added to instances, like enabling of trace_printk, and the sched comm recording, which do not have a specific trace instance associated to them. Signed-off-by: Steven Rostedt <[email protected]>
2015-09-30tracing: Make ftrace_trace_stack() depend on general trace_array flagSteven Rostedt (Red Hat)2-13/+16
In preparation for the multi buffer instances to have their own trace_flags, the check in ftrace_trace_stack() needs to test the trace_array descriptor flag that is for the current event, not the global_trace descriptor. Signed-off-by: Steven Rostedt <[email protected]>
2015-09-30tracing: Add a method to pass in trace_array descriptor to option filesSteven Rostedt (Red Hat)2-7/+63
In preparation of having the multi buffer instances having their own trace option flags, the trace option files needs a way to not only pass in the flag they represent, but also the trace_array descriptor. A new field is added to the trace_array descriptor called trace_flags_index, which is a 32 byte character array representing a bit. This array is simply filled with the index of the array, where index_array[n] = n; Then the address of this array is passed to the file callbacks instead of the index of the flag index. Then to retrieve both the flag index and the trace_array descriptor: data is the passed in argument. index = *(unsigned char *)data; data -= index; /* Now data points to the address of the array in the trace_array */ tr = container_of(data, struct trace_array, trace_flags_index); Suggested-by: Johannes Berg <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
2015-09-30tracing: Move trace_flags from global to a trace_array fieldSteven Rostedt (Red Hat)10-101/+135
In preparation to make trace options per instance, the global trace_flags needs to be moved from being a global variable to a field within the trace instance trace_array structure. There's still more work to do, as there's some functions that use trace_flags without passing in a way to get to the current_trace array. For those, the global_trace is used directly (from trace.c). This includes setting and clearing the trace_flags. This means that when a new instance is created, it just gets the trace_flags of the global_trace and will not be able to modify them. Depending on the functions that have access to the trace_array, the flags of an instance may not affect parts of its trace, where the global_trace is used. These will be fixed in future changes. Signed-off-by: Steven Rostedt <[email protected]>
2015-09-30tracing: Move sleep-time and graph-time options out of the core trace_flagsSteven Rostedt (Red Hat)4-10/+35
The sleep-time and graph-time options are only for the function graph tracer and are not used by anything else. As tracer options are now visible when the tracer is not activated, its better to move the function graph specific tracer options into the function graph tracer. Signed-off-by: Steven Rostedt <[email protected]>
2015-09-30tracing: Remove access to trace_flags in trace_printk.cSteven Rostedt (Red Hat)3-5/+14
In the effort to move the global trace_flags to the tracing instances, the direct access to trace_flags must be removed from trace_printk.c Instead, add a new trace_printk_enabled boolean that is set by a new access function trace_printk_control(), that will enable or disable trace_printk. Signed-off-by: Steven Rostedt <[email protected]>