[Intel-gfx] [PATCH 14/38] drm/i915: Introduce the i915_user_extension_method

Chris Wilson chris at chris-wilson.co.uk
Fri Mar 1 18:57:10 UTC 2019


Quoting Tvrtko Ursulin (2019-03-01 15:39:13)
> 
> On 01/03/2019 14:03, Chris Wilson wrote:
> > +int i915_user_extensions(struct i915_user_extension __user *ext,
> > +                      const i915_user_extension_fn *tbl,
> > +                      unsigned long count,
> > +                      void *data)
> > +{
> > +     unsigned int stackdepth = 512;
> > +
> > +     while (ext) {
> > +             int err;
> > +             u64 x;
> > +
> > +             if (!stackdepth--) /* recursion vs useful flexibility */
> > +                     return -EINVAL;
> 
> I don't get this. What stack? Did you mean "static unsigned int 
> stackdepth" in case someone puts i915_user_extension into the extension 
> table? Or just a limit on number of chained extensions? But you are not 
> processing the recursively here.

It's iterative recursion :)

I still think of this loop in terms of its simple tail recursion.

And if we need to individual levels for unwind, that is a manual stack.
-Chris


More information about the Intel-gfx mailing list