[Intel-gfx] [PATCH i-g-t 1/3] lib/igt_dummyload: Introduce igt_spin_reset

Chris Wilson chris at chris-wilson.co.uk
Tue Apr 23 14:10:39 UTC 2019


Quoting Mika Kuoppala (2019-04-23 15:00:36)
> Libify resetting a spin for reuse.
> 
> v2: use also in perf_pmu
> v3: s/cmd_spin/cmd_precondition
> 
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Signed-off-by: Mika Kuoppala <mika.kuoppala at linux.intel.com>
> ---
>  lib/igt_dummyload.c           | 20 ++++++++++++++++++++
>  lib/igt_dummyload.h           |  2 ++
>  tests/i915/gem_exec_latency.c | 19 ++++---------------
>  tests/i915/gem_sync.c         | 34 ++++++++++++++--------------------
>  tests/perf_pmu.c              | 10 +---------
>  5 files changed, 41 insertions(+), 44 deletions(-)
> 
> diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
> index 1d57a53c..12465024 100644
> --- a/lib/igt_dummyload.c
> +++ b/lib/igt_dummyload.c
> @@ -260,6 +260,8 @@ emit_recursive_batch(igt_spin_t *spin,
>         obj[SCRATCH].flags = EXEC_OBJECT_PINNED;
>         obj[BATCH].flags = EXEC_OBJECT_PINNED;
>  
> +       spin->cmd_precondition = *spin->batch;
> +
>         return fence_fd;
>  }
>  
> @@ -366,6 +368,24 @@ void igt_spin_set_timeout(igt_spin_t *spin, int64_t ns)
>         spin->timer = timer;
>  }
>  
> +/**
> + * igt_spin_reset:
> + * @spin: spin state from igt_spin_new()
> + *
> + * Reset the state of spin, allowing its reuse.
> + */
> +void igt_spin_reset(igt_spin_t *spin)
> +{
> +       if (!spin)
> +               return;

Do we need to be defensive here? Being kind for cleanup, yes, but this
is runtime and users should have a valid spinner.

Other than that nit,
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the Intel-gfx mailing list