git: 09f55e600246 - main - umtx: Expose some of the pi umtx structures and API to the rest of the kernel.

Dmitry Chagin dchagin at FreeBSD.org
Thu Jul 29 09:58:40 UTC 2021


The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=09f55e60024662d7a9da248257ec72cd86767cea

commit 09f55e60024662d7a9da248257ec72cd86767cea
Author:     Dmitry Chagin <dchagin at FreeBSD.org>
AuthorDate: 2021-07-29 09:46:58 +0000
Commit:     Dmitry Chagin <dchagin at FreeBSD.org>
CommitDate: 2021-07-29 09:46:58 +0000

    umtx: Expose some of the pi umtx structures and API to the rest of the kernel.
    
    Differential Revision:  https://reviews.freebsd.org/D31237
    MFC after:              2 weeks
---
 sys/kern/kern_umtx.c | 20 +++++++++-----------
 sys/sys/umtxvar.h    | 10 ++++++++++
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c
index 7c850c0d78d8..7528561bb25c 100644
--- a/sys/kern/kern_umtx.c
+++ b/sys/kern/kern_umtx.c
@@ -170,8 +170,6 @@ static inline void umtx_abs_timeout_update(struct umtx_abs_timeout *timo);
 static void umtx_shm_init(void);
 static void umtxq_sysinit(void *);
 static void umtxq_hash(struct umtx_key *key);
-static struct umtx_pi *umtx_pi_alloc(int);
-static void umtx_pi_free(struct umtx_pi *pi);
 static int do_unlock_pp(struct thread *td, struct umutex *m, uint32_t flags,
     bool rb);
 static void umtx_thread_cleanup(struct thread *td);
@@ -435,7 +433,7 @@ umtxq_unbusy(struct umtx_key *key)
 		wakeup_one(uc);
 }
 
-static inline void
+void
 umtxq_unbusy_unlocked(struct umtx_key *key)
 {
 
@@ -1668,7 +1666,7 @@ do_wake2_umutex(struct thread *td, struct umutex *m, uint32_t flags)
 	return (error);
 }
 
-static inline struct umtx_pi *
+struct umtx_pi *
 umtx_pi_alloc(int flags)
 {
 	struct umtx_pi *pi;
@@ -1679,7 +1677,7 @@ umtx_pi_alloc(int flags)
 	return (pi);
 }
 
-static inline void
+void
 umtx_pi_free(struct umtx_pi *pi)
 {
 	uma_zfree(umtx_pi_zone, pi);
@@ -1888,7 +1886,7 @@ umtx_pi_disown(struct umtx_pi *pi)
 /*
  * Claim ownership of a PI mutex.
  */
-static int
+int
 umtx_pi_claim(struct umtx_pi *pi, struct thread *owner)
 {
 	struct umtx_q *uq;
@@ -1946,7 +1944,7 @@ umtx_pi_adjust(struct thread *td, u_char oldpri)
 /*
  * Sleep on a PI mutex.
  */
-static int
+int
 umtxq_sleep_pi(struct umtx_q *uq, struct umtx_pi *pi, uint32_t owner,
     const char *wmesg, struct umtx_abs_timeout *timo, bool shared)
 {
@@ -2014,7 +2012,7 @@ umtxq_sleep_pi(struct umtx_q *uq, struct umtx_pi *pi, uint32_t owner,
 /*
  * Add reference count for a PI mutex.
  */
-static void
+void
 umtx_pi_ref(struct umtx_pi *pi)
 {
 
@@ -2026,7 +2024,7 @@ umtx_pi_ref(struct umtx_pi *pi)
  * Decrease reference count for a PI mutex, if the counter
  * is decreased to zero, its memory space is freed.
  */
-static void
+void
 umtx_pi_unref(struct umtx_pi *pi)
 {
 	struct umtxq_chain *uc;
@@ -2049,7 +2047,7 @@ umtx_pi_unref(struct umtx_pi *pi)
 /*
  * Find a PI mutex in hash table.
  */
-static struct umtx_pi *
+struct umtx_pi *
 umtx_pi_lookup(struct umtx_key *key)
 {
 	struct umtxq_chain *uc;
@@ -2069,7 +2067,7 @@ umtx_pi_lookup(struct umtx_key *key)
 /*
  * Insert a PI mutex into hash table.
  */
-static inline void
+void
 umtx_pi_insert(struct umtx_pi *pi)
 {
 	struct umtxq_chain *uc;
diff --git a/sys/sys/umtxvar.h b/sys/sys/umtxvar.h
index ed2d8046a5fb..fd193de5818b 100644
--- a/sys/sys/umtxvar.h
+++ b/sys/sys/umtxvar.h
@@ -214,9 +214,19 @@ int umtxq_requeue(struct umtx_key *, int, struct umtx_key *, int);
 int umtxq_signal_mask(struct umtx_key *, int, u_int);
 int umtxq_sleep(struct umtx_q *, const char *,
     struct umtx_abs_timeout *);
+int umtxq_sleep_pi(struct umtx_q *, struct umtx_pi *, uint32_t,
+    const char *, struct umtx_abs_timeout *, bool);
 void umtxq_unbusy(struct umtx_key *);
+void umtxq_unbusy_unlocked(struct umtx_key *);
 int kern_umtx_wake(struct thread *, void *, int, int);
 void umtx_pi_adjust(struct thread *, u_char);
+struct umtx_pi *umtx_pi_alloc(int);
+int umtx_pi_claim(struct umtx_pi *, struct thread *);
+void umtx_pi_free(struct umtx_pi *);
+void umtx_pi_insert(struct umtx_pi *);
+struct umtx_pi *umtx_pi_lookup(struct umtx_key *);
+void umtx_pi_ref(struct umtx_pi *);
+void umtx_pi_unref(struct umtx_pi *);
 void umtx_thread_init(struct thread *);
 void umtx_thread_fini(struct thread *);
 void umtx_thread_alloc(struct thread *);


More information about the dev-commits-src-all mailing list