Re: linux-next: build failure after merge of the kgdb tree

From: Doug Anderson
Date: Tue May 19 2020 - 11:52:59 EST


Hi,

On Tue, May 19, 2020 at 7:58 AM Doug Anderson <dianders@xxxxxxxxxxxx> wrote:
>
> Hi,
>
> On Tue, May 19, 2020 at 7:05 AM Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:
> >
> > Hi all,
> >
> > After merging the kgdb tree, today's linux-next build (x86_64
> > allmodconfig) failed like this:
> >
> > drivers/tty/serial/kgdboc.c:418:13: error: expected declaration specifiers or '...' before string constant
> > 418 | early_param("ekgdboc", kgdboc_early_init);
> > | ^~~~~~~~~
> > drivers/tty/serial/kgdboc.c:418:24: error: expected declaration specifiers or '...' before 'kgdboc_early_init'
> > 418 | early_param("ekgdboc", kgdboc_early_init);
> > | ^~~~~~~~~~~~~~~~~
> > drivers/tty/serial/kgdboc.c:546:13: error: expected declaration specifiers or '...' before string constant
> > 546 | early_param("kgdboc_earlycon", kgdboc_earlycon_init);
> > | ^~~~~~~~~~~~~~~~~
> > drivers/tty/serial/kgdboc.c:546:32: error: expected declaration specifiers or '...' before 'kgdboc_earlycon_init'
> > 546 | early_param("kgdboc_earlycon", kgdboc_earlycon_init);
> > | ^~~~~~~~~~~~~~~~~~~~
> > drivers/tty/serial/kgdboc.c:505:19: warning: 'kgdboc_earlycon_init' defined but not used [-Wunused-function]
> > 505 | static int __init kgdboc_earlycon_init(char *opt)
> > | ^~~~~~~~~~~~~~~~~~~~
> > drivers/tty/serial/kgdboc.c:411:19: warning: 'kgdboc_early_init' defined but not used [-Wunused-function]
> > 411 | static int __init kgdboc_early_init(char *opt)
> > | ^~~~~~~~~~~~~~~~~
> >
> > Caused by commit
> >
> > 220995622da5 ("kgdboc: Add kgdboc_earlycon to support early kgdb using boot consoles")
> >
> > I have used the kgdb tree from next-20200518 for today.
>
> Ugh. Actually, I think the commit to blame is:
>
> eae3e19ca930 ("kgdboc: Remove useless #ifdef
> CONFIG_KGDB_SERIAL_CONSOLE in kgdboc")
>
> The next commit just made it worse. Apparently the #ifdef wasn't so
> useless after all. It was just subtly keeping the code from compiling
> when kgdboc was used as a module. That's because when it's a module
> we instead get this defined:
>
> #define CONFIG_KGDB_SERIAL_CONSOLE_MODULE 1
>
> Apparently I didn't re-test as a module after I made this change in
> one of the later spins. :(
>
> I think I can whip up a quick patch that uses "IS_BUILTIN(option)".
> Basically this should go back to how the code was in one of the
> earlier patchsets where I tested this.

Fix posted at:

20200519084345.1.I91670accc8a5ddabab227eb63bb4ad3e2e9d2b58@changeid">https://lore.kernel.org/r/20200519084345.1.I91670accc8a5ddabab227eb63bb4ad3e2e9d2b58@changeid

I have confirmed:

* x86_64 allmodconfig atop the kgdb tree compiles.

* Building and using kgdboc as a module works with this patch on my
local 5.4-based tree. Loaded the module both with module parameters
and via echoing to sysfs. Unloaded the module and confirmed it works.

* Building and using kgdboc builtin allows me to do kgdb_earlycon on
my local 5.4-based tree.


-Doug