Commit b46214b244 for qemu.org

commit b46214b2443b29e106b2c6c7b178eba969928b97
Author: Cédric Le Goater <clg@redhat.com>
Date:   Mon Nov 30 13:56:15 2026 +0100

    tests/unit/test-rcu-list: Drop unused n_nodes/n_updates counters

    n_nodes lost its last user when commit 8a5956ad6392 ("rcu tests: fix
    compilation on 32-bit ppc") dropped the "val" list member; n_updates
    was never read. clang 23 reports them as -Wunused-but-set-global:

    ../tests/unit/test-rcu-list.c:34:18: error: variable 'n_updates' set but not used [-Werror,-Wunused-but-set-global]
       34 | static long long n_updates = 0LL;
          |                  ^
    ../tests/unit/test-rcu-list.c:37:18: error: variable 'n_nodes' set but not used [-Werror,-Wunused-but-set-global]
       37 | static long long n_nodes = 0LL;
          |                  ^
    2 errors generated.

    Remove both globals and the local accumulators feeding them.

    Reviewed-by: Peter Xu <peterx@redhat.com>
    Link: https://lore.kernel.org/qemu-devel/20261130125615.728947-6-clg@redhat.com
    Signed-off-by: Cédric Le Goater <clg@redhat.com>

diff --git a/tests/unit/test-rcu-list.c b/tests/unit/test-rcu-list.c
index 8dde3e61a8..e0c2778d47 100644
--- a/tests/unit/test-rcu-list.c
+++ b/tests/unit/test-rcu-list.c
@@ -31,10 +31,8 @@

 static QemuMutex counts_mutex;
 static long long n_reads = 0LL;
-static long long n_updates = 0LL;
 static int64_t n_reclaims;
 static int64_t n_nodes_removed;
-static long long n_nodes = 0LL;
 static int g_test_in_charge = 0;

 static int nthreadsrunning;
@@ -200,8 +198,6 @@ static void *rcu_q_reader(void *arg)
 static void *rcu_q_updater(void *arg)
 {
     int j, target_el;
-    long long n_nodes_local = 0;
-    long long n_updates_local = 0;
     long long n_removed_local = 0;
     struct list_element *el, *prev_el;

@@ -234,19 +230,15 @@ static void *rcu_q_updater(void *arg)
             j++;
             if (target_el == j) {
                 struct list_element *new_el = g_new(struct list_element, 1);
-                n_nodes_local++;
                 TEST_LIST_INSERT_AFTER_RCU(el, new_el, entry);
                 break;
             }
         }

-        n_updates_local += 2;
         synchronize_rcu();
     }
     synchronize_rcu();
     qemu_mutex_lock(&counts_mutex);
-    n_nodes += n_nodes_local;
-    n_updates += n_updates_local;
     qatomic_set(&n_nodes_removed, n_nodes_removed + n_removed_local);
     qemu_mutex_unlock(&counts_mutex);
     return NULL;
@@ -262,9 +254,6 @@ static void rcu_qtest_init(void)
         new_el = g_new(struct list_element, 1);
         TEST_LIST_INSERT_HEAD_RCU(&Q_list_head, new_el, entry);
     }
-    qemu_mutex_lock(&counts_mutex);
-    n_nodes += RCU_Q_LEN;
-    qemu_mutex_unlock(&counts_mutex);
 }

 static void rcu_qtest_run(int duration, int nreaders)