parametrized test: Report/abort on negative concurrency ID
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 25 Apr 2023 22:08:33 +0000 (18:08 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 25 Apr 2023 22:38:09 +0000 (18:38 -0400)
Report and abort when a negative concurrency ID value is observed by the
spinlock test.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ied1e3dafcd882c1071bcc432c7a5102ca77c4316

tests/param_test.c

index a77ac58ab0b7881d85c8baeed3fb652ff7431f8f..f93ddd5c39b87af4993a88bc8555926ee71fafd8 100644 (file)
@@ -53,13 +53,13 @@ static long long opt_reps = 5000;
 static __thread __attribute__((tls_model("initial-exec")))
 unsigned int signals_delivered;
 
-#ifndef BENCHMARK
-
 static inline pid_t rseq_gettid(void)
 {
        return syscall(__NR_gettid);
 }
 
+#ifndef BENCHMARK
+
 static __thread __attribute__((tls_model("initial-exec"), unused))
 int yield_mod_cnt, nr_abort;
 
@@ -424,6 +424,11 @@ static int rseq_this_cpu_lock(struct percpu_lock *lock)
                int ret;
 
                cpu = get_current_cpu_id();
+               if (cpu < 0) {
+                       fprintf(stderr, "pid: %d: tid: %d, cpu: %d: cid: %d\n",
+                               getpid(), (int) rseq_gettid(), rseq_current_cpu_raw(), cpu);
+                       abort();
+               }
                ret = rseq_cmpeqv_storev(RSEQ_MO_RELAXED, RSEQ_PERCPU,
                                         &lock->c[cpu].v,
                                         0, 1, cpu);
This page took 0.0281 seconds and 4 git commands to generate.