函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\events\core.c Create Date:2022-07-27 15:00:18
Last Modify:2022-05-20 07:50:19 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:perf_pmu_register

函数原型:int perf_pmu_register(struct pmu *pmu, const char *name, int type)

返回类型:int

参数:

类型参数名称
struct pmu *pmu
const char *name
inttype
10283  max等于-ABI
10285  mutex_lock( & pmus_lock)
10286  ret等于负ENOMEM
10287  pmu_disable_count等于alloc_percpu(int)
10288  如果非pmu_disable_count则转到:unlock
10291  type等于负1
10292  如果非name则转到:skip_type
10294  name等于name
10296  如果type不等于PERF_TYPE_SOFTWARE
10297  如果type大于等于0则max等于type
10300  ret等于dr_alloc() - Allocate an ID.*@idr: IDR handle.*@ptr: Pointer to be associated with the new ID.*@start: The minimum ID (inclusive).*@end: The maximum ID (exclusive).*@gfp: Memory allocation flags.
10301  如果ret小于0则转到:free_pdc
10304  WARN_ON(type >= 0 && ret != type)
10306  type等于ret
10308  type等于type
10310  如果pmu_bus_running
10311  ret等于pmu_dev_alloc(pmu)
10312  如果ret则转到:free_idr
10316  skip_type :
10317  如果task_ctx_nr恒等于perf_hw_context
10318  hw_context_taken等于0
10325  如果WARN_ON_ONCE(hw_context_taken && !(various common per-pmu feature flags & PERF_PMU_CAP_HETEROGENEOUS_CPUS))则task_ctx_nr等于perf_invalid_context
10329  hw_context_taken等于1
10332  pmu_cpu_context等于Ensures all contexts with the same task_ctx_nr have the same* pmu_cpu_context too.
10333  如果pmu_cpu_context则转到:got_cpu_context
10336  ret等于负ENOMEM
10337  pmu_cpu_context等于alloc_percpu(structperf_cpu_context)
10338  如果非pmu_cpu_context则转到:free_dev
10341  遍历可用CPU(cpu)
10344  cpuctx等于per_cpu_ptr(pmu_cpu_context, cpu)
10345  Initialize the perf_event context in a task_struct:
10346  lockdep_set_class( & Protect the list of events. Locking either mutex or lock* is sufficient to ensure the list doesn't change; to change* the list you need to lock both the mutex and the spinlock., & cpuctx_mutex)
10347  lockdep_set_class( & Protect the states of the events in the list,* nr_active, and the list:, & cpuctx_lock)
10348  pmu等于pmu
10349  online等于测试CPU信息
10351  __perf_mux_hrtimer_init(cpuctx, cpu)
10354  got_cpu_context :
10355  如果非start_txn
10356  如果pmu_enable
10365  否则
10372  如果非pmu_enable
10373  pmu_enable等于perf_pmu_nop_void
10374  pmu_disable等于perf_pmu_nop_void
10377  如果非check_periodcheck_period等于perf_event_nop_int
10380  如果非event_idxevent_idx等于perf_event_idx_default
10388  如果type恒等于PERF_TYPE_SOFTWARE或非name添加RCU保护项
10390  否则添加RCU链表项
10393  atomic_set( & < 0: cpu; > 0: tsk , 0)
10394  ret等于0
10395  unlock :
10396  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.
10398  返回:ret
10400  free_dev :
10401  device_del(dev)
10402  put_device(dev)
10404  free_idr :
10405  如果type不等于PERF_TYPE_SOFTWARE删除释放idr
10408  free_pdc :
10409  释放内存
10410  转到:unlock
调用者
名称描述
perf_event_init
init_hw_breakpoint