linux-stable/drivers/gpu/drm/bridge/cadence
Tetsuo Handa 0538fa09bb
gpu/drm/bridge/cadence: avoid flush_scheduled_work() usage
Like commit c4f135d643 ("workqueue: Wrap flush_workqueue() using a
macro") says, flush_scheduled_work() is dangerous and will be forbidden.
We are on the way for removing all flush_scheduled_work() callers from
the kernel, and this patch is for removing flush_scheduled_work() call
 from cadence driver.

Since cdns-mhdp8546 driver uses 4 works

  mhdp->modeset_retry_work
  mhdp->hpd_work
  mhdp->hdcp.check_work
  mhdp->hdcp.prop_work

I assume that flush_scheduled_work() in cdns_mhdp_remove() needs to wait
for only these 4 works.

Since mhdp->modeset_retry_work already uses cancel_work_sync(), I assume
that flush_scheduled_work() needs to wait for only 3 works. But I came to
wonder whether mhdp->hdcp.check_work should be flushed or cancelled.

While flush_scheduled_work() waits for completion of works which were
already queued to system_wq, mhdp->hdcp.check_work is a delayed work.
That is, this work won't be queued to system_wq unless timeout expires.

Current code will wait for mhdp->hdcp.check_work only if timeout already
expired. If timeout is not expired yet, flush_scheduled_work() will fail
to cancel mhdp->hdcp.check_work, and cdns_mhdp_hdcp_check_work() which is
triggered by mhdp->hdcp.check_work will schedule hdcp->check_work, which
is too late for flush_scheduled_work() to wait for completion of
cdns_mhdp_hdcp_prop_work().

But since I couldn't get comments on how do we want to handle this race
window [1], this patch chose "do nothing" for mhdp->hdcp.check_work and
mhdp->hdcp.prop_work. That is, I assume that flush_scheduled_work() in
cdns_mhdp_remove() needs to wait for only mhdp->hpd_work work.

Link: https://lkml.kernel.org/r/943273cb-c2ec-24e3-5edb-64eacc6e2d30@I-love.SAKURA.ne.jp [1]
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/216591bc-28bb-0453-10bb-59e268dff540@I-love.SAKURA.ne.jp
2022-09-01 13:43:46 +02:00
..
cdns-mhdp8546-core.c gpu/drm/bridge/cadence: avoid flush_scheduled_work() usage 2022-09-01 13:43:46 +02:00
cdns-mhdp8546-core.h drm: Rename dp/ to display/ 2022-04-25 11:17:45 +02:00
cdns-mhdp8546-hdcp.c drm/display: Move HDCP helpers into display-helper module 2022-04-25 11:19:36 +02:00
cdns-mhdp8546-hdcp.h drm: bridge: cdns-mhdp8546: Enable HDCP 2021-04-13 10:28:05 +02:00
cdns-mhdp8546-j721e.c
cdns-mhdp8546-j721e.h
Kconfig drm/display: Move HDCP helpers into display-helper module 2022-04-25 11:19:36 +02:00
Makefile drm: bridge: cdns-mhdp8546: Enable HDCP 2021-04-13 10:28:05 +02:00