Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\events\core.c Create Date:2022-07-28 13:35:25
Last Modify:2022-05-20 07:50:19 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:_perf_ioctl

Proto:static long _perf_ioctl(struct perf_event *event, unsigned int cmd, unsigned long arg)

Type:long

Parameter:

TypeParameterName
struct perf_event *event
unsigned intcmd
unsigned longarg
5241  flags = arg
5244  Case cmd == Ioctls that can be done on a perf event fd:
5245  func = Enable an event
5246  Break
5247  Case cmd == PERF_EVENT_IOC_DISABLE
5248  func = Disable an event
5249  Break
5250  Case cmd == PERF_EVENT_IOC_RESET
5251  func = _perf_event_reset
5252  Break
5254  Case cmd == PERF_EVENT_IOC_REFRESH
5255  Return _perf_event_refresh(event, arg)
5257  Case cmd == PERF_EVENT_IOC_PERIOD
5261  If copy_from_user( & value, (u64__user * )arg, size of value ) Then Return -EFAULT
5264  Return _perf_event_period(event, value)
5266  Case cmd == PERF_EVENT_IOC_ID
5268  id = If we inherit events we want to return the parent event id* to userspace.
5270  If copy_to_user((void__user * )arg, & id, size of id ) Then Return -EFAULT
5272  Return 0
5275  Case cmd == PERF_EVENT_IOC_SET_OUTPUT
5278  If arg != -1 Then
5281  ret = perf_fget_light(arg, & output)
5282  If ret Then Return ret
5286  fdput(output)
5287  Else
5288  ret = perf_event_set_output(event, NULL)
5290  Return ret
5293  Case cmd == PERF_EVENT_IOC_SET_FILTER
5294  Return perf_event_set_filter(event, (void__user * )arg)
5296  Case cmd == PERF_EVENT_IOC_SET_BPF
5297  Return perf_event_set_bpf_prog(event, arg)
5299  Case cmd == PERF_EVENT_IOC_PAUSE_OUTPUT
5302  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
5303  rb = fetch RCU-protected pointer for dereferencing(rb)
5304  If Not rb || Not nr of data pages Then
5306  Return -EINVAL
5308  rb_toggle_paused(rb, !!arg)
5309  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
5310  Return 0
5313  Case cmd == PERF_EVENT_IOC_QUERY_BPF
5314  Return perf_event_query_prog_array(event, (void__user * )arg)
5316  Case cmd == PERF_EVENT_IOC_MODIFY_ATTRIBUTES
5318  err = perf_copy_attr((structperf_event_attr__user * )arg, & new_attr)
5321  If err Then Return err
5324  Return perf_event_modify_attr(event, & new_attr)
5326  Default
5327  Return -ENOTTY
5330  If flags & PERF_IOC_FLAG_GROUP Then perf_event_for_each(event, func)
5332  Else Holding the top-level event's child_mutex means that any* descendant process that has inherited this event will block* in perf_event_exit_event() if it goes to exit, thus satisfying the* task existence requirements of perf_event_enable/disable.
5335  Return 0
Caller
NameDescribe
perf_ioctl