2024-06-06 18:49:45

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 1/1] serial: 8250_platform: Explicitly show we initialise ISA ports only once

serial8250_isa_init_ports() uses home grown approach to make itself
a singleton. Instead, explicitly show that we initialise ISA ports
once by providing a helper function which calls the original function
via DO_ONCE() macro.

Signed-off-by: Andy Shevchenko <[email protected]>
---
drivers/tty/serial/8250/8250_platform.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_platform.c b/drivers/tty/serial/8250/8250_platform.c
index ded985182e04..5817c1d72314 100644
--- a/drivers/tty/serial/8250/8250_platform.c
+++ b/drivers/tty/serial/8250/8250_platform.c
@@ -9,6 +9,7 @@
#include <linux/array_size.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
+#include <linux/once.h>
#include <linux/platform_device.h>

#include <linux/serial_8250.h>
@@ -53,15 +54,10 @@ void serial8250_set_isa_configurator(serial8250_isa_config_fn v)
}
EXPORT_SYMBOL(serial8250_set_isa_configurator);

-void __init serial8250_isa_init_ports(void)
+static void __init __serial8250_isa_init_ports(void)
{
- static int first = 1;
int i, irqflag = 0;

- if (!first)
- return;
- first = 0;
-
if (nr_uarts > UART_NR)
nr_uarts = UART_NR;

@@ -102,6 +98,11 @@ void __init serial8250_isa_init_ports(void)
}
}

+void __init serial8250_isa_init_ports(void)
+{
+ DO_ONCE(__serial8250_isa_init_ports);
+}
+
/*
* Register a set of serial devices attached to a platform device. The
* list is terminated with a zero flags entry, which means we expect
--
2.43.0.rc1.1336.g36b5255a03ac



2024-06-07 13:59:59

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v1 1/1] serial: 8250_platform: Explicitly show we initialise ISA ports only once

Hi Andy,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on tty/tty-next next-20240607]
[cannot apply to tty/tty-linus linus/master v6.10-rc2]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/serial-8250_platform-Explicitly-show-we-initialise-ISA-ports-only-once/20240607-025109
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
patch link: https://lore.kernel.org/r/20240606184841.3102545-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] serial: 8250_platform: Explicitly show we initialise ISA ports only once
config: loongarch-defconfig (https://download.01.org/0day-ci/archive/20240607/[email protected]/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240607/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/tty/serial/8250/8250_platform.o: warning: objtool: __jump_table+0x0: special: can't find orig instruction


objdump-func vmlinux.o __jump_table:

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2024-06-11 15:55:48

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v1 1/1] serial: 8250_platform: Explicitly show we initialise ISA ports only once

+Cc: initial authors of Loongarch64 jump table implementation and people who touched that code.

On Fri, Jun 07, 2024 at 09:48:51PM +0800, kernel test robot wrote:
> Hi Andy,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on tty/tty-testing]
> [also build test WARNING on tty/tty-next next-20240607]
> [cannot apply to tty/tty-linus linus/master v6.10-rc2]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/serial-8250_platform-Explicitly-show-we-initialise-ISA-ports-only-once/20240607-025109
> base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
> patch link: https://lore.kernel.org/r/20240606184841.3102545-1-andriy.shevchenko%40linux.intel.com
> patch subject: [PATCH v1 1/1] serial: 8250_platform: Explicitly show we initialise ISA ports only once
> config: loongarch-defconfig (https://download.01.org/0day-ci/archive/20240607/[email protected]/config)
> compiler: loongarch64-linux-gcc (GCC) 13.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240607/[email protected]/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <[email protected]>
> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
>
> All warnings (new ones prefixed by >>):
>
> >> drivers/tty/serial/8250/8250_platform.o: warning: objtool: __jump_table+0x0: special: can't find orig instruction
>
> objdump-func vmlinux.o __jump_table:

Folks, can you look into it? It sounds like jump table is misimplemented for
this architecture (but I'm quite unsure). Similar issue LKP reported here:
https://lore.kernel.org/all/[email protected]/

P.S. Is it objtool issue or kernel issue? (Just thinking/questioning loudly)

--
With Best Regards,
Andy Shevchenko