Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:gister_tracer - register a tracer with the ftrace system.*@type: the plugin for the tracer* Register a new plugin tracer.

Proto:int __init register_tracer(struct tracer *type)

Type:int

Parameter:

TypeParameterName
struct tracer *type
1881  ret = 0
1883  If Not name Then
1884  pr_info("Tracer must have a name\n")
1885  Return -1
1888  If strlen - Find the length of a string*@s: The string to be sized >= MAX_TRACER_SIZE Then
1889  pr_info("Tracer has a name longer than %d\n", MAX_TRACER_SIZE)
1890  Return -1
1893  If security_locked_down(LOCKDOWN_TRACEFS) Then
1894  pr_warn("Can not register tracer %s due to lockdown\n", name)
1896  Return -EPERM
1899  mutex_lock( & race_types_lock is used to protect the trace_types list.)
1901  We need to change this state when a selftest is running.* A selftest will lurk into the ring-buffer to count the* entries inserted during the selftest although some concurrent* insertions into the ring-buffer such as trace_printk could occurred = true
1903  When t cycle
1904  If strcmp(name, name) == 0 Then
1906  pr_info("Tracer %s already registered\n", name)
1908  ret = -1
1909  Go to out
1913  If Not set_flag Then set_flag = dummy_set_flag
1915  If Not flags Then
1917  flags = Allocation memory
1918  If Not flags Then
1919  ret = -ENOMEM
1920  Go to out
1922  val = 0
1923  opts = For tracers that don't implement custom flags
1924  Else If Not opts Then
1926  opts = For tracers that don't implement custom flags
1929  trace = type
1931  ret = run_tracer_selftest(type)
1932  If ret < 0 Then Go to out
1935  next = race_types holds a link list of available tracers.
1936  race_types holds a link list of available tracers. = type
1937  add_tracer_options( & The global_trace is the descriptor that holds the top-level tracing* buffers for the live tracing., type)
1939  out :
1940  We need to change this state when a selftest is running.* A selftest will lurk into the ring-buffer to count the* entries inserted during the selftest although some concurrent* insertions into the ring-buffer such as trace_printk could occurred = false
1941  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
1943  If ret || Not default_bootup_tracer Then Go to out_unlock
1946  If strncmp(default_bootup_tracer, name, MAX_TRACER_SIZE) Then Go to out_unlock
1949  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
1951  tracing_set_tracer( & The global_trace is the descriptor that holds the top-level tracing* buffers for the live tracing., name)
1952  default_bootup_tracer = NULL
1954  apply_trace_boot_options()
1957  If a tracer is running, we do not want to run SELFTEST. = true
1963  out_unlock :
1964  Return ret
Caller
NameDescribe
tracer_alloc_buffers
init_function_trace
init_irqsoff_tracer
init_wakeup_tracer
init_hwlat_tracer
init_mmio_trace
init_graph_trace