Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Zongyao Bai <zongyao.bai@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <jia.yao@intel.com>
Subject: Re: [PATCH v10 0/4] drm/xe/forcewake: add delayed release and lifecycle handling
Date: Tue, 13 Oct 2026 14:52:31 -0400	[thread overview]
Message-ID: <as597xuyHECbO4hZ@intel.com> (raw)
In-Reply-To: <20260930220820.2184643-1-zongyao.bai@intel.com>

On Wed, Sep 30, 2026 at 03:08:16PM -0700, Zongyao Bai wrote:
> From: "Bai, Zongyao" <zongyao.bai@intel.com>
> 
> Engine-cycle queries used by profiling 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 with a bind-time configurable hold
> interval, defaulting to 100 us. When the final overlapping forcewake
> reference is dropped after a delayed-release request, keep the domain awake
> for that interval. A get for the same domain before expiry cancels the
> pending release and reuses the awake domain without another wake request or
> ACK wait.
> 
> Only engine-cycle queries request delayed release. Existing callers
> continue to use the immediate-release API. Delayed-release state is per
> domain, so a put that drops the final overlapping reference honors any
> recorded delayed-release request.
> 
> Protect engine-cycle MMIO access with drm_dev_enter()/drm_dev_exit() so
> drm_dev_unplug() waits for admitted queries to drop their forcewake
> references before teardown. For system and runtime suspend, synchronously
> drain delayed state while keeping delayed release available after resume.
> 
> For shutdown, removal, post-registration probe unwind, and devres teardown,
> permanently disable new delayed releases and settle pending state with
> xe_force_wake_stop(). Register the device-wide stop action after the
> Driver-FLR action so reverse devres ordering settles delayed forcewake
> state before Driver-FLR while MMIO is still valid. Keep the per-GT cleanup
> as an idempotent fallback for earlier probe failures.
> 
> For PCI error recovery, use xe_force_wake_stop_nosettle() before
> pci_disable_device() on reset and on paths returning
> PCI_ERS_RESULT_DISCONNECT. It disables delayed release, cancels timers, and
> discards delayed-release bookkeeping without accessing MMIO.

I'm having a hard time reviewing this series. The patches seems to mix
multiple stuff into one. And the solution looks a lot over-engineering.

why not using a simple histeresis timed put with a delayed queue?

> 
> v10:
>  - Please ignore v6~v9 in this series:
>    https://patchwork.freedesktop.org/series/167697
>    Those revisions used incorrect Root msg-id(s) by mistake.
>    Created v10 to clean up the threading mess in previous revisions.
>    No functional changes relative to v6.
>    Rebase onto drm-xe-next at fa8b3b6c4a4b.
> 
> v6:
>  - Add a permanent delayed-release disable state and clear stale recorded
>    requests on the immediate-release path.
>  - Keep flush for system/runtime suspend and use terminal stop for
>    shutdown, remove, probe unwind, and devres teardown.
>  - Order the device-wide stop before Driver-FLR while retaining per-GT
>    cleanup for earlier probe failures.
>  - Add a no-MMIO stop for PCI reset and disconnect handling.
>  - Use the configfs group lock when reading the hold interval.
>  - Document the per-domain drain and discard state transitions.
> 
> 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: quiesce delayed release across PM and teardown
>   drm/xe/forcewake: enable configurable delayed forcewake release
> 
>  drivers/gpu/drm/xe/xe_configfs.c         |  78 ++++++
>  drivers/gpu/drm/xe/xe_configfs.h         |   5 +
>  drivers/gpu/drm/xe/xe_defaults.h         |   1 +
>  drivers/gpu/drm/xe/xe_device.c           |  33 ++-
>  drivers/gpu/drm/xe/xe_device.h           |   1 +
>  drivers/gpu/drm/xe/xe_device_types.h     |   3 +
>  drivers/gpu/drm/xe/xe_force_wake.c       | 337 +++++++++++++++++++++--
>  drivers/gpu/drm/xe/xe_force_wake.h       |  48 +++-
>  drivers/gpu/drm/xe/xe_force_wake_types.h | 123 +++++++++
>  drivers/gpu/drm/xe/xe_gt.c               |  18 +-
>  drivers/gpu/drm/xe/xe_pci_error.c        |  23 +-
>  drivers/gpu/drm/xe/xe_query.c            |  81 ++++--
>  12 files changed, 696 insertions(+), 55 deletions(-)
> 
> 
> base-commit: fa8b3b6c4a4b297bf95935065b63f8852cfc5481
> -- 
> 2.43.0

  parent reply	other threads:[~2026-10-13 18:53 UTC|newest]

Thread overview: 61+ 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-09-17  0:06   ` [PATCH v6 0/4] drm/xe/forcewake: add delayed release and lifecycle handling Zongyao Bai
2026-09-17  0:06     ` [PATCH v6 1/4] drm/xe/forcewake: synchronize engine-cycle access with unplug Zongyao Bai
2026-09-17  0:06     ` [PATCH v6 2/4] drm/xe/forcewake: add delayed-release state machine Zongyao Bai
2026-09-17  0:07     ` [PATCH v6 3/4] drm/xe/forcewake: quiesce delayed release across PM and teardown Zongyao Bai
2026-09-17  0:07     ` [PATCH v6 4/4] drm/xe/forcewake: enable configurable delayed forcewake release Zongyao Bai
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
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
2026-09-30 22:08 ` [PATCH v10 0/4] drm/xe/forcewake: add delayed release and lifecycle handling Zongyao Bai
2026-09-30 22:08   ` [PATCH v10 1/4] drm/xe/forcewake: synchronize engine-cycle access with unplug Zongyao Bai
2026-09-30 22:08   ` [PATCH v10 2/4] drm/xe/forcewake: add delayed-release state machine Zongyao Bai
2026-09-30 22:08   ` [PATCH v10 3/4] drm/xe/forcewake: quiesce delayed release across PM and teardown Zongyao Bai
2026-09-30 22:08   ` [PATCH v10 4/4] drm/xe/forcewake: enable configurable delayed forcewake release Zongyao Bai
2026-10-13 18:52   ` Rodrigo Vivi [this message]
2026-10-14  0:30     ` [PATCH v10 0/4] drm/xe/forcewake: add delayed release and lifecycle handling Bai, Zongyao

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=as597xuyHECbO4hZ@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jia.yao@intel.com \
    --cc=zongyao.bai@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