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

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

 



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@xxxxxxxxxxxxxxxxxx>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@xxxxxxxxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxxxxxx>
-Chris
_______________________________________________
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