On 8/10/22 10:29 PM, Paolo Bonzini wrote:
On 8/10/22 14:22, Mathieu Desnoyers wrote:
/*
* Create and run a dummy VM that immediately exits to userspace via
@@ -256,7 +244,7 @@ int main(int argc, char *argv[])
*/
smp_rmb();
cpu = sched_getcpu();
- rseq_cpu = READ_ONCE(__rseq.cpu_id);
+ rseq_cpu = READ_ONCE(__rseq->cpu_id);
#include <rseq.h>
and use
rseq_current_cpu_raw().
Thanks, I squashed it and queued it for -rc1 (tested on both
glibc 2.34 and 2.35).
Paolo, Thanks for the makeup, which looks good to me :)
diff --git a/tools/testing/selftests/kvm/rseq_test.c b/tools/testing/selftests/kvm/rseq_test.c
index 84e8425edc2c..987a76674f4f 100644
--- a/tools/testing/selftests/kvm/rseq_test.c
+++ b/tools/testing/selftests/kvm/rseq_test.c
@@ -29,7 +29,6 @@
#define NR_TASK_MIGRATIONS 100000
static pthread_t migration_thread;
-static struct rseq_abi *__rseq;
static cpu_set_t possible_mask;
static int min_cpu, max_cpu;
static bool done;
@@ -218,7 +217,6 @@ int main(int argc, char *argv[])
r = rseq_register_current_thread();
TEST_ASSERT(!r, "rseq_register_current_thread failed, errno = %d (%s)",
errno, strerror(errno));
- __rseq = rseq_get_abi();
/*
* Create and run a dummy VM that immediately exits to userspace via
@@ -256,7 +254,7 @@ int main(int argc, char *argv[])
*/
smp_rmb();
cpu = sched_getcpu();
- rseq_cpu = READ_ONCE(__rseq->cpu_id);
+ rseq_cpu = rseq_current_cpu_raw();
smp_rmb();
} while (snapshot != atomic_read(&seq_cnt));