[PATCH i-g-t 2/3] lib/xe/xe_spin: Add support to store/write ctx time
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Thu Mar 21 09:57:33 UTC 2024
On Wed, Mar 20, 2024 at 09:24:29PM +0530, sai.gowtham.ch at intel.com wrote:
> From: Sai Gowtham Ch <sai.gowtham.ch at intel.com>
>
> support to Store or write ctx time stamps when a spinner is
> triggers, which makes user to understand if spinner is still
> submitting workload to a context.
Maybe:
"Store timestamp on demand in the spinner to allow user code verify
is it still running."?
Rest is ok, with above commit msg fixed:
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
--
Zbigniew
>
> Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> Signed-off-by: Sai Gowtham Ch <sai.gowtham.ch at intel.com>
> ---
> lib/xe/xe_spin.c | 12 ++++++++++++
> lib/xe/xe_spin.h | 2 ++
> 2 files changed, 14 insertions(+)
>
> diff --git a/lib/xe/xe_spin.c b/lib/xe/xe_spin.c
> index 1ca54ea19..2c9b5848a 100644
> --- a/lib/xe/xe_spin.c
> +++ b/lib/xe/xe_spin.c
> @@ -72,6 +72,7 @@ void xe_spin_init(struct xe_spin *spin, struct xe_spin_opts *opts)
> uint64_t end_addr = opts->addr + offsetof(struct xe_spin, end);
> uint64_t ticks_delta_addr = opts->addr + offsetof(struct xe_spin, ticks_delta);
> uint64_t pad_addr = opts->addr + offsetof(struct xe_spin, pad);
> + uint64_t timestamp_addr = opts->addr + offsetof(struct xe_spin, timestamp);
> int b = 0;
>
> spin->start = 0;
> @@ -98,6 +99,17 @@ void xe_spin_init(struct xe_spin *spin, struct xe_spin_opts *opts)
> if (opts->preempt)
> spin->batch[b++] = (0x5 << 23);
>
> + if (opts->write_timestamp) {
> + spin->batch[b++] = MI_LOAD_REGISTER_REG | MI_LRR_DST_CS_MMIO | MI_LRR_SRC_CS_MMIO;
> + spin->batch[b++] = CTX_TIMESTAMP;
> + spin->batch[b++] = CS_GPR(NOW_TS);
> +
> + spin->batch[b++] = MI_STORE_REGISTER_MEM_GEN8 | MI_SRM_CS_MMIO;
> + spin->batch[b++] = CS_GPR(NOW_TS);
> + spin->batch[b++] = timestamp_addr;
> + spin->batch[b++] = timestamp_addr >> 32;
> + }
> +
> if (opts->ctx_ticks) {
> spin->batch[b++] = MI_LOAD_REGISTER_IMM(1) | MI_LRI_CS_MMIO;
> spin->batch[b++] = CS_GPR(NOW_TS) + 4;
> diff --git a/lib/xe/xe_spin.h b/lib/xe/xe_spin.h
> index 87b7c1716..d65adb05c 100644
> --- a/lib/xe/xe_spin.h
> +++ b/lib/xe/xe_spin.h
> @@ -29,6 +29,7 @@ struct xe_spin_opts {
> uint64_t addr;
> bool preempt;
> uint32_t ctx_ticks;
> + bool write_timestamp;
> };
>
> /* Mapped GPU object */
> @@ -39,6 +40,7 @@ struct xe_spin {
> uint32_t end;
> uint32_t ticks_delta;
> uint64_t exec_sync;
> + uint32_t timestamp;
> };
>
> igt_spin_t *xe_spin_create(int fd, const struct igt_spin_factory *opt);
> --
> 2.39.1
>
More information about the igt-dev
mailing list