linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] earlycon: Fix compile error when SERIAL_CORE is m
@ 2022-10-20  3:27 Zhang Xiaoxu
  2022-10-20  5:04 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Zhang Xiaoxu @ 2022-10-20  3:27 UTC (permalink / raw)
  To: zhangxiaoxu5, linux-serial, gregkh, jirislaby, robh, ztong0001

When set CONFIG_SERIAL_EARLYCON=y and CONFIG_SERIAL_CORE=m, there is
a compile error as below:

  ld: vmlinux.o: in function `parse_options.constprop.0':
  earlycon.c:(.init.text+0xba5a3): undefined reference to `uart_parse_earlycon'

Since the SERIAL_EARLYCON use 'uart_parse_earlycon' which defined in
SERIAL_CORE, so should select rather than depends on.

Fixes: 9aac5887595b ("tty/serial: add generic serial earlycon")
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
---
 drivers/tty/serial/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 434f83168546..803f3dae793c 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -8,7 +8,7 @@ menu "Serial drivers"
 
 config SERIAL_EARLYCON
 	bool
-	depends on SERIAL_CORE
+	select SERIAL_CORE
 	help
 	  Support for early consoles with the earlycon parameter. This enables
 	  the console before standard serial driver is probed. The console is
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] earlycon: Fix compile error when SERIAL_CORE is m
  2022-10-20  3:27 [PATCH] earlycon: Fix compile error when SERIAL_CORE is m Zhang Xiaoxu
@ 2022-10-20  5:04 ` Greg KH
  2022-10-20 13:20   ` zhangxiaoxu (A)
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2022-10-20  5:04 UTC (permalink / raw)
  To: Zhang Xiaoxu; +Cc: linux-serial, jirislaby, robh, ztong0001

On Thu, Oct 20, 2022 at 11:27:22AM +0800, Zhang Xiaoxu wrote:
> When set CONFIG_SERIAL_EARLYCON=y and CONFIG_SERIAL_CORE=m, there is
> a compile error as below:
> 
>   ld: vmlinux.o: in function `parse_options.constprop.0':
>   earlycon.c:(.init.text+0xba5a3): undefined reference to `uart_parse_earlycon'
> 
> Since the SERIAL_EARLYCON use 'uart_parse_earlycon' which defined in
> SERIAL_CORE, so should select rather than depends on.

No, please try to never use "select".

> 
> Fixes: 9aac5887595b ("tty/serial: add generic serial earlycon")

So this has been a problem for a very very long time and never been
seen until now?  That feels wrong, what changed to cause this to not
ever be hit before with all of the tens of thousands of random configs
that have been built since this very old kernel?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] earlycon: Fix compile error when SERIAL_CORE is m
  2022-10-20  5:04 ` Greg KH
@ 2022-10-20 13:20   ` zhangxiaoxu (A)
  2022-11-03  2:28     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: zhangxiaoxu (A) @ 2022-10-20 13:20 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-serial, jirislaby, robh, ztong0001, peter



On 2022/10/20 13:04, Greg KH wrote:
> On Thu, Oct 20, 2022 at 11:27:22AM +0800, Zhang Xiaoxu wrote:
>> When set CONFIG_SERIAL_EARLYCON=y and CONFIG_SERIAL_CORE=m, there is
>> a compile error as below:
>>
>>    ld: vmlinux.o: in function `parse_options.constprop.0':
>>    earlycon.c:(.init.text+0xba5a3): undefined reference to `uart_parse_earlycon'
>>
>> Since the SERIAL_EARLYCON use 'uart_parse_earlycon' which defined in
>> SERIAL_CORE, so should select rather than depends on.
> 
> No, please try to never use "select".
> 
>>
>> Fixes: 9aac5887595b ("tty/serial: add generic serial earlycon")
> 
> So this has been a problem for a very very long time and never been
> seen until now?  That feels wrong, what changed to cause this to not
> ever be hit before with all of the tens of thousands of random configs
> that have been built since this very old kernel?
> 
Yes, 0fb9342d06b0 ("tty: serial: earlycon dependency") already fix the
same issue with add "depends on SERIAL_CORE".

But there are some other scenarios can trigger the same issue.

Use the config file in the bugzilla can reproduce the problem.
https://bugzilla.kernel.org/show_bug.cgi?id=216611

Bisect with this config, find out the following commit introduce the issue:
   cdcc41a256efe8 ("tty: serial: Kconfig: Allow SERIAL_QCOM_GENI_CONSOLE to be enabled if SERIAL_QCOM_GENI is a module")

  config SERIAL_QCOM_GENI
         tristate "QCOM on-chip GENI based serial port support"
         depends on ARCH_QCOM || COMPILE_TEST
         depends on QCOM_GENI_SE
         select SERIAL_CORE

  config SERIAL_QCOM_GENI_CONSOLE
         bool "QCOM GENI Serial Console support"
