Re: [Intel-gfx] [PATCH v3] drm: move allocation out of drm_get_format_name()

From: Eric Engestrom
Date: Wed Nov 09 2016 - 06:43:30 EST


On Wednesday, 2016-11-09 02:13:25 +0100, Daniel Vetter wrote:
> On Wed, Nov 09, 2016 at 02:09:16AM +0100, Daniel Vetter wrote:
> > On Wed, Nov 09, 2016 at 12:17:52AM +0000, Eric Engestrom wrote:
> > > The function's behaviour was changed in 90844f00049e, without changing
> > > its signature, causing people to keep using it the old way without
> > > realising they were now leaking memory.
> > > Rob Clark also noticed it was also allocating GFP_KERNEL memory in
> > > atomic contexts, breaking them.
> > >
> > > Instead of having to allocate GFP_ATOMIC memory and fixing the callers
> > > to make them cleanup the memory afterwards, let's change the function's
> > > signature by having the caller take care of the memory and passing it to
> > > the function.
> > > The new parameter is a single-field struct in order to enforce the size
> > > of its buffer and help callers to correctly manage their memory.
> > >
> > > Fixes: 90844f00049e ("drm: make drm_get_format_name thread-safe")
> > > Cc: Rob Clark <robdclark@xxxxxxxxx>
> > > Cc: Christian KÃnig <christian.koenig@xxxxxxx>
> > > Acked-by: Christian KÃnig <christian.koenig@xxxxxxx>
> > > Acked-by: Rob Clark <robdclark@xxxxxxxxx>
> > > Acked-by: Sinclair Yeh <syeh@xxxxxxxxxx> (vmwgfx)
> > > Reviewed-by: Jani Nikula <jani.nikula@xxxxxxxxx>
> > > Suggested-by: Ville SyrjÃlà <ville.syrjala@xxxxxxxxxxxxxxx>
> > > Signed-off-by: Eric Engestrom <eric@xxxxxxxxxxxx>
> > > ---
> > > v3 - fix "Fixes" tag, replace it with an actual commit message
> > > - collect ack & r-b
> > >
> > > v2 - use single-field struct instead of typedef to let the compiler
> > > enforce the type (Christian KÃnig)
> >
> > Applied to drm-misc, thanks.
>
> Well, had to drop it again since it didn't compile:
>
>
> CC [M] drivers/gpu/drm/drm_blend.o
> drivers/gpu/drm/drm_atomic.c: In function âdrm_atomic_plane_print_stateâ:
> drivers/gpu/drm/drm_atomic.c:920:5: error: too few arguments to function âdrm_get_format_nameâ
> drm_get_format_name(fb->pixel_format));
> ^~~~~~~~~~~~~~~~~~~
> In file included from ./include/drm/drmP.h:71:0,
> from drivers/gpu/drm/drm_atomic.c:29:
> ./include/drm/drm_fourcc.h:65:7: note: declared here
> char *drm_get_format_name(uint32_t format, struct drm_format_name_buf *buf);
> ^~~~~~~~~~~~~~~~~~~
>
> Can you pls rebase onto drm-misc or linux-next or something?

That was based on airlied/drm-next (last fetched on Sunday I think),
I can rebase it on drm-misc if it helps, but it seems older than
drm-next.
Should I just rebase on top of current head of drm-next?