diff mbox series

[linux-next] bpf: fix warning for crash_kexec

Message ID 20240209123520.778599-1-hbathini@linux.ibm.com (mailing list archive)
State Handled Elsewhere
Delegated to: BPF
Headers show
Series [linux-next] bpf: fix warning for crash_kexec | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-PR success PR summary
netdev/tree_selection success Guessing tree name failed - patch did not apply
bpf/vmtest-bpf-next-VM_Test-21 success Logs for x86_64-gcc / test (test_maps, false, 360) / test_maps on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-26 success Logs for x86_64-gcc / test (test_verifier, false, 360) / test_verifier on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-25 success Logs for x86_64-gcc / test (test_progs_parallel, true, 30) / test_progs_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-27 success Logs for x86_64-gcc / veristat / veristat on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-29 success Logs for x86_64-llvm-17 / build-release / build for x86_64 with llvm-17 and -O2 optimization
bpf/vmtest-bpf-next-VM_Test-33 success Logs for x86_64-llvm-17 / test (test_verifier, false, 360) / test_verifier on x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-41 success Logs for x86_64-llvm-18 / test (test_verifier, false, 360) / test_verifier on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-22 success Logs for x86_64-gcc / test (test_progs, false, 360) / test_progs on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-23 success Logs for x86_64-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-24 success Logs for x86_64-gcc / test (test_progs_no_alu32_parallel, true, 30) / test_progs_no_alu32_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-30 success Logs for x86_64-llvm-17 / test (test_maps, false, 360) / test_maps on x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-31 success Logs for x86_64-llvm-17 / test (test_progs, false, 360) / test_progs on x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-32 success Logs for x86_64-llvm-17 / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-37 success Logs for x86_64-llvm-18 / test (test_maps, false, 360) / test_maps on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-39 success Logs for x86_64-llvm-18 / test (test_progs_cpuv4, false, 360) / test_progs_cpuv4 on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-40 success Logs for x86_64-llvm-18 / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-38 success Logs for x86_64-llvm-18 / test (test_progs, false, 360) / test_progs on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-16 success Logs for s390x-gcc / test (test_verifier, false, 360) / test_verifier on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-14 success Logs for s390x-gcc / test (test_progs, false, 360) / test_progs on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-5 success Logs for aarch64-gcc / build-release
bpf/vmtest-bpf-next-VM_Test-4 success Logs for aarch64-gcc / build / build for aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-10 success Logs for aarch64-gcc / veristat
bpf/vmtest-bpf-next-VM_Test-12 success Logs for s390x-gcc / build-release
bpf/vmtest-bpf-next-VM_Test-13 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-15 success Logs for x86_64-gcc / build-release
bpf/vmtest-bpf-next-VM_Test-6 success Logs for aarch64-gcc / test (test_maps, false, 360) / test_maps on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-9 success Logs for aarch64-gcc / test (test_verifier, false, 360) / test_verifier on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-7 success Logs for aarch64-gcc / test (test_progs, false, 360) / test_progs on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-8 success Logs for aarch64-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-11 success Logs for s390x-gcc / build / build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-17 success Logs for s390x-gcc / veristat
bpf/vmtest-bpf-next-VM_Test-18 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-20 success Logs for x86_64-gcc / build-release
bpf/vmtest-bpf-next-VM_Test-19 success Logs for x86_64-gcc / build / build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-28 success Logs for x86_64-llvm-17 / build / build for x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-35 success Logs for x86_64-llvm-18 / build / build for x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-34 success Logs for x86_64-llvm-17 / veristat
bpf/vmtest-bpf-next-VM_Test-42 success Logs for x86_64-llvm-18 / veristat
bpf/vmtest-bpf-next-VM_Test-36 success Logs for x86_64-llvm-18 / build-release / build for x86_64 with llvm-18 and -O2 optimization
bpf/vmtest-bpf-next-VM_Test-2 success Logs for Unittests
bpf/vmtest-bpf-next-VM_Test-1 success Logs for ShellCheck
bpf/vmtest-bpf-next-VM_Test-3 success Logs for Validate matrix.py
bpf/vmtest-bpf-next-VM_Test-0 success Logs for Lint

