Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH 2/3] drm/i915: Fix incorrect assert about pending power domain async-put work
Date: Wed, 26 May 2021 17:37:28 +0300	[thread overview]
Message-ID: <20210526143729.2563672-2-imre.deak@intel.com> (raw)
In-Reply-To: <20210526143729.2563672-1-imre.deak@intel.com>

It's possible that an already dequeued put_async_work() will release the
reference (*) that was put asynchronously after the dequeue happened.
This leaves an async-put work pending, without any reference to release.
A subsequent async-put may trigger the

drm_WARN_ON(!queue_delayed_work(&power_domains->async_put_work));

warn due to async_put_work() still pending. To avoid the warn, cancel
the pending async_put_work() when releasing the reference at (*) above.

Fixes: https://gitlab.freedesktop.org/drm/intel/-/issues/3421
Fixes: https://gitlab.freedesktop.org/drm/intel/-/issues/2289
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display_power.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c
index 2f7d1664c4738..a95bbf23e6b7c 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power.c
+++ b/drivers/gpu/drm/i915/display/intel_display_power.c
@@ -2263,6 +2263,12 @@ intel_display_power_put_async_work(struct work_struct *work)
 			fetch_and_zero(&power_domains->async_put_domains[1]);
 		queue_async_put_domains_work(power_domains,
 					     fetch_and_zero(&new_work_wakeref));
+	} else {
+		/*
+		 * Cancel the work that got queued after this one got dequeued,
+		 * since here we released the corresponding async-put reference.
+		 */
+		cancel_delayed_work(&power_domains->async_put_work);
 	}
 
 out_verify:
-- 
2.27.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2021-05-26 14:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26 14:37 [Intel-gfx] [PATCH 1/3] drm/i915/ddi: Flush encoder power domain ref puts during driver unload Imre Deak
2021-05-26 14:37 ` Imre Deak [this message]
2021-06-02  9:05   ` [Intel-gfx] [PATCH 2/3] drm/i915: Fix incorrect assert about pending power domain async-put work Anshuman Gupta
2021-06-02 14:01     ` Imre Deak
2021-06-03  6:22       ` Gupta, Anshuman
2021-05-26 14:37 ` [Intel-gfx] [PATCH 3/3] drm/i915/adlp: Fix AUX power well -> PHY mapping Imre Deak
2021-06-03  9:43   ` Anshuman Gupta
2021-06-09 11:42   ` Jani Nikula
2021-06-09 12:34     ` Imre Deak
2021-05-26 21:18 ` [Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915/ddi: Flush encoder power domain ref puts during driver unload Patchwork
2021-05-27 10:02 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-05-27 18:04   ` Imre Deak
2021-05-27 19:41     ` Vudum, Lakshminarayana
2021-05-27 18:40 ` [Intel-gfx] ✓ Fi.CI.IGT: success " Patchwork
2021-06-03 16:34   ` Imre Deak
2021-06-02  8:06 ` [Intel-gfx] [PATCH 1/3] " Anshuman Gupta

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=20210526143729.2563672-2-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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