Re: [PATCH i-g-t 1/3] i915/gem_eio: Race kms on/off vs reset

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

 



On Wed, Sep 11, 2019 at 11:14:59AM +0100, Chris Wilson wrote:
> On older platforms, performing a GPU reset clobbers the display.
> Exercise the interactions between reset/wedge and the display and
> hopefully prevent any races creeping in.
> 
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> ---
>  tests/i915/gem_eio.c | 79 ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 79 insertions(+)
> 
> diff --git a/tests/i915/gem_eio.c b/tests/i915/gem_eio.c
> index 9b086a039..e0213c76c 100644
> --- a/tests/i915/gem_eio.c
> +++ b/tests/i915/gem_eio.c
> @@ -42,6 +42,8 @@
>  
>  #include "igt.h"
>  #include "igt_device.h"
> +#include "igt_fb.h"
> +#include "igt_kms.h"
>  #include "igt_stats.h"
>  #include "igt_sysfs.h"
>  #include "sw_sync.h"
> @@ -813,6 +815,67 @@ static void test_reset_stress(int fd, unsigned int flags)
>  	gem_context_destroy(fd, ctx0);
>  }
>  
> +/*
> + * Modesetting vs wedged
> + */
> +
> +static void display_helper(igt_display_t *dpy, int *done)
> +{
> +	const int commit = dpy->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY;
> +	struct igt_fb fb = {};
> +
> +	while (!READ_ONCE(*done)) {
> +		drmModeModeInfoPtr mode;
> +		igt_plane_t *primary;
> +		igt_output_t *output;
> +		int pipe;
> +
> +		pipe = rand() % dpy->n_pipes;

I guess this ends up doing nothing if we get the same pipe twice in a
row? Hmm, I guess it does actually do something but since nothing
significant would change the kernel likely just downgrades it to a
fastset. But maybe that's fine.

There are some reset vs. modeset type of tests in kms_flip, but those
are rather more carefully sequenced so they are probably not so great
at finding new races.

Reviewed-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

> +		output = igt_get_single_output_for_pipe(dpy, pipe);
> +		if (!output)
> +			continue;
> +
> +		igt_output_set_pipe(output, pipe);
> +		mode = igt_output_get_mode(output);
> +
> +		if (fb.width != mode->hdisplay || fb.height != mode->vdisplay) {
> +			igt_remove_fb(dpy->drm_fd, &fb);
> +			igt_create_pattern_fb(dpy->drm_fd,
> +					      mode->hdisplay, mode->vdisplay,
> +					      DRM_FORMAT_XRGB8888,
> +					      LOCAL_I915_FORMAT_MOD_X_TILED,
> +					      &fb);
> +		}
> +
> +		primary = igt_output_get_plane_type(output,
> +						    DRM_PLANE_TYPE_PRIMARY);
> +		igt_plane_set_fb(primary, &fb);
> +
> +		igt_display_commit2(dpy, commit);
> +		igt_display_reset(dpy);
> +	}
> +
> +	igt_remove_fb(dpy->drm_fd, &fb);
> +}
> +
> +static void test_kms(int i915, igt_display_t *dpy)
> +{
> +	int *shared;
> +
> +	shared = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
> +	igt_assert(shared != MAP_FAILED);
> +
> +	igt_fork(child, 1)
> +		display_helper(dpy, shared);
> +
> +	test_reset_stress(i915, 0);
> +	test_reset_stress(i915, TEST_WEDGE);
> +
> +	*shared = 1;
> +	igt_waitchildren();
> +	munmap(shared, 4096);
> +}
> +
>  static int fd = -1;
>  
>  static void
> @@ -906,4 +969,20 @@ igt_main
>  			}
>  		}
>  	}
> +
> +	igt_subtest_group {
> +		igt_display_t display = {
> +			.drm_fd = -1, .n_pipes = IGT_MAX_PIPES
> +		};
> +
> +		igt_fixture {
> +			igt_device_set_master(fd);
> +
> +			igt_display_require(&display, fd);
> +			igt_display_require_output(&display);
> +		}
> +
> +		igt_subtest("kms")
> +			test_kms(fd, &display);
> +	}
>  }
> -- 
> 2.23.0

-- 
Ville Syrjälä
Intel
_______________________________________________
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