Commit Message

Hari Bathini Feb. 9, 2024, 12:35 p.m. UTC
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/20240124051254.67105-1-bhe@redhat.com/

Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
---
 kernel/bpf/helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stanislav Fomichev Feb. 9, 2024, 7:18 p.m. UTC | #1
On 02/09, Hari Bathini wrote:
> 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?
Baoquan He Feb. 10, 2024, 4:51 a.m. UTC | #2
On 02/09/24 at 11:18am, Stanislav Fomichev wrote:
> On 02/09, Hari Bathini wrote:
> > 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?

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.
Baoquan He Feb. 10, 2024, 4:52 a.m. UTC | #3
On 02/09/24 at 06:05pm, Hari Bathini wrote:
> 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/20240124051254.67105-1-bhe@redhat.com/
> 
> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
> ---

Good catch, thanks for fixing it.

Acked-by: Baoquan He <bhe@redhat.com>

>  kernel/bpf/helpers.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
> index 4db1c658254c..e408d1115e26 100644
> --- a/kernel/bpf/helpers.c
> +++ b/kernel/bpf/helpers.c
> @@ -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)
> -- 
> 2.43.0
>
Jiri Olsa Feb. 12, 2024, 8:44 a.m. UTC | #4
On Sat, Feb 10, 2024 at 12:51:21PM +0800, Baoquan He wrote:
> On 02/09/24 at 11:18am, Stanislav Fomichev wrote:
> > On 02/09, Hari Bathini wrote:
> > > 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?
> 
> 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")

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka
Stanislav Fomichev Feb. 12, 2024, 4:48 p.m. UTC | #5
On 02/12, Jiri Olsa wrote:
> On Sat, Feb 10, 2024 at 12:51:21PM +0800, Baoquan He wrote:
> > On 02/09/24 at 11:18am, Stanislav Fomichev wrote:
> > > On 02/09, Hari Bathini wrote:
> > > > 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?
> > 
> > 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")
> 
> Acked-by: Jiri Olsa <jolsa@kernel.org>

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

Acked-by: Stanislav Fomichev <sdf@google.com>
Hari Bathini March 18, 2024, 6:52 a.m. UTC | #6
Just checking on whether this will go via bpf or mm tree?

On 09/02/24 6:05 pm, Hari Bathini wrote:
> 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/20240124051254.67105-1-bhe@redhat.com/
> 
> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
> ---
>   kernel/bpf/helpers.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
> index 4db1c658254c..e408d1115e26 100644
> --- a/kernel/bpf/helpers.c
> +++ b/kernel/bpf/helpers.c
> @@ -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)
Yonghong Song March 18, 2024, 4:13 p.m. UTC | #7
On 3/17/24 11:52 PM, Hari Bathini wrote:
> 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.

>
> On 09/02/24 6:05 pm, Hari Bathini wrote:
>> 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/20240124051254.67105-1-bhe@redhat.com/
>>
>> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
>> ---
>>   kernel/bpf/helpers.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
>> index 4db1c658254c..e408d1115e26 100644
>> --- a/kernel/bpf/helpers.c
>> +++ b/kernel/bpf/helpers.c
>> @@ -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)
>
Hari Bathini March 19, 2024, 8:06 a.m. UTC | #8
On 18/03/24 9:43 pm, Yonghong Song wrote:
> 
> On 3/17/24 11:52 PM, Hari Bathini wrote:
>> 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/20240319080152.36987-1-hbathini@linux.ibm.com/

> 
>>
>> On 09/02/24 6:05 pm, Hari Bathini wrote:
>>> 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/20240124051254.67105-1-bhe@redhat.com/
>>>
>>> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
>>> ---
>>>   kernel/bpf/helpers.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
>>> index 4db1c658254c..e408d1115e26 100644
>>> --- a/kernel/bpf/helpers.c
>>> +++ b/kernel/bpf/helpers.c
>>> @@ -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)
>>
diff mbox series

Patch

diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 4db1c658254c..e408d1115e26 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -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)