Re: [PATCH] dyndbg: cleanup dynamic usage in ib_srp.c

From: Luis Chamberlain
Date: Fri Mar 10 2023 - 18:54:49 EST


On Fri, Mar 10, 2023 at 04:27:28PM -0500, Jason Baron wrote:
> Currently, in dynamic_debug.h we only provide
> DEFINE_DYNAMIC_DEBUG_METADATA() and DYNAMIC_DEBUG_BRANCH()
> definitions if CONFIG_DYNAMIC_CORE is enabled. Thus, drivers
> such as infiniband srp (see: drivers/infiniband/ulp/srp/ib_srp.c)
> must provide their own definitions for !CONFIG_DYNAMIC_CORE.
>
> Thus, let's move this !CONFIG_DYNAMIC_CORE case into dynamic_debug.h.
> However, the dynamic debug interfaces should really only be defined
> if CONFIG_DYNAMIC_DEBUG is set or CONFIG_DYNAMIC_CORE is set along
> with DYNAMIC_DEBUG_MODULE, (see:
> Documentation/admin-guide/dynamic-debug-howto.rst). Thus, the
> undefined case becomes: !((CONFIG_DYNAMIC_DEBUG ||
> (CONFIG_DYNAMIC_CORE && DYNAMIC_DEBUG_MODULE)).
> With those changes in place, we can remove the !CONFIG_DYNAMIC_CORE
> case from ib_srp.c
>
> This change was prompted by a build breakeage in ib_srp.c stemming
> from the inclusion of dynamic_debug.h unconditionally in module.h, due
> to commit 7deabd674988 ("dyndbg: use the module notifier callbacks").
> In that case, if we have CONFIG_DYNAMIC_CORE=y and
> CONFIG_DYNAMIC_DEBUG=n then the definitions for
> DEFINE_DYNAMIC_DEBUG_METADATA() and DYNAMIC_DEBUG_BRANCH() are defined
> once in ib_srp.c and then again in the dynamic_debug.h. This had been
> working prior to the above referenced commit because dynamic_debug.h
> was only pulled into ib_srp.c conditinally via printk.h if
> CONFIG_DYNAMIC_DEBUG was set.
>
> Cc: Jim Cromie <jim.cromie@xxxxxxxxx>
> Cc: Luis Chamberlain <mcgrof@xxxxxxxxxx>
> Cc: Vincenzo Palazzo <vincenzopalazzodev@xxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: Bart Van Assche <bvanassche@xxxxxxx>
> Fixes: 7deabd674988 ("dyndbg: use the module notifier callbacks")
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Link: https://urldefense.com/v3/__https://lore.kernel.org/oe-kbuild-all/202303071444.sIbZTDCy-lkp@xxxxxxxxx/__;!!GjvTz_vk!S6X1T0wd8DP8kxf6V06_uDcxrNwKJhPOU_7dY0PNghJRL0ahqvE8bh-5544ThnyRkpVyK4Q$
> Signed-off-by: Jason Baron <jbaron@xxxxxxxxxx>

Thanks, applied and pushed to modules-next!

Luis