cancel_async_put_work() also clears async_put_next_delay, so moving it
ahead of the requeue in intel_display_power_put_async_work() makes the
requeue always use a zero delay. That discards the delay accumulated by
concurrent async puts, including the 17 ms DC-state anti-toggle delay
requested for POWER_DOMAIN_DC_OFF.

Use cancel_delayed_work() directly to cancel the stale instance without
clearing the delay, and clear the delay only after the requeue has
consumed it.

Fixes: 30ca6365bb42 ("drm/i915: Fix assert on pending async-put power domain 
work when it requeues itself")
Cc: <[email protected]> # v6.11+
Signed-off-by: Wentao Guan <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display_power.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c 
b/drivers/gpu/drm/i915/display/intel_display_power.c
index b000ec001ccfc..7da6eda46e9e0 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power.c
+++ b/drivers/gpu/drm/i915/display/intel_display_power.c
@@ -873,7 +873,7 @@ intel_display_power_put_async_work(struct work_struct *work)
         * Cancel the work that got queued after this one got dequeued,
         * since here we released the corresponding async-put reference.
         */
-       cancel_async_put_work(power_domains, false);
+       cancel_delayed_work(&power_domains->async_put_work);
 
        /* Requeue the work if more domains were async put meanwhile. */
        if (!bitmap_empty(power_domains->async_put_domains[1].bits, 
POWER_DOMAIN_NUM)) {
@@ -885,9 +885,10 @@ intel_display_power_put_async_work(struct work_struct 
*work)
                queue_async_put_domains_work(power_domains,
                                             fetch_and_zero(&new_work_wakeref),
                                             
power_domains->async_put_next_delay);
-               power_domains->async_put_next_delay = 0;
        }
 
+       power_domains->async_put_next_delay = 0;
+
 out_verify:
        verify_async_put_domains_state(power_domains);
 
-- 
2.47.3

Reply via email to