-       depends on SERIAL_QCOM_GENI=y
+       depends on SERIAL_QCOM_GENI
         select SERIAL_CORE_CONSOLE
         select SERIAL_EARLYCON
         help
           Serial console driver for Qualcomm Technologies Inc's GENI based
           QUP hardware.

Since 73abaf87f01b ("serial: earlycon: Refactor parse_options into serial core")
use the uart_parse_earlycon() which defined in SERIAL_CORE, so if SERIAL_EARLYCON=y,
should always select SERIAL_CORE=y.

If change to "depends on SERIAL_CORE=y", just WARNING when make olddefconfig, can't
auto select the depends to Y.
> thanks,
> 
> greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] earlycon: Fix compile error when SERIAL_CORE is m
  2022-10-20 13:20   ` zhangxiaoxu (A)
@ 2022-11-03  2:28     ` Greg KH
  2022-12-26 13:11       ` Thorsten Leemhuis
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2022-11-03  2:28 UTC (permalink / raw)
  To: zhangxiaoxu (A); +Cc: linux-serial, jirislaby, robh, ztong0001, peter

On Thu, Oct 20, 2022 at 09:20:24PM +0800, zhangxiaoxu (A) wrote:
> 
> 
> On 2022/10/20 13:04, Greg KH wrote:
> > On Thu, Oct 20, 2022 at 11:27:22AM +0800, Zhang Xiaoxu wrote:
> > > When set CONFIG_SERIAL_EARLYCON=y and CONFIG_SERIAL_CORE=m, there is
> > > a compile error as below:
> > > 
> > >    ld: vmlinux.o: in function `parse_options.constprop.0':
> > >    earlycon.c:(.init.text+0xba5a3): undefined reference to `uart_parse_earlycon'
> > > 
> > > Since the SERIAL_EARLYCON use 'uart_parse_earlycon' which defined in
> > > SERIAL_CORE, so should select rather than depends on.
> > 
> > No, please try to never use "select".
> > 
> > > 
> > > Fixes: 9aac5887595b ("tty/serial: add generic serial earlycon")
> > 
> > So this has been a problem for a very very long time and never been
> > seen until now?  That feels wrong, what changed to cause this to not
> > ever be hit before with all of the tens of thousands of random configs
> > that have been built since this very old kernel?
> > 
> Yes, 0fb9342d06b0 ("tty: serial: earlycon dependency") already fix the
> same issue with add "depends on SERIAL_CORE".
> 
> But there are some other scenarios can trigger the same issue.
> 
> Use the config file in the bugzilla can reproduce the problem.
> https://bugzilla.kernel.org/show_bug.cgi?id=216611
> 
> Bisect with this config, find out the following commit introduce the issue:
>   cdcc41a256efe8 ("tty: serial: Kconfig: Allow SERIAL_QCOM_GENI_CONSOLE to be enabled if SERIAL_QCOM_GENI is a module")
> 
>  config SERIAL_QCOM_GENI
>         tristate "QCOM on-chip GENI based serial port support"
>         depends on ARCH_QCOM || COMPILE_TEST
>         depends on QCOM_GENI_SE
>         select SERIAL_CORE
> 
>  config SERIAL_QCOM_GENI_CONSOLE
>         bool "QCOM GENI Serial Console support"
> -       depends on SERIAL_QCOM_GENI=y
> +       depends on SERIAL_QCOM_GENI
>         select SERIAL_CORE_CONSOLE
>         select SERIAL_EARLYCON
>         help
>           Serial console driver for Qualcomm Technologies Inc's GENI based
>           QUP hardware.

Then this is an issue with that driver Kconfig options, not with the tty
core options.  Please fix it up there.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] earlycon: Fix compile error when SERIAL_CORE is m
  2022-11-03  2:28     ` Greg KH
