函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\futex.c Create Date:2022-07-27 11:54:44
Last Modify:2020-03-17 15:28:32 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Userspace tried a 0 -> TID atomic transition of the futex value* and failed. The kernel side here does the whole locking operation:* if there are waiters then it will block as a consequence of relying* on rt-mutexes, it does PI, etc

函数原型:static int futex_lock_pi(unsigned int __user *uaddr, unsigned int flags, ktime_t *time, int trylock)

返回类型:int

参数:

类型参数名称
unsigned int __user *uaddr
unsigned intflags
ktime_t *time
inttrylock
2881  struct futex_pi_state * pi_state = NULL
2882  struct task_struct * exiting = NULL
2885  q等于futex_q_init
2888  如果非IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_FUTEX_PI)则返回:负ENOSYS
2891  如果PI code:则返回:负ENOMEM
2894  to等于ex_setup_timer - set up the sleeping hrtimer
2896  retry :
2897  ret等于get_futex_key() - Get parameters which are the keys for a futex*@uaddr: virtual address of the futex*@fshared: 0 for a PROCESS_PRIVATE futex, 1 for PROCESS_SHARED*@key: address where result is stored
2898  如果此条件成立可能性小(为编译器优化)(ret != 0)则转到:out
2901  retry_private :
2902  hb等于The key must be already stored in q->key.
2904  ret等于ex_lock_pi_atomic() - Atomic work required to acquire a pi aware futex*@uaddr: the pi futex user address*@hb: the pi futex hash bucket*@key: the futex key associated with uaddr and hb*@ps: the pi_state pointer where we store the result of the* lookup
2906  如果此条件成立可能性小(为编译器优化)(ret)则
2912  :ret恒等于1
2914  ret等于0
2915  转到:out_unlock_put_key
2916  :ret恒等于负EFAULT
2917  转到:uaddr_faulted
2918  :ret恒等于负EBUSY
2919  :ret恒等于负EAGAIN
2926  queue_unlock(hb)
2927  put_futex_key( & key)
2934  cond_resched()
2935  转到:retry
2936  默认
2937  转到:out_unlock_put_key
2941  WARN_ON(!pi_state)
2946  __queue_me( & q, hb)
2948  如果trylock
2949  ret等于Futex variant, must not use fastpath.
2951  ret等于如果ret则0否则负EWOULDBLOCK
2952  转到:no_block
2955  rt_mutex_init_waiter( & rt_waiter)
2970  关闭本地中断,获取所要保护的运行队列(runqueue)的自旋锁(spinlock),为查找可运行进程做准备。( & 保护自旋锁)
2971  自旋锁解锁
2977  ret等于__rt_mutex_start_proxy_lock() - Start lock acquisition for another task*@lock: the rt_mutex to take*@waiter: the pre-initialized rt_mutex_waiter*@task: the task to prepare* Starts the rt_mutex acquire; it enqueues the @waiter and does deadlock* detection
2978  raw_spin_unlock_irq( & 保护自旋锁)
2980  如果ret
2981  如果ret恒等于1则ret等于0
2983  转到:cleanup
2986  如果此条件成立可能性小(为编译器优化)(to)则hrtimer_sleeper_start_expires - Start a hrtimer sleeper timer*@sl: sleeper to be started*@mode: timer mode abs/rel* Wrapper around hrtimer_start_expires() for hrtimer_sleeper based timers* to allow PREEMPT_RT to tweak the delivery mode (soft/hardirq
2989  ret等于_mutex_wait_proxy_lock() - Wait for lock acquisition*@lock: the rt_mutex we were woken on*@to: the timeout, null if none
2991  cleanup :
2992  加自旋锁
3002  如果ret且非_mutex_cleanup_proxy_lock() - Cleanup failed lock acquisition*@lock: the rt_mutex we were woken on*@waiter: the pre-initialized rt_mutex_waiter* Attempt to clean up after a failed __rt_mutex_start_proxy_lock() or* rt_mutex_wait_proxy_lock()ret等于0
3005  no_block :
3010  res等于xup_owner() - Post lock pi_state and corner case management*@uaddr: user address of the futex*@q: futex_q (contains pi_state and access to the rt_mutex)*@locked: if the attempt to take the rt_mutex succeeded (1) or not (0)* After attempting to lock an
3015  如果resret等于如果res小于0则res否则0
3022  如果retrt_mutex_owner( & The PI object:)恒等于当前进程
3023  pi_state等于pi_state
3024  get_pi_state(pi_state)
3028  PI futexes can not be requeued and must remove themself from the* hash bucket. The hash bucket lock (i.e. lock_ptr) is held on entry* and dropped here.
3030  如果pi_state
3031  rt_mutex_futex_unlock( & The PI object:)
3032  Drops a reference to the pi_state object and frees or caches it* when the last reference is gone.
3035  转到:out_put_key
3037  out_unlock_put_key :
3038  queue_unlock(hb)
3040  out_put_key :
3041  put_futex_key( & key)
3042  out :
3043  如果to
3044  hrtimer_cancel - cancel a timer and wait for the handler to finish.*@timer: the timer to be cancelled* Returns:* 0 when the timer was not active* 1 when the timer was active
3045  destroy_hrtimer_on_stack( & timer)
3047  返回:如果ret不等于负EINTRret否则负ERESTARTNOINTR
3049  uaddr_faulted :
3050  queue_unlock(hb)
3052  ret等于ault_in_user_writeable() - Fault in user address and verify RW access*@uaddr: pointer to faulting user space address* Slow path to fixup the fault we just took in the atomic write* access to @uaddr
3053  如果ret则转到:out_put_key
3056  如果非flags按位与Futex flags used to encode options to functions and preserve them across* restarts.的值则转到:retry_private
3059  put_futex_key( & key)
3060  转到:retry
调用者
名称描述
do_futex