All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Daniel Vetter <daniel-/w4YWyX8dFk@public.gmane.org>
Cc: Shirish S <shirish.s12-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	shirish.s-5C7GfCeVMHo@public.gmane.org
Subject: Re: [PATCH] drm: add check for plane functions
Date: Fri, 17 Mar 2017 19:19:33 +0200	[thread overview]
Message-ID: <20170317171933.GU31595@intel.com> (raw)
In-Reply-To: <20170317165752.hm6htsx3jlhusx4s-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>

On Fri, Mar 17, 2017 at 05:57:52PM +0100, Daniel Vetter wrote:
> On Fri, Mar 17, 2017 at 01:08:43PM +0200, Ville Syrjälä wrote:
> > On Fri, Mar 17, 2017 at 03:46:34PM +0530, Shirish S wrote:
> > > On Fri, Mar 17, 2017 at 3:26 PM, Ville Syrjälä
> > > <ville.syrjala@linux.intel.com> wrote:
> > > > On Fri, Mar 17, 2017 at 01:25:08PM +0530, Shirish S wrote:
> > > >> update_plane() and disable_plane() functions
> > > >> assoiciated with setting plane are called
> > > >> without any check, causing kernel panic.
> > > >
> > > > Why are you registering a plane without the funcs?
> > > >
> > > Basically, enabling planes and making them fully functional is
> > > generally a 2 -step process,
> > > so i suggest for new drivers wanting to implement/re-design  planes,
> > > would like to tap
> > > the flow at enabling(listing caps) and later at ensuring it works.
> > 
> > I don't think there's much point in exposing something that
> > doesn't work. And even if you do, you could always just use
> > stub functions.
> 
> Yes, just wire up stub functions if you want to enable planes with
> multi-step patch series.
> 
> > > I noticed that there is a underlying assumption only for
> > > plane->(funcs) are implemented, whereas for
> > > other function for crtc/connector/encoder function calls there is a
> > > sanity check(or WARN_ON) through out the framework.
> > > 
> > > I believe this check wont cause any performance/functional impact.
> > > Please let me know if am missing anything.
> > > And further more help developers to focus on enabling planes via
> > > various tests without causing reboots/system hangs.
> > 
> > I don't particularly like adding more unconditional runtime checks
> > that just to protect developers from themselves. If you really
> > think there's value in these, then at least add the checks into
> > the plane init codepath so that it's a one time cost.
> > 
> > The same approach could be used for all the other non-optional
> > hooks. Otherwise the same WARN_ON()s would have to be sprinkled
> > all over the place, and there's always the risk of missing a few
> > codepaths that call a specific hook.
> 
> I think for these here there's negative value - it allows developers to
> create completely broken planes. Stub functions really seem like a much
> better idea.

I was thinking 

drm_whatever_init()
{
	if (WARN_ON(!funcs->mandatory_thing))
		return -EINVAL;
}

rather than putting the WARN_ON()s around each call of
funcs->mandatory_thing().

That will fail gracefully (which I guess is what people are after here),
and gives the developer a clear message what's missing.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-03-17 17:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-17  7:55 [PATCH] drm: add check for plane functions Shirish S
     [not found] ` <1489737308-30713-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org>
2017-03-17  9:56   ` Ville Syrjälä
     [not found]     ` <20170317095647.GN31595-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-03-17 10:16       ` Shirish S
     [not found]         ` <CAE=Z4VBsuzAPWSiy9NSXXFZfWEuSEi0miANhNmq5u0xR6M0BWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-17 11:08           ` Ville Syrjälä
     [not found]             ` <20170317110843.GQ31595-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-03-17 16:57               ` Daniel Vetter
     [not found]                 ` <20170317165752.hm6htsx3jlhusx4s-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2017-03-17 17:19                   ` Ville Syrjälä [this message]
2017-03-17 19:29                     ` Eric Anholt
     [not found]                       ` <87k27nsnuw.fsf-omZaPlIz5HhaEpDpdNBo/KxOck334EZe@public.gmane.org>
2017-03-20  4:28                         ` Shirish S
     [not found]                           ` <CAE=Z4VBgLWzrNVRkgKJNSmyBuDRrNmTuY3YoVTRKc956mB3TAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-20  8:21                             ` Daniel Vetter
     [not found]                               ` <20170320082131.kfn7qwihrvz4qdnc-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2017-03-20  9:42                                 ` Shirish S
     [not found]                                   ` <CAE=Z4VDp4tOhvbkk9OsG7EiG1_rTu8NWqoKUHUFnrVOc8s2Tuw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-21 15:27                                     ` Harry Wentland
2017-03-17 20:05   ` Harry Wentland

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=20170317171933.GU31595@intel.com \
    --to=ville.syrjala-vuqaysv1563yd54fqh9/ca@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=daniel-/w4YWyX8dFk@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=shirish.s-5C7GfCeVMHo@public.gmane.org \
    --cc=shirish.s12-Re5JQEeQqe8AvxtiuMwx3w@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 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.