mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
umtx: Add a helper for unlocked umtxq_busy() calls
This seems like a natural complement to umtxq_unbusy_unlocked(). No functional change intended. Reviewed by: olce, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D49124 (cherry picked from commit b01495caac2eca73463f4a889936a19e4c1c5909)
This commit is contained in:
parent
ffb4d07771
commit
c813157a15
3 changed files with 19 additions and 28 deletions
|
|
@ -501,9 +501,7 @@ linux_futex_lock_pi(struct thread *td, bool try, struct linux_futex_args *args)
|
|||
if (error != 0)
|
||||
break;
|
||||
|
||||
umtxq_lock(&uq->uq_key);
|
||||
umtxq_busy(&uq->uq_key);
|
||||
umtxq_unlock(&uq->uq_key);
|
||||
umtxq_busy_unlocked(&uq->uq_key);
|
||||
|
||||
/*
|
||||
* Set the contested bit so that a release in user space knows
|
||||
|
|
@ -642,9 +640,7 @@ linux_futex_wakeop(struct thread *td, struct linux_futex_args *args)
|
|||
umtx_key_release(&key);
|
||||
return (error);
|
||||
}
|
||||
umtxq_lock(&key);
|
||||
umtxq_busy(&key);
|
||||
umtxq_unlock(&key);
|
||||
umtxq_busy_unlocked(&key);
|
||||
error = futex_atomic_op(td, args->val3, args->uaddr2, &op_ret);
|
||||
umtxq_lock(&key);
|
||||
umtxq_unbusy(&key);
|
||||
|
|
@ -701,9 +697,7 @@ linux_futex_requeue(struct thread *td, struct linux_futex_args *args)
|
|||
umtx_key_release(&key);
|
||||
return (error);
|
||||
}
|
||||
umtxq_lock(&key);
|
||||
umtxq_busy(&key);
|
||||
umtxq_unlock(&key);
|
||||
umtxq_busy_unlocked(&key);
|
||||
error = fueword32(args->uaddr, &uval);
|
||||
if (error != 0)
|
||||
error = EFAULT;
|
||||
|
|
|
|||
|
|
@ -439,10 +439,17 @@ umtxq_unbusy(struct umtx_key *key)
|
|||
wakeup_one(uc);
|
||||
}
|
||||
|
||||
void
|
||||
umtxq_busy_unlocked(struct umtx_key *key)
|
||||
{
|
||||
umtxq_lock(key);
|
||||
umtxq_busy(key);
|
||||
umtxq_unlock(key);
|
||||
}
|
||||
|
||||
void
|
||||
umtxq_unbusy_unlocked(struct umtx_key *key)
|
||||
{
|
||||
|
||||
umtxq_lock(key);
|
||||
umtxq_unbusy(key);
|
||||
umtxq_unlock(key);
|
||||
|
|
@ -2371,9 +2378,7 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32_t flags,
|
|||
if (error != 0)
|
||||
break;
|
||||
|
||||
umtxq_lock(&uq->uq_key);
|
||||
umtxq_busy(&uq->uq_key);
|
||||
umtxq_unlock(&uq->uq_key);
|
||||
umtxq_busy_unlocked(&uq->uq_key);
|
||||
|
||||
/*
|
||||
* Set the contested bit so that a release in user space
|
||||
|
|
@ -2539,9 +2544,7 @@ do_lock_pp(struct thread *td, struct umutex *m, uint32_t flags,
|
|||
su = (priv_check(td, PRIV_SCHED_RTPRIO) == 0);
|
||||
for (;;) {
|
||||
old_inherited_pri = uq->uq_inherited_pri;
|
||||
umtxq_lock(&uq->uq_key);
|
||||
umtxq_busy(&uq->uq_key);
|
||||
umtxq_unlock(&uq->uq_key);
|
||||
umtxq_busy_unlocked(&uq->uq_key);
|
||||
|
||||
rv = fueword32(&m->m_ceilings[0], &ceiling);
|
||||
if (rv == -1) {
|
||||
|
|
@ -2722,9 +2725,8 @@ do_unlock_pp(struct thread *td, struct umutex *m, uint32_t flags, bool rb)
|
|||
TYPE_PP_ROBUST_UMUTEX : TYPE_PP_UMUTEX, GET_SHARE(flags),
|
||||
&key)) != 0)
|
||||
return (error);
|
||||
umtxq_lock(&key);
|
||||
umtxq_busy(&key);
|
||||
umtxq_unlock(&key);
|
||||
umtxq_busy_unlocked(&key);
|
||||
|
||||
/*
|
||||
* For priority protected mutex, always set unlocked state
|
||||
* to UMUTEX_CONTESTED, so that userland always enters kernel
|
||||
|
|
@ -2787,9 +2789,7 @@ do_set_ceiling(struct thread *td, struct umutex *m, uint32_t ceiling,
|
|||
&uq->uq_key)) != 0)
|
||||
return (error);
|
||||
for (;;) {
|
||||
umtxq_lock(&uq->uq_key);
|
||||
umtxq_busy(&uq->uq_key);
|
||||
umtxq_unlock(&uq->uq_key);
|
||||
umtxq_busy_unlocked(&uq->uq_key);
|
||||
|
||||
rv = fueword32(&m->m_ceilings[0], &save_ceiling);
|
||||
if (rv == -1) {
|
||||
|
|
@ -3139,9 +3139,7 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock, long fflag,
|
|||
break;
|
||||
|
||||
/* grab monitor lock */
|
||||
umtxq_lock(&uq->uq_key);
|
||||
umtxq_busy(&uq->uq_key);
|
||||
umtxq_unlock(&uq->uq_key);
|
||||
umtxq_busy_unlocked(&uq->uq_key);
|
||||
|
||||
/*
|
||||
* re-read the state, in case it changed between the try-lock above
|
||||
|
|
@ -3332,9 +3330,7 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock, struct _umtx_time *timeo
|
|||
}
|
||||
|
||||
/* grab monitor lock */
|
||||
umtxq_lock(&uq->uq_key);
|
||||
umtxq_busy(&uq->uq_key);
|
||||
umtxq_unlock(&uq->uq_key);
|
||||
umtxq_busy_unlocked(&uq->uq_key);
|
||||
|
||||
/*
|
||||
* Re-read the state, in case it changed between the
|
||||
|
|
|
|||
|
|
@ -206,6 +206,7 @@ int umtx_key_get(const void *, int, int, struct umtx_key *);
|
|||
void umtx_key_release(struct umtx_key *);
|
||||
struct umtx_q *umtxq_alloc(void);
|
||||
void umtxq_busy(struct umtx_key *);
|
||||
void umtxq_busy_unlocked(struct umtx_key *);
|
||||
int umtxq_count(struct umtx_key *);
|
||||
void umtxq_free(struct umtx_q *);
|
||||
struct umtxq_chain *umtxq_getchain(struct umtx_key *);
|
||||
|
|
|
|||
Loading…
Reference in a new issue