[igt-dev] [PATCH i-g-t] lib: Silence Valgrind warning in synce_fence_status

Chris Wilson chris at chris-wilson.co.uk
Thu Jun 27 13:06:24 UTC 2019


Quoting Tvrtko Ursulin (2019-06-27 13:55:21)
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> Let Valgrind know the ioctl initializes the passed in info block to reduce
> the noise while debugging.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
>  lib/sw_sync.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/lib/sw_sync.c b/lib/sw_sync.c
> index f208603312c2..73f3f7015d9d 100644
> --- a/lib/sw_sync.c
> +++ b/lib/sw_sync.c
> @@ -41,6 +41,15 @@
>  #include "drmtest.h"
>  #include "ioctl_wrappers.h"
>  
> +#ifdef HAVE_VALGRIND
> +#include <valgrind/valgrind.h>
> +#include <valgrind/memcheck.h>
> +
> +#define VG(x) x
> +#else
> +#define VG(x) do {} while (0)
> +#endif
> +
>  /**
>   * SECTION:sw_sync
>   * @short_description: Software sync (fencing) support library
> @@ -218,6 +227,8 @@ int sync_fence_status(int fence)
>         if (file_info.num_fences != 1)
>                 return -EINVAL;

^ Otherwise known as lets pretend we never saw that kernel bug.
https://patchwork.freedesktop.org/patch/311883/?series=62278&rev=1

An example of why igt should not be filtering the kernel.

Just complaining because Petri found a bug in one of tests that is being
blocked by no one reviewing the kernel fix that is blocking fixing the
library to allow the bug fix in the test.

> +       VG(VALGRIND_MAKE_MEM_DEFINED(&fence_info, sizeof(fence_info)));

More fun would be to

struct sync_fence_info fence_info = { .status = -ENOSYS };

So that valgrind knows it is initialised and we reliably report an error
if the kernel fails to fill in the struct.
-Chris


More information about the igt-dev mailing list