Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\trace\trace.c Create Date:2022-07-28 12:04:11
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:tracer_alloc_buffers

Proto:__init static int tracer_alloc_buffers(void)

Type:int

Parameter:Nothing

9253  ret = -ENOMEM
9256  If security_locked_down(LOCKDOWN_TRACEFS) Then
9257  pr_warn("Tracing disabled due to lockdown\n")
9258  Return -EPERM
9265  BUILD_BUG_ON - break compile if a condition is true( Make sure we don't go more than we have bits for > TRACE_FLAGS_MAX_SIZE)
9267  If Not alloc_cpumask_var( & tracing_buffer_mask, GFP_KERNEL) Then Go to out
9270  If Not alloc_cpumask_var( & only trace on set CPUs , GFP_KERNEL) Then Go to out_free_buffer_mask
9274  If __stop___trace_bprintk_fmt != __start___trace_bprintk_fmt Then trace_printk_init_buffers()
9279  If On boot up, the ring buffer is set to the minimum size, so that* we do not waste memory on systems that are not using tracing. Then ring_buf_size = trace_buf_size
9281  Else ring_buf_size = 1
9284  pumask_copy - *dstp = *srcp*@dstp: the result*@srcp: the input cpumask
9285  pumask_copy - *dstp = *srcp*@dstp: the result*@srcp: the input cpumask
9287  raw_spin_lock_init( & start_lock)
9295  ret = puhp_setup_state_multi - Add callbacks for multi state*@state: The state for which the calls are installed*@name: Name of the callback
9298  If ret < 0 Then Go to out_free_cpumask
9301  ret = -ENOMEM
9302  temp_buffer = Because the ring buffer is generic, if other users of the ring buffer get* traced by ftrace, it can produce lockdep warnings. We need to keep each* ring buffer's lock class separate.(PAGE_SIZE, RB_FL_OVERWRITE)
9303  If Not temp_buffer Then Go to out_rm_hp_state
9306  If trace_create_savedcmd() < 0 Then Go to out_free_temp_buffer
9310  If allocate_trace_buffers( & The global_trace is the descriptor that holds the top-level tracing* buffers for the live tracing., ring_buf_size) < 0 Then
9311  printk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
9312  WARN_ON(1)
9313  Go to out_free_savedcmd
9316  If buffer_disabled Then racing_off - turn off tracing buffers* This function stops the tracing buffers from recording data.* It does not disable any overhead the tracers themselves may* be causing. This function simply causes all recording to* the ring buffers to fail.
9319  If trace_boot_clock Then
9320  ret = tracing_set_clock( & The global_trace is the descriptor that holds the top-level tracing* buffers for the live tracing., trace_boot_clock)
9321  If ret < 0 Then pr_warn("Trace clock %s not defined, going back to default\n", trace_boot_clock)
9331  current_trace = nop_trace
9333  * max_lock is used to protect the swapping of buffers * when taking a max snapshot. The buffers themselves are * protected by per_cpu spinlocks. But the action of the swap * needs its own lock. * This is defined as a arch_spinlock_t in order to help * with = (arch_spinlock_t)
9335  ftrace_init_global_array_ops( & The global_trace is the descriptor that holds the top-level tracing* buffers for the live tracing.)
9337  init_trace_flags_index( & The global_trace is the descriptor that holds the top-level tracing* buffers for the live tracing.)
9339  gister_tracer - register a tracer with the ftrace system.*@type: the plugin for the tracer* Register a new plugin tracer.
9342  init_function_trace()
9345  Kill all tracing for good (never come back).* It is initialized to 1 but will turn to zero if the initialization* of the tracer is successful. But that is the only place that sets* this back to zero. = 0
9347  atomic_notifier_chain_register - Add notifier to an atomic notifier chain*@nh: Pointer to head of the atomic notifier chain*@n: New entry in notifier chain* Adds a notifier to an atomic notifier chain.* Currently always returns zero.
9350  register_die_notifier( & trace_die_notifier)
9352  flags = TRACE_ARRAY_FL_GLOBAL
9354  Initialization list head
9355  Initialization list head
9356  Initialization list head
9357  Initialization list head
9358  list_add - add a new entry*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head.* This is good for implementing stacks.
9360  apply_trace_boot_options()
9362  register_snapshot_cmd()
9364  Return 0
9366  out_free_savedcmd :
9367  free_saved_cmdlines_buffer(savedcmd)
9368  out_free_temp_buffer :
9369  g_buffer_free - free a ring buffer.*@buffer: the buffer to free.
9370  out_rm_hp_state :
9371  puhp_remove_multi_state - Remove hotplug multi state callback*@state: The state for which the calls are removed* Removes the callback functions from a multi state. This is the reverse of* cpuhp_setup_state_multi()
9372  out_free_cpumask :
9373  free_cpumask_var( only trace on set CPUs )
9374  out_free_buffer_mask :
9375  free_cpumask_var(tracing_buffer_mask)
9376  out :
9377  Return ret
Caller
NameDescribe
early_trace_init