]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix RCU TODOs
authorAndrew Dinh <andrewd@openssl.org>
Tue, 4 Mar 2025 15:32:56 +0000 (22:32 +0700)
committerNeil Horman <nhorman@openssl.org>
Wed, 12 Mar 2025 16:23:04 +0000 (12:23 -0400)
- Update allocate_new_qp_group to take unsigned int
- Move id_ctr in rcu_lock_st for better stack alignment

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26972)

(cherry picked from commit 7097d2e00ea9f0119a5e42f13a51487fb1e67aa3)

crypto/threads_pthread.c
crypto/threads_win.c

index a06756926e7f531fe300ab0fedf1a02522973437..9e3b83e17d38cceb7f3c03805c5cf0e38d723580 100644 (file)
@@ -195,12 +195,12 @@ struct rcu_lock_st {
     /* The context we are being created against */
     OSSL_LIB_CTX *ctx;
 
-    /* rcu generation counter for in-order retirement */
-    uint32_t id_ctr;
-
     /* Array of quiescent points for synchronization */
     struct rcu_qp *qp_group;
 
+    /* rcu generation counter for in-order retirement */
+    uint32_t id_ctr;
+
     /* Number of elements in qp_group array */
     uint32_t group_count;
 
@@ -400,7 +400,7 @@ static void retire_qp(CRYPTO_RCU_LOCK *lock, struct rcu_qp *qp)
 }
 
 static struct rcu_qp *allocate_new_qp_group(CRYPTO_RCU_LOCK *lock,
-                                            int count)
+                                            uint32_t count)
 {
     struct rcu_qp *new =
         OPENSSL_zalloc(sizeof(*new) * count);
index 993411a55e4fa0d621700491716a82ff3a5b73d6..0e411efc8aae0fd6d78d45b343fc0af0fcbb0edc 100644 (file)
@@ -79,8 +79,14 @@ struct rcu_thr_data {
 struct rcu_lock_st {
     struct rcu_cb_item *cb_items;
     OSSL_LIB_CTX *ctx;
-    uint32_t id_ctr;
+
+    /* Array of quiescent points for synchronization */
     struct rcu_qp *qp_group;
+
+    /* rcu generation counter for in-order retirement */
+    uint32_t id_ctr;
+
+    /* Number of elements in qp_group array */
     uint32_t group_count;
     uint32_t next_to_retire;
     volatile long int reader_idx;
@@ -94,7 +100,7 @@ struct rcu_lock_st {
 };
 
 static struct rcu_qp *allocate_new_qp_group(struct rcu_lock_st *lock,
-                                            int count)
+                                            uint32_t count)
 {
     struct rcu_qp *new =
         OPENSSL_zalloc(sizeof(*new) * count);