All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe/tests: Fix the shrinker test compiler warnings.
@ 2024-10-04 12:39 Thomas Hellström
  2024-10-04 13:10 ` Matthew Auld
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Hellström @ 2024-10-04 12:39 UTC (permalink / raw)
  To: intel-xe; +Cc: Thomas Hellström, Nathan Chancellor, Matthew Auld

The xe_bo_shrink_kunit test has an uninitialized value and illegal
integer size conversions on 32-bit. Fix.

Reported-by: Nathan Chancellor <nathan@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@intel.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@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;
 	unsigned int interrupted = 0, successful = 0, count = 0;
 	struct rnd_state prng;
 	u64 rand_seed;
-- 
2.46.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/xe/tests: Fix the shrinker test compiler warnings.
  2024-10-04 12:39 [PATCH] drm/xe/tests: Fix the shrinker test compiler warnings Thomas Hellström
@ 2024-10-04 13:10 ` Matthew Auld
  2024-10-04 13:49   ` Thomas Hellström
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Auld @ 2024-10-04 13:10 UTC (permalink / raw)
  To: Thomas Hellström, intel-xe; +Cc: Nathan Chancellor

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@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@intel.com>
> Signed-off-by: Thomas Hellström <thomas.hellstrom@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@intel.com>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/xe/tests: Fix the shrinker test compiler warnings.
  2024-10-04 13:10 ` Matthew Auld
@ 2024-10-04 13:49   ` Thomas Hellström
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Hellström @ 2024-10-04 13:49 UTC (permalink / raw)
  To: Matthew Auld, intel-xe; +Cc: Nathan Chancellor

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@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@intel.com>
> > Signed-off-by: Thomas Hellström <thomas.hellstrom@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@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;


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-04 13:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-04 12:39 [PATCH] drm/xe/tests: Fix the shrinker test compiler warnings Thomas Hellström
2024-10-04 13:10 ` Matthew Auld
2024-10-04 13:49   ` Thomas Hellström

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.