From: "Bai, Zongyao" <zongyao.bai@intel.com>
To: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <jia.yao@intel.com>,
<matthew.brost@intel.com>, Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [PATCH v5 0/4] drm/xe/forcewake: add delayed-release optimization
Date: Thu, 3 Sep 2026 16:19:01 -0700 [thread overview]
Message-ID: <14d20a60-29f1-40f3-83f5-e8b6eaec81db@intel.com> (raw)
In-Reply-To: <apnDogYw4G6bXNlh@soc-5CG1426VCC.clients.intel.com>
On 9/3/2026 11:59 AM, Umesh Nerlige Ramappa wrote:
> Hi Zongyao,
>
> On Thu, Aug 13, 2026 at 12:06:50AM +0000, Zongyao Bai wrote:
>> Engine-cycle queries used by tools such as VTune and PTI can arrive in
>> bursts. Releasing forcewake immediately after every query makes the next
>> query issue another wake request and wait for its ACK.
>>
>> Add an opt-in delayed-release path that keeps an idle forcewake domain
>> awake for a configurable interval, allowing a subsequent engine-cycle
>> query to reuse it. Other forcewake users retain the existing immediate
>> release behavior. The default hold interval is 100 us and can be changed
>> through configfs before binding the device.
>>
>> The series also synchronizes engine-cycle queries with unplug and
>> flushes
>> pending delayed releases before suspend, shutdown, remove, and probe
>> unwind, ensuring timer callbacks cannot access MMIO after power-off or
>> teardown.
>>
>> On BMG, this reduced the Level Zero timestamp median from approximately
>> 48.5 us to 9.4 us.
>
> Can you please add some more info here on what this measurement is and
> how this is affecting the VTune/PTI use cases? In other words, what
> breaks if we don't have these changes?
>
> The purpose of engine_cycles query is just to capture CPU and GPU
> timestamps as close to each other as possible and then the user would
> use that to map the two timelines in whatever they are trying to
> correlate, so I am interested in understanding the use case that this
> is improving.
>
> Thanks,
> Umesh
Hi Umesh,
The main issue without this patch is the latency introduced when the XE
forcewake domain goes to sleep immediately after a query completes.
In VTune/PTI workloads, APIs such as zeDeviceGetGlobalTimestamps() may
be called at a very high frequency to correlate CPU and GPU timelines.
It's not a one time query.
Since the forcewake domain is released right after the MMIO read, the
next query often arrives after only a very short interval and must go
through the full forcewake acquisition and MMIO read sequence again.
On bmg, we measured that this additional forcewake overhead can be
around 48.5 µs, even with RC6 disabled.
This patch introduces a delayed forcewake release for the engine-cycle
query path:DRM_XE_DEVICE_QUERY_ENGINE_CYCLES;
Instead of immediately releasing the forcewake domain after the read, we
keep it active for a configurable period.
Currently 100 µs by default, chosen as a reasonable default balancing
power and reuse; tunable via configfs.
With this change, after a zeDeviceGetGlobalTimestamps() call, the
forcewake domain remains active for a short period.
If another query arrives within that window, it can access the registers
directly without repeating the forcewake sequence.
The timer is then re-armed for subsequent accesses.
For the forcewake state transitions, please refer to the diagram in:
drivers/gpu/drm/xe/xe_force_wake_types.h
And more details can be found in GSD-11225.
Thanks,
Zongyao
>>
>> v5:
>> - Split the original patch into four patches: unplug synchronization,
>> delayed-release infrastructure, power-boundary flushing, and opt-in
>> enablement/configuration.
>> - Preserve a newer hold interval when an older timer callback is
>> running,
>> and settle an outstanding sleep ACK before waking a domain again.
>> (Sashiko, Matt)
>> - Synchronously cancel delayed-release timers during forcewake cleanup.
>> (Sashiko, Matt)
>> - Flush delayed releases during shutdown, device removal, and
>> post-registration probe unwind in addition to system/runtime suspend.
>> (Matt)
>>
>> Zongyao Bai (4):
>> drm/xe/forcewake: synchronize engine-cycle access with unplug
>> drm/xe/forcewake: add delayed-release state machine
>> drm/xe/forcewake: flush delayed release at power boundaries
>> drm/xe/forcewake: enable configurable delayed forcewake release
>>
>> drivers/gpu/drm/xe/xe_configfs.c | 72 ++++++++
>> drivers/gpu/drm/xe/xe_configfs.h | 5 +
>> drivers/gpu/drm/xe/xe_defaults.h | 1 +
>> drivers/gpu/drm/xe/xe_device.c | 16 +-
>> drivers/gpu/drm/xe/xe_device_types.h | 3 +
>> drivers/gpu/drm/xe/xe_force_wake.c | 211 +++++++++++++++++++++--
>> drivers/gpu/drm/xe/xe_force_wake.h | 46 ++++-
>> drivers/gpu/drm/xe/xe_force_wake_types.h | 68 +++++++-
>> drivers/gpu/drm/xe/xe_gt.c | 12 +-
>> drivers/gpu/drm/xe/xe_query.c | 36 +++-
>> 10 files changed, 437 insertions(+), 33 deletions(-)
>>
>> --
>> 2.43.0
>>
next prev parent reply other threads:[~2026-09-03 23:19 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-01 21:38 [PATCH] drm/xe/forcewake: add delayed-release optimization Zongyao Bai
2026-06-01 22:37 ` ✓ CI.KUnit: success for " Patchwork
2026-06-01 23:15 ` ✓ Xe.CI.BAT: " Patchwork
2026-06-02 8:13 ` ✓ Xe.CI.FULL: " Patchwork
2026-06-11 1:03 ` [PATCH v2] " Zongyao Bai
2026-06-11 11:59 ` Maarten Lankhorst
2026-06-18 21:18 ` Bai, Zongyao
2026-06-11 1:13 ` ✓ CI.KUnit: success for drm/xe/forcewake: add delayed-release optimization (rev2) Patchwork
2026-06-11 1:58 ` ✓ Xe.CI.BAT: " Patchwork
2026-06-11 3:09 ` [PATCH] drm/xe/forcewake: add delayed-release optimization Matthew Brost
2026-06-11 3:15 ` Matthew Brost
2026-06-25 1:37 ` Bai, Zongyao
2026-06-11 11:29 ` ✓ Xe.CI.FULL: success for drm/xe/forcewake: add delayed-release optimization (rev2) Patchwork
2026-06-25 8:19 ` [PATCH v3] drm/xe/forcewake: add delayed-release optimization Zongyao Bai
2026-06-25 8:51 ` ✓ CI.KUnit: success for drm/xe/forcewake: add delayed-release optimization (rev3) Patchwork
2026-06-25 9:26 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-06-25 10:55 ` ✗ Xe.CI.FULL: " Patchwork
2026-07-20 22:13 ` [PATCH v4] drm/xe/forcewake: add delayed-release optimization Zongyao Bai
2026-07-21 22:43 ` Matthew Brost
2026-07-20 22:18 ` ✗ CI.checkpatch: warning for drm/xe/forcewake: add delayed-release optimization (rev4) Patchwork
2026-07-20 22:20 ` ✓ CI.KUnit: success " Patchwork
2026-07-20 22:54 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-21 5:00 ` ✓ Xe.CI.FULL: " Patchwork
2026-08-13 0:06 ` [PATCH v5 0/4] drm/xe/forcewake: add delayed-release optimization Zongyao Bai
2026-08-13 0:06 ` [PATCH v5 1/4] drm/xe/forcewake: synchronize engine-cycle access with unplug Zongyao Bai
2026-08-13 0:21 ` sashiko-bot
2026-08-13 20:48 ` Bai, Zongyao
2026-08-19 18:29 ` Yao, Jia
2026-09-03 16:20 ` Rodrigo Vivi
2026-09-03 18:29 ` Bai, Zongyao
2026-08-13 0:06 ` [PATCH v5 2/4] drm/xe/forcewake: add delayed-release state machine Zongyao Bai
2026-08-13 0:23 ` sashiko-bot
2026-08-13 21:28 ` Bai, Zongyao
2026-09-03 16:12 ` Rodrigo Vivi
2026-09-04 0:25 ` Bai, Zongyao
2026-08-20 23:07 ` Yao, Jia
2026-08-13 0:06 ` [PATCH v5 3/4] drm/xe/forcewake: flush delayed release at power boundaries Zongyao Bai
2026-08-13 0:23 ` sashiko-bot
2026-08-13 22:06 ` Bai, Zongyao
2026-08-20 23:07 ` Yao, Jia
2026-08-13 0:06 ` [PATCH v5 4/4] drm/xe/forcewake: enable configurable delayed forcewake release Zongyao Bai
2026-08-13 0:18 ` sashiko-bot
2026-08-13 23:14 ` Bai, Zongyao
2026-08-19 18:05 ` Yao, Jia
2026-09-03 18:59 ` [PATCH v5 0/4] drm/xe/forcewake: add delayed-release optimization Umesh Nerlige Ramappa
2026-09-03 23:19 ` Bai, Zongyao [this message]
2026-09-03 23:56 ` Umesh Nerlige Ramappa
2026-08-13 0:13 ` ✗ CI.checkpatch: warning for drm/xe/forcewake: add delayed-release optimization (rev5) Patchwork
2026-08-13 0:15 ` ✓ CI.KUnit: success " Patchwork
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=14d20a60-29f1-40f3-83f5-e8b6eaec81db@intel.com \
--to=zongyao.bai@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=jia.yao@intel.com \
--cc=matthew.brost@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=umesh.nerlige.ramappa@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