Re: [PATCH v7 1/2] devcoredump: remove the useless gfp_t parameter in dev_coredumpv and dev_coredumpm

From: Greg KH
Date: Wed Aug 17 2022 - 08:43:40 EST


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.

thanks,

greg k-h