drm/xe/tests: Fix the shrinker test compiler warnings.
Subsystems (2)
Thomas Hellström
maintainerPATCH 1/1 drm/xe/tests: Fix the shrinker test compiler warnings.
The xe_bo_shrink_kunit test has an uninitialized value and illegal integer size conversions on 32-bit. Fix.
--- drivers/gpu/drm/xe/tests/xe_bo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/tests/xe_bo.c +1 -1
@@ -440,7 +440,7 @@ static int shrink_test_run_device(struct xe_device *xe)LIST_HEAD (bos);struct xe_bo_link *link, *next;struct sysinfo si; -size_t ram, ram_and_swap, purgeable, alloced, to_alloc, limit; +u64 ram, ram_and_swap, purgeable =0 , alloced, to_alloc, limit;unsigned int interrupted =0 , successful =0 , count =0 ;struct rnd_state prng;u64 rand_seed;
Signature · 1 line
2.46.0
Quoted 17 lines · Thomas Hellström
The
xe_bo_shrink_kunittest has an uninitialized value and illegal integer size conversions on 32-bit. Fix.Reported-by Nathan Chancellor <[email protected]>Fixes 5a90b60db5e6 ("drm/xe: Add a xe_bo subtest for shrinking / swapping")Cc Matthew Auld <[email protected]>Signed-off-by Thomas Hellström <[email protected]>--- drivers/gpu/drm/xe/tests/xe_bo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/xe/tests/xe_bo.c +0
-0
drivers/gpu/drm/xe/tests/xe_bo.c static int shrink_test_run_device(struct xe_device *xe) · line 443
Quoted 5 lines
drivers/gpu/drm/xe/tests/xe_bo.c +1
-1@@ -440,7 +440,7 @@ static int shrink_test_run_device(struct xe_device *xe)LIST_HEAD (bos);struct xe_bo_link *link, *next;struct sysinfo si; -size_t ram, ram_and_swap, purgeable, alloced, to_alloc, limit; +u64 ram, ram_and_swap, purgeable =0 , alloced, to_alloc, limit;
Maybe just double check that this doesn't now introduce 64b division errors on 32b arch.
Assuming it doesn't,
Quoted 3 lines
drivers/gpu/drm/xe/tests/xe_bo.c +0
-0unsigned int interrupted =0 , successful =0 , count =0 ;struct rnd_state prng;u64 rand_seed;
Thomas Hellström
maintainerQuoted 33 lines · Matthew Auld
Quoted 20 lines · Thomas Hellström
The
xe_bo_shrink_kunittest has an uninitialized value and illegal integer size conversions on 32-bit. Fix.Reported-by Nathan Chancellor <[email protected]>Closes:
https://lore.kernel.org/20240913195649.GA61514@thelio-3990X/Fixes 5a90b60db5e6 ("drm/xe: Add a xe_bo subtest for shrinking /swapping")
Cc Matthew Auld <[email protected]>Signed-off-by Thomas Hellström <[email protected]>---
drivers/gpu/drm/xe/tests/xe_bo.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/xe/tests/xe_bo.c +0
-0drivers/gpu/drm/xe/tests/xe_bo.c static int shrink_test_run_device(struct · line 446
Quoted 8 lines
drivers/gpu/drm/xe/tests/xe_bo.c +1
-1@@ -440,7 +440,7 @@ static int shrink_test_run_device(struct xe_device *xe) LIST_HEAD(bos); struct xe_bo_link *link, *next; struct sysinfo si; -size_t ram, ram_and_swap, purgeable, alloced, to_alloc, limit; +u64 ram, ram_and_swap, purgeable =0 , alloced, to_alloc, limit;Maybe just double check that this doesn't now introduce 64b division errors on 32b arch.
Quoted 2 lines
Assuming it doesn't,
Reviewed-by Matthew Auld <[email protected]>
Good point. While it compiles without missing symbol on gcc ARCH=i386 it may well complain on other compilers / archs. I'll respin to use div64_u64
/Thomas
Quoted 4 lines
Quoted 4 lines
unsigned int interrupted = 0, successful = 0, count = 0; struct
rnd_stateprng;
u64rand_seed;