public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
To: Rajendra Nayak <rnayak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	Jayant Shekhar <jshekhar-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	nganji-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	hoegsberg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	chandanu-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org
Subject: Re: [PATCH v2] drm/msm/dpu: Correct dpu destroy and disable order
Date: Tue, 13 Nov 2018 10:40:22 -0500	[thread overview]
Message-ID: <20181113154022.GK154160@art_vandelay> (raw)
In-Reply-To: <a2c1906e-f61d-3da2-45a4-3bc14c4201dd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

On Fri, Nov 09, 2018 at 11:37:17AM +0530, Rajendra Nayak wrote:
> 
> On 11/2/2018 6:19 PM, Jayant Shekhar wrote:
> > In case of msm drm bind failure, dpu_mdss_destroy is triggered.
> > In this function, resources are freed and pm runtime disable is
> > called, which triggers dpu_mdss_disable. Now in dpu_mdss_disable,
> > driver tries to access a memory which is already freed. This
> > results in kernel panic. Fix this by ensuring proper sequence
> > of dpu destroy and disable calls.
> > 
> > Changes in v2:
> >     - Removed double spacings [Jeykumar]
> > 
> > Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
> 
> I was testing this patch out and in my setup I see that with this
> change, during a dsi probe defer case, a dpu_mdss_enable() is called
> followed by a dpu_mdss_destroy() but dpu_mdss_disable() is never called.
> 
> This results in a mismatch in clock usecount causing the mdp clocks to
> stay enabled even with display turned off.

This suggests an unmatched pm_runtime_get/put. I just audited the code and
nothing stuck out to me in the probe defer case, things seem to be well matched.
Could you instrument the pm_runtime_* calls in msm/dpu and see if there's a _get
without a _put?

Sean

> 
> localhost ~ # cat /sys/kernel/debug/clk/clk_summary | grep mdss
>  disp_cc_mdss_rscc_ahb_clk            0        0        0           0          0     0  50000
>  disp_cc_mdss_axi_clk                 0        0        0           0          0     0  50000
>  disp_cc_mdss_ahb_clk                 0        0        0           0          0     0  50000
>        disp_cc_mdss_mdp_clk_src       1        1        0    19200000          0     0  50000
>           disp_cc_mdss_mdp_lut_clk       0        0        0    19200000          0     0  50000
>           disp_cc_mdss_mdp_clk        1        1        0    19200000          0     0  50000
>        disp_cc_mdss_vsync_clk_src       0        0        0    19200000          0     0  50000
> 
> Also to note, on an older 4.14 kernel, I do not see any issue in the order in which
> these functions are called in the dsi probe defer case, i.e its an enable followed by
> a disable and then a destroy (and that's without this patch)
> 
> > ---
> >   drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 5 +----
> >   1 file changed, 1 insertion(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c
> > index fd9c893..902bb4c 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c
> > @@ -156,18 +156,15 @@ static void dpu_mdss_destroy(struct drm_device *dev)
> >   	struct dpu_mdss *dpu_mdss = to_dpu_mdss(priv->mdss);
> >   	struct dss_module_power *mp = &dpu_mdss->mp;
> > +	pm_runtime_disable(dev->dev);
> >   	_dpu_mdss_irq_domain_fini(dpu_mdss);
> > -
> >   	free_irq(platform_get_irq(pdev, 0), dpu_mdss);
> > -
> >   	msm_dss_put_clk(mp->clk_config, mp->num_clk);
> >   	devm_kfree(&pdev->dev, mp->clk_config);
> >   	if (dpu_mdss->mmio)
> >   		devm_iounmap(&pdev->dev, dpu_mdss->mmio);
> >   	dpu_mdss->mmio = NULL;
> > -
> > -	pm_runtime_disable(dev->dev);
> >   	priv->mdss = NULL;
> >   }
> > 
> _______________________________________________
> Freedreno mailing list
> Freedreno@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/freedreno

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

      parent reply	other threads:[~2018-11-13 15:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-02 12:49 [PATCH v2] drm/msm/dpu: Correct dpu destroy and disable order Jayant Shekhar
     [not found] ` <1541162957-12796-1-git-send-email-jshekhar-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-02 13:15   ` Sean Paul
2018-11-02 14:32   ` Jordan Crouse
2018-11-05 19:31   ` Doug Anderson
2018-11-09  6:07   ` Rajendra Nayak
     [not found]     ` <a2c1906e-f61d-3da2-45a4-3bc14c4201dd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-13 15:40       ` Sean Paul [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181113154022.GK154160@art_vandelay \
    --to=sean-p7ytbzm4h96eqtr555yldq@public.gmane.org \
    --cc=abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=chandanu-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=hoegsberg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=jshekhar-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nganji-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=rnayak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox