Re: [PATCH] perf trace: Update cmd string table to decode sys_bpf first arg

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

 



Em Wed, Jul 14, 2021 at 09:50:00AM +0800, Wei Li escreveu:
> As 'enum bpf_cmd' has been extended a lot, update the cmd string table to
> decode sys_bpf first arg clearly in perf-trace.

I'll apply this, as it improves what we have right now, but the plan is
to use BTF for this, see how pahole can get all that from
/sys/kernel/btf/vmlinux:

⬢[acme@toolbox perf]$ pahole bpf_cmd
enum bpf_cmd {
	BPF_MAP_CREATE                  = 0,
	BPF_MAP_LOOKUP_ELEM             = 1,
	BPF_MAP_UPDATE_ELEM             = 2,
	BPF_MAP_DELETE_ELEM             = 3,
	BPF_MAP_GET_NEXT_KEY            = 4,
	BPF_PROG_LOAD                   = 5,
	BPF_OBJ_PIN                     = 6,
	BPF_OBJ_GET                     = 7,
	BPF_PROG_ATTACH                 = 8,
	BPF_PROG_DETACH                 = 9,
	BPF_PROG_TEST_RUN               = 10,
	BPF_PROG_GET_NEXT_ID            = 11,
	BPF_MAP_GET_NEXT_ID             = 12,
	BPF_PROG_GET_FD_BY_ID           = 13,
	BPF_MAP_GET_FD_BY_ID            = 14,
	BPF_OBJ_GET_INFO_BY_FD          = 15,
	BPF_PROG_QUERY                  = 16,
	BPF_RAW_TRACEPOINT_OPEN         = 17,
	BPF_BTF_LOAD                    = 18,
	BPF_BTF_GET_FD_BY_ID            = 19,
	BPF_TASK_FD_QUERY               = 20,
	BPF_MAP_LOOKUP_AND_DELETE_ELEM  = 21,
	BPF_MAP_FREEZE                  = 22,
	BPF_BTF_GET_NEXT_ID             = 23,
	BPF_MAP_LOOKUP_BATCH            = 24,
	BPF_MAP_LOOKUP_AND_DELETE_BATCH = 25,
	BPF_MAP_UPDATE_BATCH            = 26,
	BPF_MAP_DELETE_BATCH            = 27,
	BPF_LINK_CREATE                 = 28,
	BPF_LINK_UPDATE                 = 29,
	BPF_LINK_GET_FD_BY_ID           = 30,
	BPF_LINK_GET_NEXT_ID            = 31,
	BPF_ENABLE_STATS                = 32,
	BPF_ITER_CREATE                 = 33,
	BPF_LINK_DETACH                 = 34,
	BPF_PROG_BIND_MAP               = 35,
};
⬢[acme@toolbox perf]$
 
> Signed-off-by: Wei Li <liwei391@xxxxxxxxxx>
> ---
>  tools/perf/builtin-trace.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index 7ec18ff57fc4..17bc6284a93e 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -707,7 +707,15 @@ static size_t syscall_arg__scnprintf_char_array(char *bf, size_t size, struct sy
>  
>  static const char *bpf_cmd[] = {
>  	"MAP_CREATE", "MAP_LOOKUP_ELEM", "MAP_UPDATE_ELEM", "MAP_DELETE_ELEM",
> -	"MAP_GET_NEXT_KEY", "PROG_LOAD",
> +	"MAP_GET_NEXT_KEY", "PROG_LOAD", "OBJ_PIN", "OBJ_GET", "PROG_ATTACH",
> +	"PROG_DETACH", "PROG_TEST_RUN", "PROG_GET_NEXT_ID", "MAP_GET_NEXT_ID",
> +	"PROG_GET_FD_BY_ID", "MAP_GET_FD_BY_ID", "OBJ_GET_INFO_BY_FD",
> +	"PROG_QUERY", "RAW_TRACEPOINT_OPEN", "BTF_LOAD", "BTF_GET_FD_BY_ID",
> +	"TASK_FD_QUERY", "MAP_LOOKUP_AND_DELETE_ELEM", "MAP_FREEZE",
> +	"BTF_GET_NEXT_ID", "MAP_LOOKUP_BATCH", "MAP_LOOKUP_AND_DELETE_BATCH",
> +	"MAP_UPDATE_BATCH", "MAP_DELETE_BATCH", "LINK_CREATE", "LINK_UPDATE",
> +	"LINK_GET_FD_BY_ID", "LINK_GET_NEXT_ID", "ENABLE_STATS", "ITER_CREATE",
> +	"LINK_DETACH", "PROG_BIND_MAP",
>  };
>  static DEFINE_STRARRAY(bpf_cmd, "BPF_");
>  
> -- 
> 2.25.1
> 

-- 

- Arnaldo



[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