DEFINE_XARRAY_FLAGS() statically initializes xa_lock. For an automatic local XArray, lockdep cannot use the lock address as a persistent class key and disables itself when the lock is acquired. Add ASSERT_STATIC_STORAGE() to the common declaration macro, covering DEFINE_XARRAY(), DEFINE_XARRAY_ALLOC() and DEFINE_XARRAY_ALLOC1() as well. Convert the automatic XArray in the userspace iteration test to xa_init(). Assisted-by: OpenAI Codex Signed-off-by: Yury Norov --- include/linux/xarray.h | 3 ++- tools/testing/radix-tree/iteration_check_2.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/xarray.h b/include/linux/xarray.h index be850174e802..9b9a5eea006d 100644 --- a/include/linux/xarray.h +++ b/include/linux/xarray.h @@ -321,7 +321,8 @@ struct xarray { * initialisation at compiletime instead of runtime. */ #define DEFINE_XARRAY_FLAGS(name, flags) \ - struct xarray name = XARRAY_INIT(name, flags) + struct xarray name = XARRAY_INIT(name, flags); \ + ASSERT_STATIC_STORAGE(name) /** * DEFINE_XARRAY() - Define an XArray. diff --git a/tools/testing/radix-tree/iteration_check_2.c b/tools/testing/radix-tree/iteration_check_2.c index aac5c50a3674..f798603a6f28 100644 --- a/tools/testing/radix-tree/iteration_check_2.c +++ b/tools/testing/radix-tree/iteration_check_2.c @@ -54,9 +54,11 @@ static void *throbber(void *arg) void iteration_test2(unsigned test_duration) { pthread_t threads[2]; - DEFINE_XARRAY(array); + struct xarray array; int i; + xa_init(&array); + printv(1, "Running iteration test 2 for %d seconds\n", test_duration); test_complete = false; -- 2.53.0