Patch "drm/msm/dp: fix event thread stuck in wait_event after kthread_stop()" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/msm/dp: fix event thread stuck in wait_event after kthread_stop()

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-msm-dp-fix-event-thread-stuck-in-wait_event-afte.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c15891ccc536f34c85a0b2ab268788b7da968239
Author: Kuogee Hsieh <quic_khsieh@xxxxxxxxxxx>
Date:   Tue May 3 09:25:36 2022 -0700

    drm/msm/dp: fix event thread stuck in wait_event after kthread_stop()
    
    [ Upstream commit 2f9b5b3ae2eb625b75a898212a76f3b8c6d0d2b0 ]
    
    Event thread supposed to exit from its while loop after kthread_stop().
    However there may has possibility that event thread is pending in the
    middle of wait_event due to condition checking never become true.
    To make sure event thread exit its loop after kthread_stop(), this
    patch OR kthread_should_stop() into wait_event's condition checking
    so that event thread will exit its loop after kernal_stop().
    
    Changes in v2:
    --  correct spelling error at commit title
    
    Changes in v3:
    -- remove unnecessary parenthesis
    -- while(1) to replace while (!kthread_should_stop())
    
    Reported-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
    Fixes: 570d3e5d28db ("drm/msm/dp: stop event kernel thread when DP unbind")
    Signed-off-by: Kuogee Hsieh <quic_khsieh@xxxxxxxxxxx>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
    Reviewed-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>
    Patchwork: https://patchwork.freedesktop.org/patch/484576/
    Link: https://lore.kernel.org/r/1651595136-24312-1-git-send-email-quic_khsieh@xxxxxxxxxxx
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 00e7d9db6199..7b624191abf1 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -1069,15 +1069,20 @@ static int hpd_event_thread(void *data)
 
 	dp_priv = (struct dp_display_private *)data;
 
-	while (!kthread_should_stop()) {
+	while (1) {
 		if (timeout_mode) {
 			wait_event_timeout(dp_priv->event_q,
-				(dp_priv->event_pndx == dp_priv->event_gndx),
-						EVENT_TIMEOUT);
+				(dp_priv->event_pndx == dp_priv->event_gndx) ||
+					kthread_should_stop(), EVENT_TIMEOUT);
 		} else {
 			wait_event_interruptible(dp_priv->event_q,
-				(dp_priv->event_pndx != dp_priv->event_gndx));
+				(dp_priv->event_pndx != dp_priv->event_gndx) ||
+					kthread_should_stop());
 		}
+
+		if (kthread_should_stop())
+			break;
+
 		spin_lock_irqsave(&dp_priv->event_lock, flag);
 		todo = &dp_priv->event_list[dp_priv->event_gndx];
 		if (todo->delay) {



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux