kcsan: Support reporting scoped read-write access type
authorMarco Elver <elver@google.com>
Mon, 9 Aug 2021 11:25:15 +0000 (13:25 +0200)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 13 Sep 2021 23:41:19 +0000 (16:41 -0700)
Support generating the string representation of scoped read-write
accesses for completeness. They will become required in planned changes.

Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/kcsan/kcsan_test.c
kernel/kcsan/report.c

index a3b1242..6607292 100644 (file)
@@ -210,10 +210,12 @@ static bool report_matches(const struct expect_report *r)
                                                        "read-write" :
                                                        "write") :
                                               "read");
+               const bool is_atomic = (ty & KCSAN_ACCESS_ATOMIC);
+               const bool is_scoped = (ty & KCSAN_ACCESS_SCOPED);
                const char *const access_type_aux =
-                       (ty & KCSAN_ACCESS_ATOMIC) ?
-                                     " (marked)" :
-                                     ((ty & KCSAN_ACCESS_SCOPED) ? " (scoped)" : "");
+                               (is_atomic && is_scoped)        ? " (marked, scoped)"
+                               : (is_atomic                    ? " (marked)"
+                                  : (is_scoped                 ? " (scoped)" : ""));
 
                if (i == 1) {
                        /* Access 2 */
index 4849cde..fc15077 100644 (file)
@@ -247,6 +247,10 @@ static const char *get_access_type(int type)
                return "write (scoped)";
        case KCSAN_ACCESS_SCOPED | KCSAN_ACCESS_WRITE | KCSAN_ACCESS_ATOMIC:
                return "write (marked, scoped)";
+       case KCSAN_ACCESS_SCOPED | KCSAN_ACCESS_COMPOUND | KCSAN_ACCESS_WRITE:
+               return "read-write (scoped)";
+       case KCSAN_ACCESS_SCOPED | KCSAN_ACCESS_COMPOUND | KCSAN_ACCESS_WRITE | KCSAN_ACCESS_ATOMIC:
+               return "read-write (marked, scoped)";
        default:
                BUG();
        }