mbox series

[bpf-next,v4,0/3] add support for writable bare tracepoint

Message ID 20210930091355.2794601-1-houtao1@huawei.com (mailing list archive)
Headers show
Series add support for writable bare tracepoint | expand

Message

Hou Tao Sept. 30, 2021, 9:13 a.m. UTC
Hi,

The patchset series supports writable context for bare tracepoint.

The main idea comes from patchset "writable contexts for bpf raw
tracepoints" [1], but it only supports normal tracepoint with
associated trace event under tracefs. Now we have one use case
in which we will add bare tracepoint in VFS layer, and update
file::f_mode for specific files. The reason using bare tracepoint
is that it doesn't form a ABI and we can change it freely. So
add support for it in BPF.

Comments are always welcome.

[1]: https://lore.kernel.org/lkml/20190426184951.21812-1-mmullins@fb.com

Change log:
v4:
 * rebased on bpf-next
 * update patch 2 to add support for writable raw tracepoint attachment
   in attach_raw_tp().
 * update patch 3 to add Acked-by tag

v3: https://www.spinics.net/lists/bpf/msg46824.html
  * use raw_tp.w instead of raw_tp_writable as section
    name of writable tp
  * use ASSERT_XXX() instead of CHECK()
  * define a common macro for "/sys/kernel/bpf_testmod"

v2: https://www.spinics.net/lists/bpf/msg46356.html 
  * rebase on bpf-next tree
  * address comments from Yonghong Song
  * rename bpf_testmode_test_writable_ctx::ret as early_ret to reflect
    its purpose better.

v1: https://www.spinics.net/lists/bpf/msg46221.html

Hou Tao (3):
  bpf: support writable context for bare tracepoint
  libbpf: support detecting and attaching of writable tracepoint program
  bpf/selftests: add test for writable bare tracepoint

 include/trace/bpf_probe.h                     | 19 +++++++---
 tools/lib/bpf/libbpf.c                        | 21 ++++++++---
 .../bpf/bpf_testmod/bpf_testmod-events.h      | 15 ++++++++
 .../selftests/bpf/bpf_testmod/bpf_testmod.c   | 10 ++++++
 .../selftests/bpf/bpf_testmod/bpf_testmod.h   |  5 +++
 .../selftests/bpf/prog_tests/module_attach.c  | 35 +++++++++++++++++++
 .../selftests/bpf/progs/test_module_attach.c  | 14 ++++++++
 tools/testing/selftests/bpf/test_progs.c      |  4 +--
 tools/testing/selftests/bpf/test_progs.h      |  2 ++
 9 files changed, 114 insertions(+), 11 deletions(-)

Comments

Hou Tao Sept. 30, 2021, 9:13 a.m. UTC | #1
Hi,

The patchset series supports writable context for bare tracepoint.

The main idea comes from patchset "writable contexts for bpf raw
tracepoints" [1], but it only supports normal tracepoint with
associated trace event under tracefs. Now we have one use case
in which we will add bare tracepoint in VFS layer, and update
file::f_mode for specific files. The reason using bare tracepoint
is that it doesn't form a ABI and we can change it freely. So
add support for it in BPF.

Comments are always welcome.

[1]: https://lore.kernel.org/lkml/20190426184951.21812-1-mmullins@fb.com

Change log:
v4:
 * rebased on bpf-next
 * patch 2 is updated to add support for writable raw tracepoint
   attachment in attach_raw_tp().

v3: https://www.spinics.net/lists/bpf/msg46824.html
  * use raw_tp.w instead of raw_tp_writable as section
    name of writable tp
  * use ASSERT_XXX() instead of CHECK()
  * define a common macro for "/sys/kernel/bpf_testmod"

v2: https://www.spinics.net/lists/bpf/msg46356.html 
  * rebase on bpf-next tree
  * address comments from Yonghong Song
  * rename bpf_testmode_test_writable_ctx::ret as early_ret to reflect
    its purpose better.

v1: https://www.spinics.net/lists/bpf/msg46221.html

Hou Tao (3):
  bpf: support writable context for bare tracepoint
  libbpf: support detecting and attaching of writable tracepoint program
  bpf/selftests: add test for writable bare tracepoint

 include/trace/bpf_probe.h                     | 19 +++++++---
 tools/lib/bpf/libbpf.c                        | 21 ++++++++---
 .../bpf/bpf_testmod/bpf_testmod-events.h      | 15 ++++++++
 .../selftests/bpf/bpf_testmod/bpf_testmod.c   | 10 ++++++
 .../selftests/bpf/bpf_testmod/bpf_testmod.h   |  5 +++
 .../selftests/bpf/prog_tests/module_attach.c  | 35 +++++++++++++++++++
 .../selftests/bpf/progs/test_module_attach.c  | 14 ++++++++
 tools/testing/selftests/bpf/test_progs.c      |  4 +--
 tools/testing/selftests/bpf/test_progs.h      |  2 ++
 9 files changed, 114 insertions(+), 11 deletions(-)
Hou Tao Sept. 30, 2021, 10:06 a.m. UTC | #2
Oops, I mistakenly send out the zero-patch again. Sorry for that.

On 9/30/2021 5:13 PM, Hou Tao wrote:
> Hi,
>
> The patchset series supports writable context for bare tracepoint.
>
> The main idea comes from patchset "writable contexts for bpf raw
> tracepoints" [1], but it only supports normal tracepoint with
> associated trace event under tracefs. Now we have one use case
> in which we will add bare tracepoint in VFS layer, and update
> file::f_mode for specific files. The reason using bare tracepoint
> is that it doesn't form a ABI and we can change it freely. So
> add support for it in BPF.
>
> Comments are always welcome.
>
> [1]: https://lore.kernel.org/lkml/20190426184951.21812-1-mmullins@fb.com
>
> Change log:
> v4:
>  * rebased on bpf-next
>  * patch 2 is updated to add support for writable raw tracepoint
>    attachment in attach_raw_tp().
>
> v3: https://www.spinics.net/lists/bpf/msg46824.html
>   * use raw_tp.w instead of raw_tp_writable as section
>     name of writable tp
>   * use ASSERT_XXX() instead of CHECK()
>   * define a common macro for "/sys/kernel/bpf_testmod"
>
> v2: https://www.spinics.net/lists/bpf/msg46356.html 
>   * rebase on bpf-next tree
>   * address comments from Yonghong Song
>   * rename bpf_testmode_test_writable_ctx::ret as early_ret to reflect
>     its purpose better.
>
> v1: https://www.spinics.net/lists/bpf/msg46221.html
>
> Hou Tao (3):
>   bpf: support writable context for bare tracepoint
>   libbpf: support detecting and attaching of writable tracepoint program
>   bpf/selftests: add test for writable bare tracepoint
>
>  include/trace/bpf_probe.h                     | 19 +++++++---
>  tools/lib/bpf/libbpf.c                        | 21 ++++++++---
>  .../bpf/bpf_testmod/bpf_testmod-events.h      | 15 ++++++++
>  .../selftests/bpf/bpf_testmod/bpf_testmod.c   | 10 ++++++
>  .../selftests/bpf/bpf_testmod/bpf_testmod.h   |  5 +++
>  .../selftests/bpf/prog_tests/module_attach.c  | 35 +++++++++++++++++++
>  .../selftests/bpf/progs/test_module_attach.c  | 14 ++++++++
>  tools/testing/selftests/bpf/test_progs.c      |  4 +--
>  tools/testing/selftests/bpf/test_progs.h      |  2 ++
>  9 files changed, 114 insertions(+), 11 deletions(-)
>