All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dibin Moolakadan Subrahmanian"
	<dibin.moolakadan.subrahmanian@intel.com>,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/i915/dmc_wl: Avoid blocking on delayed wakelock release
Date: Tue, 13 Oct 2026 16:24:52 +0000	[thread overview]
Message-ID: <sashiko-outbox-170108@kernel.org> (raw)
In-Reply-To: <20261013161131.2572279-6-dibin.moolakadan.subrahmanian@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/i915/dmc_wl: race allows delayed work execution after disable
--

commit c0608498f162e6c645a132e26ca4016580c97dce
Author: Dibin Moolakadan Subrahmanian <dibin.moolakadan.subrahmanian@intel.com>

drm/i915/dmc_wl: Avoid blocking on delayed wakelock release

This commit modifies intel_dmc_wl_disable() to cancel the pending wakelock
release work rather than flushing it. This prevents the DC-exit path from
being unnecessarily delayed by workqueue scheduling and ACK polling. It drops
the work when disabling the wakelock instead of forcing it to run.

> diff --git a/drivers/gpu/drm/i915/display/intel_dmc_wl.c b/drivers/gpu/drm/i915/display/intel_dmc_wl.c
> index ab4e0e9573dfb..3eae119009782 100644
> --- a/drivers/gpu/drm/i915/display/intel_dmc_wl.c
> +++ b/drivers/gpu/drm/i915/display/intel_dmc_wl.c
> @@ -400,7 +400,7 @@ void intel_dmc_wl_disable(struct intel_display *display)
>  	if (!__intel_dmc_wl_supported(display))
>  		return;
>  
> -	intel_dmc_wl_flush_release_work(display);
> +	cancel_delayed_work_sync(&wl->work);

[Severity: Medium]
Could this leave a stray delayed work queued after the wakelock is disabled?

Since cancel_delayed_work_sync() is called outside of wl->lock and before
wl->enabled is cleared, could a concurrent intel_dmc_wl_put() race here?

If CPU1 is in intel_dmc_wl_disable() just after cancel_delayed_work_sync(),
and CPU2 calls intel_dmc_wl_put():

CPU2 takes the lock in intel_dmc_wl_put(), sees wl->enabled is still true,
and queues the work again:

    if (refcount_dec_and_test(&wl->refcount)) {
        if (!wl->enabled)
            goto out_unlock;
        
        __intel_dmc_wl_release(display);
        ...

Then CPU1 would acquire the lock, disable the wakelock, and set 
wl->enabled = false, but the work has already been re-queued.

When the queued intel_dmc_wl_work() executes later, it checks if refcount is
non-zero but doesn't check wl->enabled. It would then poll for
DMC_WAKELOCK_CTL_ACK and trigger the "DMC wakelock release timed out"
WARN_RATELIMIT since the wakelock was already disabled.

>  
>  	spin_lock_irqsave(&wl->lock, flags);
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261013161131.2572279-4-dibin.moolakadan.subrahmanian@intel.com?part=2

  reply	other threads:[~2026-10-13 16:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 16:11 [PATCH 0/2] drm/i915: Reduce overhead in DC3CO transitions Dibin Moolakadan Subrahmanian
2026-10-13 16:11 ` [PATCH 1/2] drm/i915/display: avoid logging " Dibin Moolakadan Subrahmanian
2026-10-13 16:11 ` [PATCH 2/2] drm/i915/dmc_wl: Avoid blocking on delayed wakelock release Dibin Moolakadan Subrahmanian
2026-10-13 16:24   ` sashiko-bot [this message]
2026-10-13 16:21 ` ✓ CI.KUnit: success for drm/i915: Reduce overhead in DC3CO transitions Patchwork
2026-10-13 17:12 ` ✓ i915.CI.BAT: " Patchwork
2026-10-13 21:46 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-13 22:14 ` ✗ i915.CI.Full: failure " 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=sashiko-outbox-170108@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dibin.moolakadan.subrahmanian@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.