@ 2022-12-26 13:11       ` Thorsten Leemhuis
  0 siblings, 0 replies; 5+ messages in thread
From: Thorsten Leemhuis @ 2022-12-26 13:11 UTC (permalink / raw)
  To: Greg KH, zhangxiaoxu (A)
  Cc: linux-serial, jirislaby, robh, ztong0001, peter, Erich Löw

Hi, this is your Linux kernel regression tracker.

On 03.11.22 03:28, Greg KH wrote:
> On Thu, Oct 20, 2022 at 09:20:24PM +0800, zhangxiaoxu (A) wrote:
>>
>>
>> On 2022/10/20 13:04, Greg KH wrote:
>>> On Thu, Oct 20, 2022 at 11:27:22AM +0800, Zhang Xiaoxu wrote:
>>>> When set CONFIG_SERIAL_EARLYCON=y and CONFIG_SERIAL_CORE=m, there is
>>>> a compile error as below:
>>>>
>>>>    ld: vmlinux.o: in function `parse_options.constprop.0':
>>>>    earlycon.c:(.init.text+0xba5a3): undefined reference to `uart_parse_earlycon'

Zhang Xiaoxu, was this ever addressed? Doesn't look like it, but maybe I
misse dsomething. I'm asking because I noticed a regression report with
a similar failure msg:
https://bugzilla.kernel.org/show_bug.cgi?id=216847

To quote:
```
> Kernel: 6.1.1
> Observed: since 6.1.0
> Fail: "ld vmlinux" complaines on unresolved symbol"
> Tested compilers: clang 16.0.0.0 and gcc 13.0.0.0 show same picture.
> Tested link modes: standard as well as thin LTO.
> 
> Interesting: the symbol is correctly marked as module export like many others.
> But only this symbol fails at link stage.
> 
> Mitigation: compiling option "8250/16550 and compatible serial support" into the kernel.
> [...]
> Linker: ld.lld
> 
> Error messages:
> 
> LD vmlinux.o
> vmlinux.o: warning: objtool: early_init_dt_scan_memory+0x1ab: unreachable instruction
> OBJCOPY modules.builtin.modinfo
> GEN modules.builtin
> GEN .vmlinux.objs
> 
> LD      vmlinux
> ld.lld: error: undefined symbol: uart_parse_earlycon
>>>> referenced by usercopy_64.c
>>>>               vmlinux.o:(parse_options)
> 
> So the INTERESTING symbol is uart_parse_earlycon
```

Or is that a totally different issue?

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat)

P.S.: As the Linux kernel's regression tracker I deal with a lot of
reports and sometimes miss something important when writing mails like
this. If that's the case here, don't hesitate to tell me in a public
reply, it's in everyone's interest to set the public record straight.

>>>> Since the SERIAL_EARLYCON use 'uart_parse_earlycon' which defined in
>>>> SERIAL_CORE, so should select rather than depends on.
>>>
>>> No, please try to never use "select".
>>>
>>>>
>>>> Fixes: 9aac5887595b ("tty/serial: add generic serial earlycon")
>>>
>>> So this has been a problem for a very very long time and never been
>>> seen until now?  That feels wrong, what changed to cause this to not
>>> ever be hit before with all of the tens of thousands of random configs
>>> that have been built since this very old kernel?
>>>
>> Yes, 0fb9342d06b0 ("tty: serial: earlycon dependency") already fix the
>> same issue with add "depends on SERIAL_CORE".
>>
>> But there are some other scenarios can trigger the same issue.
>>
>> Use the config file in the bugzilla can reproduce the problem.
>> https://bugzilla.kernel.org/show_bug.cgi?id=216611
>>
>> Bisect with this config, find out the following commit introduce the issue:
>>   cdcc41a256efe8 ("tty: serial: Kconfig: Allow SERIAL_QCOM_GENI_CONSOLE to be enabled if SERIAL_QCOM_GENI is a module")
>>
>>  config SERIAL_QCOM_GENI
>>         tristate "QCOM on-chip GENI based serial port support"
>>         depends on ARCH_QCOM || COMPILE_TEST
>>         depends on QCOM_GENI_SE
>>         select SERIAL_CORE
>>
>>  config SERIAL_QCOM_GENI_CONSOLE
>>         bool "QCOM GENI Serial Console support"
>> -       depends on SERIAL_QCOM_GENI=y
>> +       depends on SERIAL_QCOM_GENI
>>         select SERIAL_CORE_CONSOLE
>>         select SERIAL_EARLYCON
>>         help
>>           Serial console driver for Qualcomm Technologies Inc's GENI based
>>           QUP hardware.
> 
> Then this is an issue with that driver Kconfig options, not with the tty
> core options.  Please fix it up there.
> 
> thanks,
> 
> greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-12-26 13:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-20  3:27 [PATCH] earlycon: Fix compile error when SERIAL_CORE is m Zhang Xiaoxu
2022-10-20  5:04 ` Greg KH
2022-10-20 13:20   ` zhangxiaoxu (A)
2022-11-03  2:28     ` Greg KH
2022-12-26 13:11       ` Thorsten Leemhuis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).