[PATCH] drm/xe/tests: Fix the shrinker test compiler warnings.

Thomas Hellström thomas.hellstrom at linux.intel.com
Fri Oct 4 13:49:04 UTC 2024


On Fri, 2024-10-04 at 14:10 +0100, Matthew Auld wrote:
> On 04/10/2024 13:39, Thomas Hellström wrote:
> > The xe_bo_shrink_kunit test has an uninitialized value and illegal
> > integer size conversions on 32-bit. Fix.
> > 
> > Reported-by: Nathan Chancellor <nathan at kernel.org>
> > Closes:
> > https://lore.kernel.org/20240913195649.GA61514@thelio-3990X/
> > Fixes: 5a90b60db5e6 ("drm/xe: Add a xe_bo subtest for shrinking /
> > swapping")
> > Cc: Matthew Auld <matthew.auld at intel.com>
> > Signed-off-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>
> > ---
> >   drivers/gpu/drm/xe/tests/xe_bo.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/xe/tests/xe_bo.c
> > b/drivers/gpu/drm/xe/tests/xe_bo.c
> > index 7d3fd720478b..1562c08aaf34 100644
> > --- a/drivers/gpu/drm/xe/tests/xe_bo.c
> > +++ b/drivers/gpu/drm/xe/tests/xe_bo.c
> > @@ -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,
> Reviewed-by: Matthew Auld <matthew.auld at intel.com>

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


> 
> >   	unsigned int interrupted = 0, successful = 0, count = 0;
> >   	struct rnd_state prng;
> >   	u64 rand_seed;



More information about the Intel-xe mailing list