Re: [PATCH v7 1/2] devcoredump: remove the useless gfp_t parameter in dev_coredumpv and dev_coredumpm
From: duoming
Date: Wed Aug 17 2022 - 10:06:34 EST
Hello,
On Wed, 17 Aug 2022 14:43:29 +0200 Greg KH wrote:
> On Wed, Aug 17, 2022 at 08:39:12PM +0800, Duoming Zhou wrote:
> > The dev_coredumpv() and dev_coredumpm() could not be used in atomic
> > context, because they call kvasprintf_const() and kstrdup() with
> > GFP_KERNEL parameter. The process is shown below:
> >
> > dev_coredumpv(.., gfp_t gfp)
> > dev_coredumpm(.., gfp_t gfp)
> > dev_set_name
> > kobject_set_name_vargs
> > kvasprintf_const(GFP_KERNEL, ...); //may sleep
> > kstrdup(s, GFP_KERNEL); //may sleep
> >
> > This patch removes gfp_t parameter of dev_coredumpv() and dev_coredumpm()
> > and changes the gfp_t parameter of kzalloc() in dev_coredumpm() to
> > GFP_KERNEL in order to show they could not be used in atomic context.
> >
> > Fixes: 833c95456a70 ("device coredump: add new device coredump class")
> > Reviewed-by: Brian Norris <briannorris@xxxxxxxxxxxx>
> > Reviewed-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
> > Signed-off-by: Duoming Zhou <duoming@xxxxxxxxxx>
> > ---
> > Changes in v7:
> > - Remove gfp_t flag in amdgpu device.
>
> Again, this creates a "flag day" where we have to be sure we hit all
> users of this api at the exact same time. This will prevent any new
> driver that comes into a maintainer tree during the next 3 months from
> ever being able to use this api without cauing build breakages in the
> linux-next tree.
>
> Please evolve this api to work properly for everyone at the same time,
> like was previously asked for so that we can take this change. It will
> take 2 releases, but that's fine.
Thank you for your reply, I will evolve this api to work properly for everyone.
If there are not any new drivers that use this api during the next 3 months,
I will send this patch again. Otherwise, I will wait until there are not new
users anymore.
Best regards,
Duoming Zhou