drm/msm: validate display and event threads
PATCH 1/1 drm/msm: validate display and event threads
While creating display and event threads per crtc, validate them before setting their priorities.
--- drivers/gpu/drm/msm/msm_drv.c | 49 ++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 33 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +16 -33
@@ -553,17 +553,18 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)kthread_run (kthread_worker_fn, &priv->disp_thread[i].worker,"crtc_commit:%d" , priv->disp_thread[i].crtc_id); - ret =sched_setscheduler (priv->disp_thread[i].thread, -SCHED_FIFO , ¶m); -if (ret) -pr_warn ("display thread priority update failed: %d\n" , - ret); -if (IS_ERR (priv->disp_thread[i].thread)) {dev_err (dev,"failed to create crtc_commit kthread\n" ); priv->disp_thread[i].thread =NULL ; + goto err_msm_uninit; } + ret =sched_setscheduler (priv->disp_thread[i].thread, +SCHED_FIFO , ¶m); +if (ret) +pr_warn ("display thread priority update failed: %d\n" , + ret); +/* initialize event thread */ priv->event_thread[i].crtc_id = priv->crtcs[i]->base.id;kthread_init_worker (&priv->event_thread[i].worker);
@@ -572,6 +573,12 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)kthread_run (kthread_worker_fn, &priv->event_thread[i].worker,"crtc_event:%d" , priv->event_thread[i].crtc_id); +if (IS_ERR (priv->event_thread[i].thread)) { +dev_err (dev,"failed to create crtc_event kthread\n" ); + priv->event_thread[i].thread =NULL ; + goto err_msm_uninit; + } +/** * event thread should also run at same priority as disp_thread * because it is handling frame_done events. A lower priority
@@ -580,34 +587,10 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)* failure at crtc commit level. */ ret =sched_setscheduler (priv->event_thread[i].thread, -SCHED_FIFO , ¶m); +SCHED_FIFO , ¶m);if (ret) -pr_warn ("display event thread priority update failed: %d\n" , - ret); - -if (IS_ERR (priv->event_thread[i].thread)) { -dev_err (dev,"failed to create crtc_event kthread\n" ); - priv->event_thread[i].thread =NULL ; - } - -if ((!priv->disp_thread[i].thread) || - !priv->event_thread[i].thread) { -/* clean up previously created threads if any */ -for ( ; i >=0 ; i--) { -if (priv->disp_thread[i].thread) { -kthread_stop ( - priv->disp_thread[i].thread); - priv->disp_thread[i].thread =NULL ; - } - -if (priv->event_thread[i].thread) { -kthread_stop ( - priv->event_thread[i].thread); - priv->event_thread[i].thread =NULL ; - } - } - goto err_msm_uninit; - } +pr_warn ("display event thread priority update failed:%d\n" , + ret); } ret =drm_vblank_init (ddev, priv->num_crtcs);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
A message that is not in the archive (sent off-list or not yet received): 1538768955-10000-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org
Quoted 26 lines · Jeykumar Sankaran
While creating display and event threads per crtc, validate them before setting their priorities.
Change-Id I1dda805286df981c0f0e2b26507d089d3a21ff6cSigned-off-by Jeykumar Sankaran <[email protected]>--- drivers/gpu/drm/msm/msm_drv.c | 49 ++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 33 deletions(-)drivers/gpu/drm/msm/msm_drv.c +0
-6@@ -553,17 +553,18 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv) kthread_run(kthread_worker_fn, &priv->disp_thread[i].worker, "crtc_commit:%d", priv->disp_thread[i].crtc_id); - ret =sched_setscheduler (priv->disp_thread[i].thread, -SCHED_FIFO , ¶m); -if (ret) -pr_warn ("display thread priority update failed: %d\n" , - ret); -if (IS_ERR (priv->disp_thread[i].thread)) {
drivers/gpu/drm/msm/msm_drv.c static int msm_drm_init(struct device *dev, · line 567
Quoted 10 lines
drivers/gpu/drm/msm/msm_drv.c +6
-0dev_err (dev,"failed to create crtc_commit kthread\n" ); priv->disp_thread[i].thread =NULL ; + goto err_msm_uninit; } + ret =sched_setscheduler (priv->disp_thread[i].thread, +SCHED_FIFO , ¶m); +if (ret) +pr_warn ("display thread priority update failed: %d\n" , + ret);
dev_warn is better
Quoted 19 lines
drivers/gpu/drm/msm/msm_drv.c +1
-0+/* initialize event thread */ priv->event_thread[i].crtc_id = priv->crtcs[i]->base.id;drivers/gpu/drm/msm/msm_drv.c +6
-0kthread_init_worker (&priv->event_thread[i].worker);@@ -572,6 +573,12 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv) kthread_run(kthread_worker_fn, &priv->event_thread[i].worker, "crtc_event:%d", priv->event_thread[i].crtc_id); +if (IS_ERR (priv->event_thread[i].thread)) { +dev_err (dev,"failed to create crtc_event kthread\n" ); + priv->event_thread[i].thread =NULL ; + goto err_msm_uninit; + } +/** * event thread should also run at same priority as disp_thread drivers/gpu/drm/msm/msm_drv.c +0
-0* because it is handling frame_done events. A lower priority
drivers/gpu/drm/msm/msm_drv.c static int msm_drm_init(struct device *dev, · line 587
Quoted 9 lines
drivers/gpu/drm/msm/msm_drv.c +1
-3@@ -580,34 +587,10 @@ static int msm_drm_init(struct device *dev,struct drm_driver *drv) * failure at crtc commit level. */ ret =sched_setscheduler (priv->event_thread[i].thread, -SCHED_FIFO , ¶m); +SCHED_FIFO , ¶m);if (ret) -pr_warn ("display event thread priority update failed: %d\n" , - ret);
same as above
Quoted 17 lines
drivers/gpu/drm/msm/msm_drv.c +0
-17- -if (IS_ERR (priv->event_thread[i].thread)) { -dev_err (dev,"failed to create crtc_event kthread\n" ); - priv->event_thread[i].thread =NULL ; - } - -if ((!priv->disp_thread[i].thread) || - !priv->event_thread[i].thread) { -/* clean up previously created threads if any */ -for ( ; i >=0 ; i--) { -if (priv->disp_thread[i].thread) { -kthread_stop ( - priv->disp_thread[i].thread); - priv->disp_thread[i].thread =NULL ; - } - -if (priv->event_thread[i].thread) {
drivers/gpu/drm/msm/msm_drv.c static int msm_drm_init(struct device *dev, struct drm_driver *drv) · line 594
Quoted 10 lines
drivers/gpu/drm/msm/msm_drv.c +2
-7-kthread_stop ( - priv->event_thread[i].thread); - priv->event_thread[i].thread =NULL ; - } - } - goto err_msm_uninit; - } +pr_warn ("display event thread priority update failed:%d\n" , + ret); }
same here
drivers/gpu/drm/msm/msm_drv.c static int msm_drm_init(struct device *dev, struct drm_driver *drv) · line 596
Quoted 2 lines
drivers/gpu/drm/msm/msm_drv.c +0
-0ret =drm_vblank_init (ddev, priv->num_crtcs);
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno