* [PATCH v4] drm/msm: validate display and event threads
@ 2018-10-10 21:11 Jeykumar Sankaran
[not found] ` <1539205876-23732-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Jeykumar Sankaran @ 2018-10-10 21:11 UTC (permalink / raw)
To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA
Cc: abhinavk-sgV2jX0FEOL9JmXXK+q4OQ, robdclark-Re5JQEeQqe8AvxtiuMwx3w,
hoegsberg-hpIqsD4AKlfQT0dZR+AlfA, seanpaul-F7+t8E8rja9g9hUCZPvPmw,
Jeykumar Sankaran, dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA
While creating display and event threads per crtc, validate
them before setting their priorities.
changes in v2:
- use dev_warn (Abhinav Kumar)
changes in v3:
- fix compilation error
changes in v4:
- Remove Change-Id (Sean Paul)
- Keep logging within 80 char limit (Sean Paul)
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
---
drivers/gpu/drm/msm/msm_drv.c | 49 ++++++++++++++-----------------------------
1 file changed, 16 insertions(+), 33 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 4904d0d..dcff812 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -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)
+ dev_warn(dev, "disp_thread set priority 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;
- }
+ dev_warn(dev, "event_thread set priority failed:%d\n",
+ ret);
}
ret = drm_vblank_init(ddev, priv->num_crtcs);
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply related [flat|nested] 2+ messages in thread[parent not found: <1539205876-23732-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>]
* Re: [PATCH v4] drm/msm: validate display and event threads [not found] ` <1539205876-23732-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> @ 2018-10-11 15:17 ` Sean Paul 0 siblings, 0 replies; 2+ messages in thread From: Sean Paul @ 2018-10-11 15:17 UTC (permalink / raw) To: Jeykumar Sankaran Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, robdclark-Re5JQEeQqe8AvxtiuMwx3w, seanpaul-F7+t8E8rja9g9hUCZPvPmw, abhinavk-sgV2jX0FEOL9JmXXK+q4OQ, hoegsberg-hpIqsD4AKlfQT0dZR+AlfA, freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA On Wed, Oct 10, 2018 at 02:11:16PM -0700, Jeykumar Sankaran wrote: > While creating display and event threads per crtc, validate > them before setting their priorities. > > changes in v2: > - use dev_warn (Abhinav Kumar) > changes in v3: > - fix compilation error > changes in v4: > - Remove Change-Id (Sean Paul) > - Keep logging within 80 char limit (Sean Paul) > > Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org> Reviewed-by: Sean Paul <seanpaul@chromium.org> I'll push to dpu-staging Thanks! Sean > --- > drivers/gpu/drm/msm/msm_drv.c | 49 ++++++++++++++----------------------------- > 1 file changed, 16 insertions(+), 33 deletions(-) > > diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c > index 4904d0d..dcff812 100644 > --- a/drivers/gpu/drm/msm/msm_drv.c > +++ b/drivers/gpu/drm/msm/msm_drv.c > @@ -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) > + dev_warn(dev, "disp_thread set priority 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; > - } > + dev_warn(dev, "event_thread set priority failed:%d\n", > + ret); > } > > ret = drm_vblank_init(ddev, priv->num_crtcs); > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project > -- Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-11 15:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-10 21:11 [PATCH v4] drm/msm: validate display and event threads Jeykumar Sankaran
[not found] ` <1539205876-23732-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-11 15:17 ` Sean Paul
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox