Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\futex.c Create Date:2022-07-28 10:54:25
Last Modify:2020-03-17 15:28:32 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:fixup_pi_state_owner

Proto:static int fixup_pi_state_owner(unsigned int __user *uaddr, struct futex_q *q, struct task_struct *argowner)

Type:int

Parameter:

TypeParameterName
unsigned int __user *uaddr
struct futex_q *q
struct task_struct *argowner
2443  pi_state = pi_state
2444  curval = curval
2447  err = 0
2449  lockdep_assert_held(lock_ptr)
2451  raw_spin_lock_irq( & wait_lock)
2453  oldowner = owner
2478  retry :
2479  If Not argowner Then
2480  If oldowner != current process Then
2485  ret = 0
2486  Go to out_unlock
2491  ret = 0
2492  Go to out_unlock
2498  newowner = rt_mutex_owner( & The PI object:)
2499  BUG_ON(!newowner)
2500  Else
2501  WARN_ON_ONCE(argowner != current process)
2502  If oldowner == current process Then
2507  ret = 0
2508  Go to out_unlock
2510  newowner = argowner
2513  newtid = task_pid_vnr(newowner) | Are there any waiters for this robust futex:
2515  If Not owner Then newtid |= The kernel signals via this bit that a thread holding a futex* has exited without unlocking the futex. The kernel also does* a FUTEX_WAKE on such futexes, after setting the bit, to wake* up any possible waiters:
2518  err = get_futex_value_locked( & uval, uaddr)
2519  If err Then Go to handle_err
2522  cycle
2523  newval = uval & The kernel signals via this bit that a thread holding a futex* has exited without unlocking the futex. The kernel also does* a FUTEX_WAKE on such futexes, after setting the bit, to wake* up any possible waiters: | newtid
2525  err = cmpxchg_futex_value_locked( & curval, uaddr, uval, newval)
2526  If err Then Go to handle_err
2529  If curval == uval Then Break
2531  uval = curval
2538  If (owner != NULL) Then
2539  raw_spin_lock( & Protection of the PI data structures: )
2540  WARN_ON(list_empty - tests whether a list is empty*@head: the list to test.)
2541  list_del_init - deletes entry from list and reinitialize it.*@entry: the element to delete from the list.
2542  raw_spin_unlock( & Protection of the PI data structures: )
2545  owner = newowner
2547  raw_spin_lock( & Protection of the PI data structures: )
2548  WARN_ON(!list_empty - tests whether a list is empty*@head: the list to test.)
2549  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.
2550  raw_spin_unlock( & Protection of the PI data structures: )
2551  raw_spin_unlock_irq( & wait_lock)
2553  Return 0
2568  handle_err :
2569  raw_spin_unlock_irq( & wait_lock)
2570  spin_unlock(lock_ptr)
2573  Case err == -EFAULT
2574  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
2575  Break
2577  Case err == -EAGAIN
2578  cond_resched()
2579  ret = 0
2580  Break
2582  Default
2583  WARN_ON_ONCE(1)
2584  ret = err
2585  Break
2588  spin_lock(lock_ptr)
2589  raw_spin_lock_irq( & wait_lock)
2594  If owner != oldowner Then
2595  ret = 0
2596  Go to out_unlock
2599  If ret Then Go to out_unlock
2602  Go to retry
2604  out_unlock :
2605  raw_spin_unlock_irq( & wait_lock)
2606  Return ret
Caller
NameDescribe
fixup_ownerxup_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
futex_wait_requeue_piex_wait_requeue_pi() - Wait on uaddr and take uaddr2*@uaddr: the futex we initially wait on (non-pi)*@flags: futex flags (FLAGS_SHARED, FLAGS_CLOCKRT, etc