Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Summers, Stuart" <stuart.summers@intel.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"Vishwanathapura,
	Niranjana" <niranjana.vishwanathapura@intel.com>
Subject: Re: [PATCH 2/3] lib/xe/xe_spin: Add option for QUEUE_TIMESTAMP
Date: Thu, 7 May 2026 19:23:50 +0000	[thread overview]
Message-ID: <81b70498fab2a302ad8c131ef9d589dd7e39c230.camel@intel.com> (raw)
In-Reply-To: <20260506183137.51479-7-niranjana.vishwanathapura@intel.com>

On Wed, 2026-05-06 at 11:31 -0700, Niranjana Vishwanathapura wrote:
> From: gta <gta@DUT4637NVLP.fm.intel.com>
> 
> In multi-queue case, CTX_TIMESTAMP register does not
> provide the running time of individual queues of a group.
> Provide the option for spinner to read timestamp from the
> QUEUE_TIMESTAMP registers instead which is useful in the
> multi-queue scenarios.
> 
> Signed-off-by: Niranjana Vishwanathapura
> <niranjana.vishwanathapura@intel.com>
> ---
>  lib/xe/xe_spin.c | 9 +++++----
>  lib/xe/xe_spin.h | 2 ++
>  2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/xe/xe_spin.c b/lib/xe/xe_spin.c
> index 14952ca90e..8743107898 100644
> --- a/lib/xe/xe_spin.c
> +++ b/lib/xe/xe_spin.c
> @@ -25,7 +25,8 @@
>  #define MI_LRI_CS_MMIO                         (1 << 19)
>  #define MI_LRR_DST_CS_MMIO                     (1 << 19)
>  #define MI_LRR_SRC_CS_MMIO                     (1 << 18)
> -#define CTX_TIMESTAMP 0x3a8
> +#define CTX_TIMESTAMP          0x3a8
> +#define QUEUE_TIMESTAMP                0x4c0
>  #define CS_GPR(x) (0x600 + 8 * (x))
>  
>  enum { START_TS, NOW_TS };
> @@ -67,7 +68,7 @@ void xe_spin_init(struct xe_spin *spin, struct
> xe_spin_opts *opts)
>                 spin->batch[b++] = CS_GPR(START_TS) + 4;
>                 spin->batch[b++] = 0;
>                 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++] = opts->use_queue_timestamp ?
> QUEUE_TIMESTAMP : CTX_TIMESTAMP;

I see in [1] we are programming this register in the ring also. Will
this cause issues if we overwrite this here? I see we do the same thing
for the context timestamp, so probably no issue here. But it would be
nice to document somehow the expected interaction between the kernel
ring programming and the user batch programming if any.

[1]:
https://patchwork.freedesktop.org/patch/723502/?series=164654&rev=5

>                 spin->batch[b++] = CS_GPR(START_TS);
>         }
>  
> @@ -83,7 +84,7 @@ void xe_spin_init(struct xe_spin *spin, struct
> xe_spin_opts *opts)
>  
>         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++] = opts->use_queue_timestamp ?
> QUEUE_TIMESTAMP : CTX_TIMESTAMP;
>                 spin->batch[b++] = CS_GPR(NOW_TS);
>  
>                 spin->batch[b++] = MI_STORE_REGISTER_MEM_GEN8 |
> MI_SRM_CS_MMIO;
> @@ -97,7 +98,7 @@ void xe_spin_init(struct xe_spin *spin, struct
> xe_spin_opts *opts)
>                 spin->batch[b++] = CS_GPR(NOW_TS) + 4;
>                 spin->batch[b++] = 0;
>                 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++] = opts->use_queue_timestamp ?
> QUEUE_TIMESTAMP : CTX_TIMESTAMP;
>                 spin->batch[b++] = CS_GPR(NOW_TS);
>  
>                 /* delta = now - start; inverted to match COND_BBE */
> diff --git a/lib/xe/xe_spin.h b/lib/xe/xe_spin.h
> index db0febd8ab..75a6ada420 100644
> --- a/lib/xe/xe_spin.h
> +++ b/lib/xe/xe_spin.h
> @@ -51,6 +51,7 @@ struct xe_spin_mem_copy {
>   * @multi_queue_switch_on_wait: Add a SEMAPHORE_WAIT multi-queue
> switch point
>   * and have the queue switch only happen if waiting on the
> semaphore.
>   * @ctx_ticks: number of ticks after which spinner is stopped,
> applied if > 0
> + * @use_queue_timestamp: Use QUEUE_TIMESTAMP register instead of
> CTX_TIMESTAMP
>   * @mem_copy: container of objects used for memory copy (optional)
>   *
>   * Used to initialize struct xe_spin spinner behavior.
> @@ -62,6 +63,7 @@ struct xe_spin_opts {
>         bool multi_queue_switch_on_wait;
>         uint32_t ctx_ticks;
>         bool write_timestamp;
> +       bool use_queue_timestamp;
>         struct xe_spin_mem_copy *mem_copy;
>  };
>  


  reply	other threads:[~2026-05-07 19:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06 18:31 [PATCH 0/3] tests/intel/xe_exec_reset: Validate multi-queue timestamping Niranjana Vishwanathapura
2026-05-06 18:31 ` [PATCH 1/3] lib/xe/xe_spin: Enhance multi-queue switch option Niranjana Vishwanathapura
2026-05-07  0:50   ` Wang, X
2026-05-07 19:15   ` Summers, Stuart
2026-05-07 20:11     ` Niranjana Vishwanathapura
2026-05-06 18:31 ` [PATCH 2/3] lib/xe/xe_spin: Add option for QUEUE_TIMESTAMP Niranjana Vishwanathapura
2026-05-07 19:23   ` Summers, Stuart [this message]
2026-05-07 19:41     ` Umesh Nerlige Ramappa
2026-05-07 20:05       ` Summers, Stuart
2026-05-07 20:07       ` Niranjana Vishwanathapura
2026-05-06 18:31 ` [PATCH 3/3] tests/intel/xe_exec_reset: Add multi-queue long spin tests Niranjana Vishwanathapura
2026-05-07 19:37   ` Summers, Stuart
2026-05-07 20:11     ` Niranjana Vishwanathapura

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81b70498fab2a302ad8c131ef9d589dd7e39c230.camel@intel.com \
    --to=stuart.summers@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=niranjana.vishwanathapura@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox