Skip to contentSkip to conversation

bpf: fix warning for crash_kexec

PATCH In review Hari Bathini 3 participants 4 messages Mar 19, 2024 – Mar 22, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 bpf: fix warning for crash_kexec

With [1], crash dump specific code is moved out of CONFIG_KEXEC_CORE and placed under CONFIG_CRASH_DUMP, where it is more appropriate. And since CONFIG_KEXEC & !CONFIG_CRASH_DUMP build option is supported with that, it led to the below warning:

"WARN: resolve_btfids: unresolved symbol crash_kexec"

Fix it by using the appropriate #ifdef.

[1] https://lore.kernel.org/all/[email protected]/

Fixes 29fd9ae62910 ("crash: split crash dumping code out from kexec_core.c")

---

Changes in v2:
* Updated changelog.
* Added Fixes and Acked-by tags.

 kernel/bpf/helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/helpers.c +1 -1
index a89587859571..449b9a5d3fe3 100644
@@ -2548,7 +2548,7 @@ __bpf_kfunc void bpf_throw(u64 cookie)
 __bpf_kfunc_end_defs();
 
 BTF_KFUNCS_START(generic_btf_ids)
-#ifdef CONFIG_KEXEC_CORE
+#ifdef CONFIG_CRASH_DUMP
 BTF_ID_FLAGS(func, crash_kexec, KF_DESTRUCTIVE)
 #endif
 BTF_ID_FLAGS(func, bpf_obj_new_impl, KF_ACQUIRE | KF_RET_NULL)
Signature · 1 line
2.44.0
#1 lore raw
Quoted 6 lines · Hari Bathini

With [1], crash dump specific code is moved out of CONFIG_KEXEC_CORE and placed under CONFIG_CRASH_DUMP, where it is more appropriate. And since CONFIG_KEXEC & !CONFIG_CRASH_DUMP build option is supported with that, it led to the below warning:

Quoted 8 lines

"WARN: resolve_btfids: unresolved symbol crash_kexec"

Fix it by using the appropriate #ifdef.

[1] https://lore.kernel.org/all/[email protected]/

Fixes 29fd9ae62910 ("crash: split crash dumping code out from kexec_core.c")

I don't think either bpf or bpf-next have this commit just yet, so landing it in the bpf/bpf-next tree doesn't make much sense. It probably would be best to land it through the tree which does the CONFIG_KEXEC_CORE -> CONFIG_CRASH_DUMP change in kernel/Makefile.

pw-bot: cr

Quoted 29 lines

---

Changes in v2:
* Updated changelog.
* Added Fixes and Acked-by tags.

 kernel/bpf/helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/helpers.c +1 -2
index a89587859571..449b9a5d3fe3 100644
@@ -2548,7 +2548,7 @@ __bpf_kfunc void bpf_throw(u64 cookie)
 __bpf_kfunc_end_defs();
 
 BTF_KFUNCS_START(generic_btf_ids)
-#ifdef CONFIG_KEXEC_CORE
+#ifdef CONFIG_CRASH_DUMP
 BTF_ID_FLAGS(func, crash_kexec, KF_DESTRUCTIVE)
 #endif
 BTF_ID_FLAGS(func, bpf_obj_new_impl, KF_ACQUIRE | KF_RET_NULL)
--

2.44.0

reviewer
#2 lore raw
Quoted 10 lines · Andrii Nakryiko
Quoted 9 lines · Hari Bathini

With [1], crash dump specific code is moved out of CONFIG_KEXEC_CORE and placed under CONFIG_CRASH_DUMP, where it is more appropriate. And since CONFIG_KEXEC & !CONFIG_CRASH_DUMP build option is supported with that, it led to the below warning:

"WARN: resolve_btfids: unresolved symbol crash_kexec"

Fix it by using the appropriate #ifdef.

Quoted 8 lines
Quoted 4 lines

[1] https://lore.kernel.org/all/[email protected]/

Fixes 29fd9ae62910 ("crash: split crash dumping code out from kexec_core.c")

I don't think either bpf or bpf-next have this commit just yet, so landing it in the bpf/bpf-next tree doesn't make much sense. It probably would be best to land it through the tree which does the CONFIG_KEXEC_CORE -> CONFIG_CRASH_DUMP change in kernel/Makefile.

With bpf-next, I found the config at kernel/Kconfig.kexec:

config CRASH_DUMP
        bool "kernel crash dumps"
        depends on ARCH_SUPPORTS_CRASH_DUMP
        select CRASH_CORE
        select KEXEC_CORE
        help

...

Quoted 31 lines

pw-bot: cr

Quoted 29 lines

---

Changes in v2:
* Updated changelog.
* Added Fixes and Acked-by tags.

  kernel/bpf/helpers.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/helpers.c +1 -2
index a89587859571..449b9a5d3fe3 100644
@@ -2548,7 +2548,7 @@ __bpf_kfunc void bpf_throw(u64 cookie)
  __bpf_kfunc_end_defs();
 
  BTF_KFUNCS_START(generic_btf_ids)
-#ifdef CONFIG_KEXEC_CORE
+#ifdef CONFIG_CRASH_DUMP
  BTF_ID_FLAGS(func, crash_kexec, KF_DESTRUCTIVE)
  #endif
  BTF_ID_FLAGS(func, bpf_obj_new_impl, KF_ACQUIRE | KF_RET_NULL)
--

2.44.0

#3 lore raw
In reply to Andrii Nakryiko
Quoted 13 lines · Andrii Nakryiko
Quoted 12 lines · Hari Bathini

With [1], crash dump specific code is moved out of CONFIG_KEXEC_CORE and placed under CONFIG_CRASH_DUMP, where it is more appropriate. And since CONFIG_KEXEC & !CONFIG_CRASH_DUMP build option is supported with that, it led to the below warning:

"WARN: resolve_btfids: unresolved symbol crash_kexec"

Fix it by using the appropriate #ifdef.

[1] https://lore.kernel.org/all/[email protected]/

Quoted 7 lines
Quoted 2 lines
Fixes 29fd9ae62910 ("crash: split crash dumping code out from kexec_core.c")

I don't think either bpf or bpf-next have this commit just yet, so landing it in the bpf/bpf-next tree doesn't make much sense. It probably would be best to land it through the tree which does the CONFIG_KEXEC_CORE -> CONFIG_CRASH_DUMP change in kernel/Makefile.

Yeah, [1] patches were still not in bpf-next when I sent this v2. Andrew, can you please consider pulling this via -mm tree if that sounds more appropriate?

Thanks
Hari

Quoted 31 lines

pw-bot: cr

Quoted 29 lines

---

Changes in v2:
* Updated changelog.
* Added Fixes and Acked-by tags.

  kernel/bpf/helpers.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/helpers.c +1 -2
index a89587859571..449b9a5d3fe3 100644
@@ -2548,7 +2548,7 @@ __bpf_kfunc void bpf_throw(u64 cookie)
  __bpf_kfunc_end_defs();
 
  BTF_KFUNCS_START(generic_btf_ids)
-#ifdef CONFIG_KEXEC_CORE
+#ifdef CONFIG_CRASH_DUMP
  BTF_ID_FLAGS(func, crash_kexec, KF_DESTRUCTIVE)
  #endif
  BTF_ID_FLAGS(func, bpf_obj_new_impl, KF_ACQUIRE | KF_RET_NULL)
--

2.44.0