Skip to contentSkip to conversation

testing/next (rcutorture and misc tweaks)

PATCH Superseded Alex Bennée 3 participants 11 messages Feb 7, 2020 – Feb 13, 2020

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover testing/next (rcutorture and misc tweaks)

Hi,

The current state of testing/next is mostly a rubber duck exercise as I tried to figure out what might cause the rcutorture test to fail. The only real practical change is asserting we are never about to reset and existing active RCU structure. So far I haven't seen the rcutorture crash occur since (although git stability seems to be a current problem for Travis).

Alex Bennée (4):
tests/tcg: include a skip runner for pauth3 with plugins tests/rcutorture: update usage hint tests/rcutorture: better document locking of stats tests/rcutorture: mild documenting refactor of update thread

Thomas Huth (1):
travis.yml: Test the s390-ccw build, too

 tests/rcutorture.c                        | 55 +++++++++++++++++------
 .travis.yml                               | 10 +++++
 tests/tcg/aarch64/Makefile.softmmu-target |  2 +
 3 files changed, 53 insertions(+), 14 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/5 tests/tcg: include a skip runner for pauth3 with plugins

If we have plugins enabled we still need to have built the test to be able to run it.

---
 tests/tcg/aarch64/Makefile.softmmu-target | 2 ++
 1 file changed, 2 insertions(+)
tests/tcg/aarch64/Makefile.softmmu-target +2 -0
index d2299b98b76..71f72cfbe34 100644
@@ -70,4 +70,6 @@ pauth-3:
 	$(call skip-test, "BUILD of $@", "missing compiler support")
 run-pauth-3:
 	$(call skip-test, "RUN of pauth-3", "not built")
+run-plugin-pauth-3-with-%:
+	$(call skip-test, "RUN of pauth-3 ($*)", "not built")
 endif
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/5 tests/rcutorture: update usage hint

In reply to Alex Bennée

Although documented in the comments we don't display all the various invocations we can in the usage.

---
 tests/rcutorture.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/rcutorture.c +2 -1
index 49311c82ea4..e8b2169e7dd 100644
@@ -413,7 +413,8 @@ static void gtest_stress_10_5(void)
 
 static void usage(int argc, char *argv[])
 {
-    fprintf(stderr, "Usage: %s [nreaders [ perf | stress ] ]\n", argv[0]);
+    fprintf(stderr, "Usage: %s [nreaders [ [r|u]perf | stress [duration]]\n",
+            argv[0]);
     exit(-1);
 }
 
Signature · 1 line
2.20.1
Reviewed-by on v1 2/5
#3 lore raw

Re: [PATCH v1 2/5] tests/rcutorture: update usage hint

Quoted 14 lines · Alex Bennée

Although documented in the comments we don't display all the various invocations we can in the usage.

---
  tests/rcutorture.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
tests/rcutorture.c +0 -0
index 49311c82ea4..e8b2169e7dd 100644

tests/rcutorture.c static void gtest_stress_10_5(void) · line 420

Quoted 9 lines
tests/rcutorture.c +2 -1
@@ -413,7 +413,8 @@ static void gtest_stress_10_5(void)
 
  static void usage(int argc, char *argv[])
  {
-    fprintf(stderr, "Usage: %s [nreaders [ perf | stress ] ]\n", argv[0]);
+    fprintf(stderr, "Usage: %s [nreaders [ [r|u]perf | stress [duration]]\n",
+            argv[0]);
      exit(-1);
  }
 
#4 lore raw

PATCH 3/5 tests/rcutorture: better document locking of stats

In reply to Alex Bennée

This is pure code motion with no functional effect.

---
 tests/rcutorture.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
tests/rcutorture.c +12 -4
index e8b2169e7dd..256d24ed5ba 100644
@@ -65,8 +65,6 @@
 #include "qemu/rcu.h"
 #include "qemu/thread.h"
 
