mbox series

[bpf-next,v2,0/2] Add prog_kfunc feature probe

Message ID 20250123170555.291896-1-chen.dylane@gmail.com (mailing list archive)
Headers show
Series Add prog_kfunc feature probe | expand

Message

Tao Chen Jan. 23, 2025, 5:05 p.m. UTC
More and more kfunc functions are being added to the kernel.
Different prog types have different restrictions when using kfunc.
Therefore, prog_kfunc probe is added to check whether it is supported,
and the use of this api will be added to bpftool later.

Change list:
- v1 -> v2:
  - check unsupported prog type like probe_bpf_helper
  - add off parameter for module btf
  - chenk verifier info when kfunc id invalid

Revisions:
- v1
  https://lore.kernel.org/bpf/20250122171359.232791-1-chen.dylane@gmail.com

Tao Chen (2):
  libbpf: Add libbpf_probe_bpf_kfunc API
  selftests/bpf: Add libbpf_probe_bpf_kfunc API selftests

 tools/lib/bpf/libbpf.h                        | 17 ++++++-
 tools/lib/bpf/libbpf.map                      |  1 +
 tools/lib/bpf/libbpf_probes.c                 | 47 +++++++++++++++++++
 .../selftests/bpf/prog_tests/libbpf_probes.c  | 35 ++++++++++++++
 4 files changed, 99 insertions(+), 1 deletion(-)

Comments

Eduard Zingerman Jan. 24, 2025, 12:42 a.m. UTC | #1
On Fri, 2025-01-24 at 01:05 +0800, Tao Chen wrote:
> More and more kfunc functions are being added to the kernel.
> Different prog types have different restrictions when using kfunc.
> Therefore, prog_kfunc probe is added to check whether it is supported,
> and the use of this api will be added to bpftool later.
> 
> Change list:
> - v1 -> v2:
>   - check unsupported prog type like probe_bpf_helper
>   - add off parameter for module btf
>   - chenk verifier info when kfunc id invalid
> 
> Revisions:
> - v1
>   https://lore.kernel.org/bpf/20250122171359.232791-1-chen.dylane@gmail.com
> 
> Tao Chen (2):
>   libbpf: Add libbpf_probe_bpf_kfunc API
>   selftests/bpf: Add libbpf_probe_bpf_kfunc API selftests
> 
>  tools/lib/bpf/libbpf.h                        | 17 ++++++-
>  tools/lib/bpf/libbpf.map                      |  1 +
>  tools/lib/bpf/libbpf_probes.c                 | 47 +++++++++++++++++++
>  .../selftests/bpf/prog_tests/libbpf_probes.c  | 35 ++++++++++++++
>  4 files changed, 99 insertions(+), 1 deletion(-)
> 

Hi Tao,

Looks like something is wrong with the way the patch was generated:
- patchwork link:
  https://patchwork.kernel.org/project/netdevbpf/patch/20250123170555.291896-2-chen.dylane@gmail.com/
- error message:
  https://github.com/kernel-patches/bpf/pull/8395

    Cmd('git') failed due to: exit code(128)
      cmdline: git am --3way
      stdout: 'Applying: libbpf: Add libbpf_probe_bpf_kfunc API
    Patch failed at 0001 libbpf: Add libbpf_probe_bpf_kfunc API
    When you have resolved this problem, run "git am --continue".
    If you prefer to skip this patch, run "git am --skip" instead.
    To restore the original branch and stop patching, run "git am --abort".'
      stderr: 'error: corrupt patch at line 103
    error: could not build fake ancestor
    hint: Use 'git am --show-current-patch=diff' to see the failed patch'

I get the same error when trying to apply locally,
could you please double check?

Thanks,
Eduard
Tao Chen Jan. 24, 2025, 2:49 a.m. UTC | #2
在 2025/1/24 08:42, Eduard Zingerman 写道:
> On Fri, 2025-01-24 at 01:05 +0800, Tao Chen wrote:
>> More and more kfunc functions are being added to the kernel.
>> Different prog types have different restrictions when using kfunc.
>> Therefore, prog_kfunc probe is added to check whether it is supported,
>> and the use of this api will be added to bpftool later.
>>
>> Change list:
>> - v1 -> v2:
>>    - check unsupported prog type like probe_bpf_helper
>>    - add off parameter for module btf
>>    - chenk verifier info when kfunc id invalid
>>
>> Revisions:
>> - v1
>>    https://lore.kernel.org/bpf/20250122171359.232791-1-chen.dylane@gmail.com
>>
>> Tao Chen (2):
>>    libbpf: Add libbpf_probe_bpf_kfunc API
>>    selftests/bpf: Add libbpf_probe_bpf_kfunc API selftests
>>
>>   tools/lib/bpf/libbpf.h                        | 17 ++++++-
>>   tools/lib/bpf/libbpf.map                      |  1 +
>>   tools/lib/bpf/libbpf_probes.c                 | 47 +++++++++++++++++++
>>   .../selftests/bpf/prog_tests/libbpf_probes.c  | 35 ++++++++++++++
>>   4 files changed, 99 insertions(+), 1 deletion(-)
>>
> 
> Hi Tao,
> 
> Looks like something is wrong with the way the patch was generated:
> - patchwork link:
>    https://patchwork.kernel.org/project/netdevbpf/patch/20250123170555.291896-2-chen.dylane@gmail.com/
> - error message:
>    https://github.com/kernel-patches/bpf/pull/8395
> 
>      Cmd('git') failed due to: exit code(128)
>        cmdline: git am --3way
>        stdout: 'Applying: libbpf: Add libbpf_probe_bpf_kfunc API
>      Patch failed at 0001 libbpf: Add libbpf_probe_bpf_kfunc API
>      When you have resolved this problem, run "git am --continue".
>      If you prefer to skip this patch, run "git am --skip" instead.
>      To restore the original branch and stop patching, run "git am --abort".'
>        stderr: 'error: corrupt patch at line 103
>      error: could not build fake ancestor
>      hint: Use 'git am --show-current-patch=diff' to see the failed patch'
> 
> I get the same error when trying to apply locally,
> could you please double check?
> 
> Thanks,
> Eduard
> 

Hi, Eduard, thank you for your reply, i tried it out, and it turns out 
it's really my problem. I will resend it in v3.