Re: [igt-dev] [PATCH i-g-t] i915/gem_mmap_gtt: Race mmap offset generation against closure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 26, 2019 at 04:20:00PM +0100, Chris Wilson wrote:
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> Cc: Abdiel Janulgue <abdiel.janulgue@xxxxxxxxxxxxxxx>
> ---
>  tests/i915/gem_mmap_gtt.c | 98 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 98 insertions(+)
> 
> diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c
> index 8eff91850..81068f7d1 100644
> --- a/tests/i915/gem_mmap_gtt.c
> +++ b/tests/i915/gem_mmap_gtt.c
> @@ -26,6 +26,7 @@
>   */
>  
>  #include <unistd.h>
> +#include <stdatomic.h>
>  #include <stdlib.h>
>  #include <stdio.h>
>  #include <string.h>
> @@ -360,6 +361,99 @@ test_isolation(int i915)
>  	igt_assert(ptr == MAP_FAILED);
>  }
>  
> +static void
> +test_close_race(int i915)
> +{
> +	const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
> +	uint32_t *handles;
> +
> +	handles = mmap64(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
> +	igt_assert(handles != MAP_FAILED);
> +
> +	igt_fork(child, ncpus) {
> +		do {
> +			struct drm_i915_gem_mmap_gtt mmap_arg = {};
> +			int i = 1 + random() % ncpus;
> +			uint32_t old;
> +
> +			mmap_arg.handle = gem_create(i915, 4096);
> +			old = atomic_exchange(&handles[i], mmap_arg.handle);

../tests/i915/gem_mmap_gtt.c:380:10: error: address argument to atomic operation must be a pointer to _Atomic type ('uint32_t *' (aka 'unsigned int *') invalid)
                        old = atomic_exchange(&handles[i], mmap_arg.handle);
                              ^               ~~~~~~~~~~~
/usr/lib64/clang/8.0.0/include/stdatomic.h:137:42: note: expanded from macro 'atomic_exchange'
#define atomic_exchange(object, desired) __c11_atomic_exchange(object, desired, __ATOMIC_SEQ_CST)
                                         ^                     ~~~~~~
../tests/i915/gem_mmap_gtt.c:423:10: error: address argument to atomic operation must be a pointer to _Atomic type ('uint32_t *' (aka 'unsigned int *') invalid)
                        old = atomic_exchange(&handles[i],
                              ^               ~~~~~~~~~~~
/usr/lib64/clang/8.0.0/include/stdatomic.h:137:42: note: expanded from macro 'atomic_exchange'
#define atomic_exchange(object, desired) __c11_atomic_exchange(object, desired, __ATOMIC_SEQ_CST)
                                         ^                     ~~~~~~
2 errors generated.

https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/535592

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux