1. 27 Apr, 2022 1 commit
  2. 05 Apr, 2022 2 commits
    • David Gow's avatar
      kunit: Make kunit_remove_resource() idempotent · 59729170
      David Gow authored
      The kunit_remove_resource() function is used to unlink a resource from
      the list of resources in the test, making it no longer show up in
      kunit_find_resource().
      
      However, this could lead to a race condition if two threads called
      kunit_remove_resource() on the same resource at the same time: the
      resource would be removed from the list twice (causing a crash at the
      second list_del()), and the refcount for the resource would be
      decremented twice (instead of once, for the reference held by the
      resource list).
      
      Fix both problems, the first by using list_del_init(), and the second by
      checking if the resource has already been removed using list_empty(),
      and only decrementing its refcount if it has not.
      
      Also add a KUnit test for the kunit_remove_resource() function which
      tests this behaviour.
      Reported-by: default avatarDaniel Latypov <dlatypov@google.com>
      Signed-off-by: default avatarDavid Gow <davidgow@google.com>
      Reviewed-by: default avatarBrendan Higgins <brendanhiggins@google.com>
      Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      59729170
    • David Gow's avatar
      list: test: Test the hlist structure · 1ff522b6
      David Gow authored
      Add KUnit tests to the hlist linked-list structure which is used by
      hashtables. This should give coverage of every function and macro in
      list.h, as well as (combined with the KUnit tests for the hash
      functions) get very close to having tests for the hashtable structure.
      
      The tests here mirror the existing list tests, and are found in a new
      suite titled 'hlist'.
      Signed-off-by: default avatarDavid Gow <davidgow@google.com>
      Reviewed-by: default avatarBrendan Higgins <brendanhiggins@google.com>
      Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      1ff522b6
  3. 04 Apr, 2022 18 commits
  4. 03 Apr, 2022 8 commits
  5. 02 Apr, 2022 11 commits