]> sourceware.org Git - systemtap.git/commitdiff
Update systemtap.base/cast.stp test to work with newer kernels master
authorWilliam Cohen <wcohen@redhat.com>
Wed, 9 Oct 2024 01:43:31 +0000 (21:43 -0400)
committerWilliam Cohen <wcohen@redhat.com>
Wed, 9 Oct 2024 01:43:31 +0000 (21:43 -0400)
Linux kernel commit ec1d281923cf changed the usage field in the
task_struct from atomic_t to refcount_t.  The internal fields of the
two types are different.  Updated the cast.stp test to use the
appropriate type and field regardless which type is being used.

testsuite/systemtap.base/cast.stp

index 0e191eb2337f77ade954fd6795008cd7e04eabc4..52f43fd4634beea22f28969c4c495ec12d6860d4 100644 (file)
@@ -33,9 +33,14 @@ probe begin
         printf("execname \"%s\" != \"%s\"\n", name, cast_name)
 
     // Compare usage counter values through a struct address
-    usage = @cast(curr, "task_struct", "kernel")->usage->counter
     pusage = & @cast(curr, "task_struct", "kernel")->usage
-    cast_usage = @cast(pusage, "atomic_t", "kernel")->counter
+    if (@defined(pusage->counter)) {
+       usage = @cast(curr, "task_struct", "kernel")->usage->counter
+       cast_usage = @cast(pusage, "atomic_t", "kernel")->counter
+      } else {
+       usage = @cast(curr, "task_struct", "kernel")->usage->refs->counter
+       cast_usage = @cast(pusage, "refcount_t", "kernel")->refs->counter
+      }
     if (usage == cast_usage)
         println("usage OK")
     else
This page took 0.031053 seconds and 5 git commands to generate.