Re: [PATCH bpf v3 1/2] bpf: emit bpf_timer in vmlinux BTF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/11/22 9:57 AM, Yonghong Song wrote:
Currently the following code in check_and_init_map_value()
   *(struct bpf_timer *)(dst + map->timer_off) =
       (struct bpf_timer){};
can help generate bpf_timer definition in vmlinuxBTF.
But the code above may not zero the whole structure
due to anonymour members and that code will be replaced
by memset in the subsequent patch and
bpf_timer definition will disappear from vmlinuxBTF.
Let us emit the type explicitly so bpf program can continue
to use it from vmlinux.h.

Signed-off-by: Yonghong Song <yhs@xxxxxx>
---
  kernel/bpf/helpers.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 01cfdf40c838..66f9ed5093b2 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -16,6 +16,7 @@
  #include <linux/pid_namespace.h>
  #include <linux/proc_ns.h>
  #include <linux/security.h>
+#include <linux/btf.h>

To avoid conflict with bpf-next can you move this #include a bit up?
I suspect having it right after linux/bpf.h will make this patch
applicable to both bpf and bpf-next. Which means there will be
no conflicts when bpf merges with bpf-next.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux