[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <691143b5-4636-4911-9c93-437b95f46157@amd.com>
Date: Tue, 23 Apr 2024 16:38:26 +0530
From: "Aithal, Srikanth" <sraithal@....com>
To: Ard Biesheuvel <ardb+git@...gle.com>, linux-kernel@...r.kernel.org
Cc: Ard Biesheuvel <ardb@...nel.org>, Masahiro Yamada <masahiroy@...nel.org>,
Arnd Bergmann <arnd@...db.de>, Martin KaFai Lau <martin.lau@...ux.dev>,
linux-arch@...r.kernel.org, linux-kbuild@...r.kernel.org,
bpf@...r.kernel.org, Andrii Nakryiko <andrii@...nel.org>,
Jiri Olsa <olsajiri@...il.com>
Subject: Re: [PATCH v3 0/3] kbuild: Avoid weak external linkage where possible
On 4/15/2024 1:28 PM, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@...nel.org>
>
> Weak external linkage is intended for cases where a symbol reference
> can remain unsatisfied in the final link. Taking the address of such a
> symbol should yield NULL if the reference was not satisfied.
>
> Given that ordinary RIP or PC relative references cannot produce NULL,
> some kind of indirection is always needed in such cases, and in position
> independent code, this results in a GOT entry. In ordinary code, it is
> arch specific but amounts to the same thing.
>
> While unavoidable in some cases, weak references are currently also used
> to declare symbols that are always defined in the final link, but not in
> the first linker pass. This means we end up with worse codegen for no
> good reason. So let's clean this up, by providing preliminary
> definitions that are only used as a fallback.
>
> Changes since v2:
> - fix build issue in patch #3 reported by Jiri
> - add Arnd's acks
>
> Changes since v1:
> - update second occurrence of BTF start/end markers
> - drop NULL check of __start_BTF[] which is no longer meaningful
> - avoid the preliminary BTF symbols if CONFIG_DEBUG_INFO_BTF is not set
> - add Andrii's ack to patch #3
> - patches #1 and #2 unchanged
>
> Cc: Masahiro Yamada <masahiroy@...nel.org>
> Cc: Arnd Bergmann <arnd@...db.de>
> Cc: Martin KaFai Lau <martin.lau@...ux.dev>
> Cc: linux-arch@...r.kernel.org
> Cc: linux-kbuild@...r.kernel.org
> Cc: bpf@...r.kernel.org
> Cc: Andrii Nakryiko <andrii@...nel.org>
> Cc: Jiri Olsa <olsajiri@...il.com>
>
> Ard Biesheuvel (3):
> kallsyms: Avoid weak references for kallsyms symbols
> vmlinux: Avoid weak reference to notes section
> btf: Avoid weak external references
>
> include/asm-generic/vmlinux.lds.h | 28 ++++++++++++++++++
> kernel/bpf/btf.c | 7 +++--
> kernel/bpf/sysfs_btf.c | 6 ++--
> kernel/kallsyms.c | 6 ----
> kernel/kallsyms_internal.h | 30 ++++++++------------
> kernel/ksysfs.c | 4 +--
> lib/buildid.c | 4 +--
> 7 files changed, 52 insertions(+), 33 deletions(-)
>
When I build linux-next20240423
[https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tag/?h=next-20240423]
kernel using the kernel config attached, I see a lot of hard/soft
lockups like the one below:
Apr 23 10:47:45 kernel: [ 292.932021] RIP:
0010:fixed_percpu_data+0xffffffff8c6a0b26/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021] Code: cc cc cc b8 fe ff ff ff eb
df e8 65 b5 f5 00 0f 1f 44 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90
90 90 90 66 0f 1f 00 f3 90 <c3> cc cc cc cc 0f 1f 44 00 00 90 90 90 90
90 90 90 90 90 90 90 90
Apr 23 10:47:45 kernel: [ 292.932021] RSP: 0018:ff705b99c01afe30
EFLAGS: 00000246
Apr 23 10:47:45 kernel: [ 292.932021] RAX: 0000000000000000 RBX:
ff705b99c007bd00 RCX: 0000000000000000
Apr 23 10:47:45 kernel: [ 292.932021] RDX: ff47f74381c00000 RSI:
0000000000000080 RDI: ffffffff8e65e120
Apr 23 10:47:45 kernel: [ 292.932021] RBP: ff705b99c01afe70 R08:
0000000000000014 R09: 0000000000000001
Apr 23 10:47:45 kernel: [ 292.932021] R10: 0000000000000001 R11:
0000000000000001 R12: ff705b99c007bd24
Apr 23 10:47:45 kernel: [ 292.932021] R13: 0000000000000001 R14:
ffffffff8e65e120 R15: 0000000000000001
Apr 23 10:47:45 kernel: [ 292.932021] FS: 0000000000000000(0000)
GS:ff47f74381c00000(0000) knlGS:0000000000000000
Apr 23 10:47:45 kernel: [ 292.932021] CS: 0010 DS: 0000 ES: 0000 CR0:
0000000080050033
Apr 23 10:47:45 kernel: [ 292.932021] CR2: ff47f7448d3ff000 CR3:
000800404a45a001 CR4: 0000000000771ef0
Apr 23 10:47:45 kernel: [ 292.932021] PKRU: 55555554
Apr 23 10:47:45 kernel: [ 292.933349] watchdog: Watchdog detected hard
LOCKUP on cpu 14
Apr 23 10:47:45 kernel: [ 292.932021] Call Trace:
Apr 23 10:47:45 kernel: [ 292.932021] <IRQ>
Apr 23 10:47:45 kernel: [ 292.932021] ?
fixed_percpu_data+0xffffffff8c4d189d/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021] ?
fixed_percpu_data+0xffffffff8c6c3656/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021] ?
fixed_percpu_data+0xffffffff8c6c3460/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021] ?
fixed_percpu_data+0xffffffff8c651e71/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021] ?
fixed_percpu_data+0xffffffff8c652fd0/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021] ?
fixed_percpu_data+0xffffffff8c651010/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021] ?
fixed_percpu_data+0xffffffff8c66591d/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021] ?
fixed_percpu_data+0xffffffff8c6659a9/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021] ?
fixed_percpu_data+0xffffffff8c518bbd/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021] ?
fixed_percpu_data+0xffffffff8d5fb167/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021] </IRQ>
Apr 23 10:47:45 kernel: [ 292.932021] <TASK>
Apr 23 10:47:45 kernel: [ 292.932021] ?
fixed_percpu_data+0xffffffff8d8016ef/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.935984] watchdog: Watchdog detected hard
LOCKUP on cpu 76
Apr 23 10:47:45 kernel: [ 292.932021] ?
fixed_percpu_data+0xffffffff8c6a0b26/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021] ?
fixed_percpu_data+0xffffffff8c6a0be4/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021] ?
fixed_percpu_data+0xffffffff8c6a0b40/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021]
fixed_percpu_data+0xffffffff8c6a0743/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021] ?
fixed_percpu_data+0xffffffff8c5a2120/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021]
fixed_percpu_data+0xffffffff8c5a2206/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021]
fixed_percpu_data+0xffffffff8c5962a8/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021] ?
fixed_percpu_data+0xffffffff8c5961b0/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021]
fixed_percpu_data+0xffffffff8c4dd4a0/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021] ?
fixed_percpu_data+0xffffffff8c5961b0/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021]
fixed_percpu_data+0xffffffff8c403f0a/0xffffffff8f030000
Apr 23 10:47:45 kernel: [ 292.932021] </TASK>
Apr 23 10:47:45 kernel: [ 288.996021] watchdog: BUG: soft lockup -
CPU#67 stuck for 257s! [migration/67:424]
Apr 23 10:47:45 kernel: [ 288.996021] Modules linked in:
Apr 23 10:47:45 kernel: [ 288.996021] CPU: 67 PID: 424 Comm:
migration/67 Tainted: G L 6.9.0-rc5-0bdad2836 #3
If I build commit before this [82d460ed], things work well.
Bad commit 0bdad28369fc5e93de39b5046228ed78e982fc71
Author: Ard Biesheuvel <ardb@...nel.org>
Date: Sat Apr 20 16:53:04 2024 +0200
I hit this only on Ubuntu host. RHEL host it seem to work well. Both
have same kconfig related to kallsysms though:
CONFIG_KALLSYMS=y
# CONFIG_KALLSYMS_SELFTEST is not set
CONFIG_KALLSYMS_ALL=y
CONFIG_KALLSYMS_ABSOLUTE_PERCPU=y
CONFIG_KALLSYMS_BASE_RELATIVE=y
View attachment "kernel_config" of type "text/plain" (182271 bytes)
Powered by blists - more mailing lists