Skip to contentSkip to conversation

bpf: fix warning for crash_kexec

PATCH Superseded Hari Bathini 5 participants 9 messages Feb 9, 2024 – Mar 19, 2024

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: fix warning for crash_kexec

With [1], CONFIG_KEXEC & !CONFIG_CRASH_DUMP is supported but that 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]/

---
 kernel/bpf/helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/helpers.c +1 -1
index 4db1c658254c..e408d1115e26 100644
@@ -2545,7 +2545,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.43.0
#1 lore raw
Quoted 6 lines · Hari Bathini

With [1], CONFIG_KEXEC & !CONFIG_CRASH_DUMP is supported but that led to the below warning:

"WARN: resolve_btfids: unresolved symbol crash_kexec"

Fix it by using the appropriate #ifdef.

Same question here: how did you find this particular kconfig option (CONFIG_CRASH_DUMP) to use? Looking at the code, crash_kexec is defined in kernel/kexec_core.c and it's gated by CONFIG_KEXEC_CORE. So the existing ifdef seems correct?

#2 lore raw
Quoted 4 lines · Stanislav Fomichev
Quoted 3 lines · Hari Bathini

With [1], CONFIG_KEXEC & !CONFIG_CRASH_DUMP is supported but that led to the below warning:

Quoted 8 lines
Quoted 3 lines

"WARN: resolve_btfids: unresolved symbol crash_kexec"

Fix it by using the appropriate #ifdef.

Same question here: how did you find this particular kconfig option (CONFIG_CRASH_DUMP) to use? Looking at the code, crash_kexec is defined in kernel/kexec_core.c and it's gated by CONFIG_KEXEC_CORE. So the existing ifdef seems correct?

This patch is based on the latest next tree, I have made some changes to split the crash code from kexec_core.c. If you check next/master branch, crash_kexec is not in kernel/keec_core.c any more.

Acked-by
#3 lore raw
Quoted 9 lines · Baoquan He
Quoted 8 lines · Stanislav Fomichev
Quoted 6 lines · Hari Bathini

With [1], CONFIG_KEXEC & !CONFIG_CRASH_DUMP is supported but that 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

Same question here: how did you find this particular kconfig option (CONFIG_CRASH_DUMP) to use? Looking at the code, crash_kexec is defined in kernel/kexec_core.c and it's gated by CONFIG_KEXEC_CORE. So the existing ifdef seems correct?

This patch is based on the latest next tree, I have made some changes to split the crash code from kexec_core.c. If you check next/master branch, crash_kexec is not in kernel/keec_core.c any more.

makes sense, it should have fixes tag:

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

thanks,
jirka

#4 lore raw
Quoted 19 lines · Jiri Olsa
Quoted 9 lines · Baoquan He
Quoted 8 lines · Stanislav Fomichev
Quoted 6 lines · Hari Bathini

With [1], CONFIG_KEXEC & !CONFIG_CRASH_DUMP is supported but that 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

Same question here: how did you find this particular kconfig option (CONFIG_CRASH_DUMP) to use? Looking at the code, crash_kexec is defined in kernel/kexec_core.c and it's gated by CONFIG_KEXEC_CORE. So the existing ifdef seems correct?

This patch is based on the latest next tree, I have made some changes to split the crash code from kexec_core.c. If you check next/master branch, crash_kexec is not in kernel/keec_core.c any more.

Quoted 5 lines

makes sense, it should have fixes tag:

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

+1, would've been nice to have more details in the commit description :-)

Acked-by on v1 1/1
#5 lore raw
In reply to Hari Bathini
Quoted 11 lines · Hari Bathini

With [1], CONFIG_KEXEC & !CONFIG_CRASH_DUMP is supported but that 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]/

---

Good catch, thanks for fixing it.

Quoted 19 lines
 kernel/bpf/helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/helpers.c +1 -1
index 4db1c658254c..e408d1115e26 100644
@@ -2545,7 +2545,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.43.0
#6 lore raw
In reply to Hari Bathini

Just checking on whether this will go via bpf or mm tree?

Quoted 27 lines · Hari Bathini

With [1], CONFIG_KEXEC & !CONFIG_CRASH_DUMP is supported but that 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]/

---
  kernel/bpf/helpers.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/helpers.c +1 -1
index 4db1c658254c..e408d1115e26 100644
@@ -2545,7 +2545,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)
reviewer
#7 lore raw
Quoted 1 line · Hari Bathini

Just checking on whether this will go via bpf or mm tree?

Sending to bpf-next should be okay.
Could you resubmit the patch as CONFIG_CRASH_DUMP probably not available to bpf-next when you initially submitted the patch.

Quoted 29 lines · Hari Bathini
Quoted 26 lines

With [1], CONFIG_KEXEC & !CONFIG_CRASH_DUMP is supported but that 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]/

---
  kernel/bpf/helpers.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/helpers.c +1 -1
index 4db1c658254c..e408d1115e26 100644
@@ -2545,7 +2545,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)
#8 lore raw
Quoted 7 lines · Yonghong Song
Quoted 1 line · Hari Bathini

Just checking on whether this will go via bpf or mm tree?

Sending to bpf-next should be okay.
Could you resubmit the patch as CONFIG_CRASH_DUMP probably not available to bpf-next when you initially submitted the patch.

OK. Sent V2 with tags added and changelog updated:

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

Quoted 30 lines
Quoted 30 lines · Hari Bathini
Quoted 26 lines

With [1], CONFIG_KEXEC & !CONFIG_CRASH_DUMP is supported but that 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]/

---
  kernel/bpf/helpers.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/helpers.c +1 -1
index 4db1c658254c..e408d1115e26 100644
@@ -2545,7 +2545,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)