* [PATCH] drm/msm/dp: Sleep properly in dp_hpd_handler kthread
@ 2020-09-17 22:44 ` Stephen Boyd
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2020-09-17 22:44 UTC (permalink / raw)
To: Rob Clark, Sean Paul
Cc: linux-kernel, linux-arm-msm, dri-devel, freedreno, Tanmay Shah,
Kuogee Hsieh, Douglas Anderson
We shouldn't be waiting for an event here with a timeout of 100ms when
we're not in the 'timeout' arm of the if condition. Instead we should be
sleeping in the interruptible state (S) until something happens and we
need to wakeup. Right now this kthread is running almost all the time
because it sleeps for 100ms, wakes up, sees there's nothing to do, and
then starts the process all over again. Looking at top it shows up in
the D state (uninterruptible) because it uses wait_event_timeout(). FIx
this up.
Cc: Tanmay Shah <tanmay@codeaurora.org>
Cc: Kuogee Hsieh <khsieh@codeaurora.org>
Reported-by: Douglas Anderson <dianders@chromium.org>
Fixes: 8ede2ecc3e5e ("drm/msm/dp: Add DP compliance tests on Snapdragon Chipsets")
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
Based on msm-next-dp of https://gitlab.freedesktop.org/drm/msm.git
drivers/gpu/drm/msm/dp/dp_display.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 05a97e097edf..e175aa3fd3a9 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -970,9 +970,8 @@ static int hpd_event_thread(void *data)
(dp_priv->event_pndx == dp_priv->event_gndx),
EVENT_TIMEOUT);
} else {
- wait_event_timeout(dp_priv->event_q,
- (dp_priv->event_pndx != dp_priv->event_gndx),
- EVENT_TIMEOUT);
+ wait_event_interruptible(dp_priv->event_q,
+ (dp_priv->event_pndx != dp_priv->event_gndx));
}
spin_lock_irqsave(&dp_priv->event_lock, flag);
todo = &dp_priv->event_list[dp_priv->event_gndx];
base-commit: 937f941ca06f2f3ab64baebf31be2c16d57ae7b8
--
Sent by a computer, using git, on the internet
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] drm/msm/dp: Sleep properly in dp_hpd_handler kthread
@ 2020-09-17 22:44 ` Stephen Boyd
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2020-09-17 22:44 UTC (permalink / raw)
To: Rob Clark, Sean Paul
Cc: linux-arm-msm, linux-kernel, Tanmay Shah, Douglas Anderson,
Kuogee Hsieh, dri-devel, freedreno
We shouldn't be waiting for an event here with a timeout of 100ms when
we're not in the 'timeout' arm of the if condition. Instead we should be
sleeping in the interruptible state (S) until something happens and we
need to wakeup. Right now this kthread is running almost all the time
because it sleeps for 100ms, wakes up, sees there's nothing to do, and
then starts the process all over again. Looking at top it shows up in
the D state (uninterruptible) because it uses wait_event_timeout(). FIx
this up.
Cc: Tanmay Shah <tanmay@codeaurora.org>
Cc: Kuogee Hsieh <khsieh@codeaurora.org>
Reported-by: Douglas Anderson <dianders@chromium.org>
Fixes: 8ede2ecc3e5e ("drm/msm/dp: Add DP compliance tests on Snapdragon Chipsets")
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
Based on msm-next-dp of https://gitlab.freedesktop.org/drm/msm.git
drivers/gpu/drm/msm/dp/dp_display.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 05a97e097edf..e175aa3fd3a9 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -970,9 +970,8 @@ static int hpd_event_thread(void *data)
(dp_priv->event_pndx == dp_priv->event_gndx),
EVENT_TIMEOUT);
} else {
- wait_event_timeout(dp_priv->event_q,
- (dp_priv->event_pndx != dp_priv->event_gndx),
- EVENT_TIMEOUT);
+ wait_event_interruptible(dp_priv->event_q,
+ (dp_priv->event_pndx != dp_priv->event_gndx));
}
spin_lock_irqsave(&dp_priv->event_lock, flag);
todo = &dp_priv->event_list[dp_priv->event_gndx];
base-commit: 937f941ca06f2f3ab64baebf31be2c16d57ae7b8
--
Sent by a computer, using git, on the internet
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/msm/dp: Sleep properly in dp_hpd_handler kthread
2020-09-17 22:44 ` Stephen Boyd
@ 2020-09-17 23:20 ` khsieh
-1 siblings, 0 replies; 4+ messages in thread
From: khsieh @ 2020-09-17 23:20 UTC (permalink / raw)
To: Stephen Boyd
Cc: Rob Clark, Sean Paul, linux-kernel, linux-arm-msm, dri-devel,
freedreno, Tanmay Shah, Douglas Anderson
On 2020-09-17 15:44, Stephen Boyd wrote:
> We shouldn't be waiting for an event here with a timeout of 100ms when
> we're not in the 'timeout' arm of the if condition. Instead we should
> be
> sleeping in the interruptible state (S) until something happens and we
> need to wakeup. Right now this kthread is running almost all the time
> because it sleeps for 100ms, wakes up, sees there's nothing to do, and
> then starts the process all over again. Looking at top it shows up in
> the D state (uninterruptible) because it uses wait_event_timeout(). FIx
> this up.
>
> Cc: Tanmay Shah <tanmay@codeaurora.org>
> Cc: Kuogee Hsieh <khsieh@codeaurora.org>
> Reported-by: Douglas Anderson <dianders@chromium.org>
> Fixes: 8ede2ecc3e5e ("drm/msm/dp: Add DP compliance tests on
> Snapdragon Chipsets")
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Kuogee Hsieh <khsieh@codeaurora.org>
> ---
>
> Based on msm-next-dp of https://gitlab.freedesktop.org/drm/msm.git
>
> drivers/gpu/drm/msm/dp/dp_display.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c
> b/drivers/gpu/drm/msm/dp/dp_display.c
> index 05a97e097edf..e175aa3fd3a9 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -970,9 +970,8 @@ static int hpd_event_thread(void *data)
> (dp_priv->event_pndx == dp_priv->event_gndx),
> EVENT_TIMEOUT);
> } else {
> - wait_event_timeout(dp_priv->event_q,
> - (dp_priv->event_pndx != dp_priv->event_gndx),
> - EVENT_TIMEOUT);
> + wait_event_interruptible(dp_priv->event_q,
> + (dp_priv->event_pndx != dp_priv->event_gndx));
> }
> spin_lock_irqsave(&dp_priv->event_lock, flag);
> todo = &dp_priv->event_list[dp_priv->event_gndx];
>
> base-commit: 937f941ca06f2f3ab64baebf31be2c16d57ae7b8
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/msm/dp: Sleep properly in dp_hpd_handler kthread
@ 2020-09-17 23:20 ` khsieh
0 siblings, 0 replies; 4+ messages in thread
From: khsieh @ 2020-09-17 23:20 UTC (permalink / raw)
To: Stephen Boyd
Cc: Sean Paul, linux-arm-msm, linux-kernel, dri-devel,
Douglas Anderson, Tanmay Shah, freedreno
On 2020-09-17 15:44, Stephen Boyd wrote:
> We shouldn't be waiting for an event here with a timeout of 100ms when
> we're not in the 'timeout' arm of the if condition. Instead we should
> be
> sleeping in the interruptible state (S) until something happens and we
> need to wakeup. Right now this kthread is running almost all the time
> because it sleeps for 100ms, wakes up, sees there's nothing to do, and
> then starts the process all over again. Looking at top it shows up in
> the D state (uninterruptible) because it uses wait_event_timeout(). FIx
> this up.
>
> Cc: Tanmay Shah <tanmay@codeaurora.org>
> Cc: Kuogee Hsieh <khsieh@codeaurora.org>
> Reported-by: Douglas Anderson <dianders@chromium.org>
> Fixes: 8ede2ecc3e5e ("drm/msm/dp: Add DP compliance tests on
> Snapdragon Chipsets")
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Kuogee Hsieh <khsieh@codeaurora.org>
> ---
>
> Based on msm-next-dp of https://gitlab.freedesktop.org/drm/msm.git
>
> drivers/gpu/drm/msm/dp/dp_display.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c
> b/drivers/gpu/drm/msm/dp/dp_display.c
> index 05a97e097edf..e175aa3fd3a9 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -970,9 +970,8 @@ static int hpd_event_thread(void *data)
> (dp_priv->event_pndx == dp_priv->event_gndx),
> EVENT_TIMEOUT);
> } else {
> - wait_event_timeout(dp_priv->event_q,
> - (dp_priv->event_pndx != dp_priv->event_gndx),
> - EVENT_TIMEOUT);
> + wait_event_interruptible(dp_priv->event_q,
> + (dp_priv->event_pndx != dp_priv->event_gndx));
> }
> spin_lock_irqsave(&dp_priv->event_lock, flag);
> todo = &dp_priv->event_list[dp_priv->event_gndx];
>
> base-commit: 937f941ca06f2f3ab64baebf31be2c16d57ae7b8
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-09-18 7:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 22:44 [PATCH] drm/msm/dp: Sleep properly in dp_hpd_handler kthread Stephen Boyd
2020-09-17 22:44 ` Stephen Boyd
2020-09-17 23:20 ` khsieh
2020-09-17 23:20 ` khsieh
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.