kmesh-net / kmesh

High Performance ServiceMesh Data Plane Based on Programmable Kernel
https://kmesh.net
Apache License 2.0
459 stars 69 forks source link

"/debug/bpf/*" should output human-readable, real bpf information #820

Open YaoZengzeng opened 2 months ago

YaoZengzeng commented 2 months ago

What would you like to be added:

"/debug/bpf/*" should output the underlying actual eBPF info, including the contents of the map and prog, in a human-readable way to facilitate troubleshooting the problem.

Why is this needed:

Now we have /debug/config_dump/ads and /debug/config_dump/workload output the config content cached in Kmesh daemon.

At the same time, we have /debug/bpf/ads, but its output is exactly the same as /debug/config_dump/ads.

Now we hope that /debug/bpf/* could output the information about the underlying eBPF.

Due to various reasons, the config in Kmesh daemon cache and the actual eBPF may not be completely consistent. If we can get human-readable eBPF info, it will be more helpful for us to troubleshooting.

This is also an important part of the kmeshctl, used to obtain the real eBPF info of each node.

YaoZengzeng commented 2 months ago

cc @Okabe-Rintarou-0 would you like to take it :)

Okabe-Rintarou-0 commented 2 months ago

sure. /assign

Okabe-Rintarou-0 commented 2 months ago

maybe we need to lookup all the keys of bpf map in bpf/deserialization_to_bpf_map/deserialization_to_bpf_map.c. bpf supports traversing the keys.

Okabe-Rintarou-0 commented 2 months ago

I am working on this, we can get all elements with a linked list