-long long n_reads = 0LL;
-long n_updates = 0L;
 int nthreadsrunning;
 
 #define GOFLAG_INIT 0
@@ -78,11 +76,20 @@ static volatile int goflag = GOFLAG_INIT;
 #define RCU_READ_RUN 1000
 
 #define NR_THREADS 100
-static QemuMutex counts_mutex;
 static QemuThread threads[NR_THREADS];
 static struct rcu_reader_data *data[NR_THREADS];
 static int n_threads;
 
+/*
+ * Statistical counts
+ *
+ * These are the sum of local counters at the end of a run.
+ * Updates are protected by a mutex.
+ */
+static QemuMutex counts_mutex;
+long long n_reads = 0LL;
+long n_updates = 0L;
+
 static void create_thread(void *(*func)(void *))
 {
     if (n_threads >= NR_THREADS) {
@@ -230,8 +237,9 @@ struct rcu_stress {
 struct rcu_stress rcu_stress_array[RCU_STRESS_PIPE_LEN] = { { 0 } };
 struct rcu_stress *rcu_stress_current;
 int rcu_stress_idx;
-
 int n_mberror;
+
+/* Updates protected by counts_mutex */
 long long rcu_stress_count[RCU_STRESS_PIPE_LEN + 1];
 
 
Signature · 1 line
2.20.1
Reviewed-by on v1 3/5
#5 lore raw

Re: [PATCH v1 3/5] tests/rcutorture: better document locking of stats

Quoted 44 lines · Alex Bennée

This is pure code motion with no functional effect.

---
  tests/rcutorture.c | 16 ++++++++++++----
  1 file changed, 12 insertions(+), 4 deletions(-)
tests/rcutorture.c +10 -3
index e8b2169e7dd..256d24ed5ba 100644
@@ -65,8 +65,6 @@
  #include "qemu/rcu.h"
  #include "qemu/thread.h"
 
-long long n_reads = 0LL;
-long n_updates = 0L;
  int nthreadsrunning;
 
  #define GOFLAG_INIT 0
@@ -78,11 +76,20 @@ static volatile int goflag = GOFLAG_INIT;
  #define RCU_READ_RUN 1000
 
  #define NR_THREADS 100
-static QemuMutex counts_mutex;
  static QemuThread threads[NR_THREADS];
  static struct rcu_reader_data *data[NR_THREADS];
  static int n_threads;
 
+/*
+ * Statistical counts
+ *
+ * These are the sum of local counters at the end of a run.
+ * Updates are protected by a mutex.
+ */
+static QemuMutex counts_mutex;
+long long n_reads = 0LL;
+long n_updates = 0L;
+
  static void create_thread(void *(*func)(void *))
  {
      if (n_threads >= NR_THREADS) {

tests/rcutorture.c struct rcu_stress { · line 245

Quoted 10 lines
tests/rcutorture.c +2 -1
@@ -230,8 +237,9 @@ struct rcu_stress {
  struct rcu_stress rcu_stress_array[RCU_STRESS_PIPE_LEN] = { { 0 } };
  struct rcu_stress *rcu_stress_current;
  int rcu_stress_idx;
-
  int n_mberror;
+
+/* Updates protected by counts_mutex */
  long long rcu_stress_count[RCU_STRESS_PIPE_LEN + 1];
 
 
#6 lore raw

PATCH 4/5 tests/rcutorture: mild documenting refactor of update thread

In reply to Alex Bennée

This is mainly to help with reasoning what the test is trying to do. We can move rcu_stress_idx to a local variable as there is only ever one updater thread. I've also added an assert to catch the case where we end up updating the current structure to itself which is the only way I can see the mberror cases we are seeing on Travis.

We shall see if the rcutorture test failures go away now.

---
 tests/rcutorture.c | 36 +++++++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 9 deletions(-)
tests/rcutorture.c +27 -9
index 256d24ed5ba..9559f13cd1f 100644
@@ -236,7 +236,6 @@ struct rcu_stress {
 
 struct rcu_stress rcu_stress_array[RCU_STRESS_PIPE_LEN] = { { 0 } };
 struct rcu_stress *rcu_stress_current;
-int rcu_stress_idx;
 int n_mberror;
 
 /* Updates protected by counts_mutex */
@@ -288,29 +287,48 @@ static void *rcu_read_stress_test(void *arg)
     return NULL;
 }
 
+/*
+ * Stress Test Updater
+ *
+ * The updater cycles around updating rcu_stress_current to point at
+ * one of the rcu_stress_array_entries and resets it's pipe_count. It
+ * then increments pipe_count of all the other entries. The pipe_count
+ * will be read under an rcu_read_lock() and distribution of values
+ * calculated. The final result gives an indication of how many
+ * previously current rcu_stress entries are in flight until the RCU
+ * cycle complete.
+ */
 static void *rcu_update_stress_test(void *arg)
 {
-    int i;
-    struct rcu_stress *p;
+    int i, rcu_stress_idx = 0;
+    struct rcu_stress *cp = atomic_read(&rcu_stress_current);
 
     rcu_register_thread();
-
     *(struct rcu_reader_data **)arg = &rcu_reader;
+
     while (goflag == GOFLAG_INIT) {
         g_usleep(1000);
     }
+
     while (goflag == GOFLAG_RUN) {
-        i = rcu_stress_idx + 1;
-        if (i >= RCU_STRESS_PIPE_LEN) {
-            i = 0;
+        struct rcu_stress *p;
+        rcu_stress_idx++;
+        if (rcu_stress_idx >= RCU_STRESS_PIPE_LEN) {
+            rcu_stress_idx = 0;
         }
-        p = &rcu_stress_array[i];
+        p = &rcu_stress_array[rcu_stress_idx];
+        /* catching up with ourselves would be a bug */
+        assert(p != cp);
         p->mbtest = 0;
         smp_mb();
         p->pipe_count = 0;
         p->mbtest = 1;
         atomic_rcu_set(&rcu_stress_current, p);
-        rcu_stress_idx = i;
+        cp = p;
+        /*
+         * New RCU structure is now live, update pipe counts on old
+         * ones.
+         */
         for (i = 0; i < RCU_STRESS_PIPE_LEN; i++) {
             if (i != rcu_stress_idx) {
                 rcu_stress_array[i].pipe_count++;
Signature · 1 line
2.20.1
#7 lore raw

PATCH 5/5 travis.yml: Test the s390-ccw build, too

In reply to Alex Bennée

From: Thomas Huth <[email protected]>

Since we can now use a s390x host on Travis, we can also build and test the s390-ccw bios images there. For this we have to make sure that roms/SLOF is checked out, too, and then move the generated *.img files to the right location before running the tests.

Message-Id: <[email protected]>

---
 .travis.yml | 10 ++++++++++
 1 file changed, 10 insertions(+)
.travis.yml +10 -0
index 6c0ec6cf69f..c0eeff9caa9 100644
@@ -508,6 +508,16 @@ matrix:
       env:
         - TEST_CMD="make check check-tcg V=1"
         - CONFIG="--disable-containers --target-list=${MAIN_SOFTMMU_TARGETS},s390x-linux-user"
+      script:
+        - ( cd ${SRC_DIR} ; git submodule update --init roms/SLOF )
+        - BUILD_RC=0 && make -j${JOBS} || BUILD_RC=$?
+        - |
+          if [ "$BUILD_RC" -eq 0 ] ; then
+              mv pc-bios/s390-ccw/*.img pc-bios/ ;
+              ${TEST_CMD} ;
+          else
+              $(exit $BUILD_RC);
+          fi
 
     # Release builds
     # The make-release script expect a QEMU version, so our tag must start with a 'v'.
Signature · 1 line
2.20.1
Reviewed-by Tested-by on v1 5/5
#8 lore raw

Re: [PATCH v1 5/5] travis.yml: Test the s390-ccw build, too

Quoted 26 lines · Alex Bennée

From: Thomas Huth <[email protected]>

Since we can now use a s390x host on Travis, we can also build and test the s390-ccw bios images there. For this we have to make sure that roms/SLOF is checked out, too, and then move the generated *.img files to the right location before running the tests.

Message-Id: <[email protected]>

---
  .travis.yml | 10 ++++++++++
  1 file changed, 10 insertions(+)
.travis.yml +3 -0
index 6c0ec6cf69f..c0eeff9caa9 100644
@@ -508,6 +508,16 @@ matrix:
        env:
          - TEST_CMD="make check check-tcg V=1"
          - CONFIG="--disable-containers --target-list=${MAIN_SOFTMMU_TARGETS},s390x-linux-user"
+      script:
+        - ( cd ${SRC_DIR} ; git submodule update --init roms/SLOF )
+        - BUILD_RC=0 && make -j${JOBS} || BUILD_RC=$?

.travis.yml matrix: · line 523

Quoted 10 lines
.travis.yml +7 -0
+        - |
+          if [ "$BUILD_RC" -eq 0 ] ; then
+              mv pc-bios/s390-ccw/*.img pc-bios/ ;
+              ${TEST_CMD} ;
+          else
+              $(exit $BUILD_RC);
+          fi
 
      # Release builds
      # The make-release script expect a QEMU version, so our tag must start with a 'v'.

Already reviewed/tested [*] with comment:

Maybe remove the trailing ", too" in subject...

[*] https://www.mail-archive.com/[email protected]/msg677641.html

Acked-by
#9 lore raw

Re: [PATCH v1 5/5] travis.yml: Test the s390-ccw build, too

Quoted 15 lines · On Wed, 12 Feb 2020 21:48:42 +0100 Philippe Mathieu-Daudé <[email protected]>…
Quoted 7 lines · Alex Bennée

From: Thomas Huth <[email protected]>

Since we can now use a s390x host on Travis, we can also build and test the s390-ccw bios images there. For this we have to make sure that roms/SLOF is checked out, too, and then move the generated *.img files to the right location before running the tests.

Quoted 6 lines

Message-Id: <[email protected]>

---
  .travis.yml | 10 ++++++++++
  1 file changed, 10 insertions(+)
Quoted 9 lines

Already reviewed/tested [*] with comment:

Maybe remove the trailing ", too" in subject...

[*] https://www.mail-archive.com/[email protected]/msg677641.html

Hm, I also gave an

#10 lore raw
In reply to Alex Bennée
Quoted 15 lines · Alex Bennée

Hi,

The current state of testing/next is mostly a rubber duck exercise as I tried to figure out what might cause the rcutorture test to fail. The only real practical change is asserting we are never about to reset and existing active RCU structure. So far I haven't seen the rcutorture crash occur since (although git stability seems to be a current problem for Travis).

Alex Bennée (4):
tests/tcg: include a skip runner for pauth3 with plugins tests/rcutorture: update usage hint tests/rcutorture: better document locking of stats tests/rcutorture: mild documenting refactor of update thread

Quoted 7 lines

Thomas Huth (1):
travis.yml: Test the s390-ccw build, too

 tests/rcutorture.c                        | 55 +++++++++++++++++------
 .travis.yml                               | 10 +++++
 tests/tcg/aarch64/Makefile.softmmu-target |  2 +
 3 files changed, 53 insertions(+), 14 deletions(-)

Ping?

I'm particularly interested in the rcutorture changes which so far have not yielded any:

ERROR:/home/travis/build/qemu/qemu/tests/rcutorture.c:384:gtest_stress: assertion failed (n_mberror == 0): (1 == 0)

in my various test trees.

Signature · 1 line
Alex Bennée