[v1,0/5] perf trace: Cleanup and remove unused bpf map

Message ID 20221121075237.127706-1-leo.yan@linaro.org
Headers
Series perf trace: Cleanup and remove unused bpf map |

Message

Leo Yan Nov. 21, 2022, 7:52 a.m. UTC
  The initial purpose of this series is to cleanup the unused bpf map
'syscalls' in the eBPF program augmented_raw_syscalls and perf trace
tool.  The relality is perf trace tool initializes system call table
based on map 'syscalls' and wrongly returns syscall pointer for
non-existed system calls based on the previous initialization.

So the patch set firstly addresses the issue for handling non-existed
system calls, then it removes unused local variable and bpf map in
augmented_raw_syscalls.c.

Patch 01 is a minor refactoring to use macro to replace number, patch 02
is to return error if a system call doesn't exist, especially when we
cannot find corresponding trace point in sysfs node, patch 03 is to fix
the issue that trace__syscall_info() returns a syscall pointer even the
system call doesn't exist, the corrected result is to always return NULL
pointer for non-existed system call.

The last two patches remove the unused local variable and bpf map
'syscalls'.

This patch set has been tested with mainline kernel on Arm64 Ampere
Altra platform.

Leo Yan (5):
  perf trace: Use macro RAW_SYSCALL_ARGS_NUM to replace number
  perf trace: Return error if a system call doesn't exist
  perf trace: Handle failure when trace point folder is missed
  perf augmented_raw_syscalls: Remove unused variable 'syscall'
  perf trace: Remove unused bpf map 'syscalls'

 tools/perf/builtin-trace.c                    | 131 +++---------------
 .../examples/bpf/augmented_raw_syscalls.c     |  18 ---
 2 files changed, 18 insertions(+), 131 deletions(-)
  

Comments

Ian Rogers Nov. 21, 2022, 5:05 p.m. UTC | #1
On Sun, Nov 20, 2022 at 11:52 PM Leo Yan <leo.yan@linaro.org> wrote:
>
> The initial purpose of this series is to cleanup the unused bpf map
> 'syscalls' in the eBPF program augmented_raw_syscalls and perf trace
> tool.  The relality is perf trace tool initializes system call table
> based on map 'syscalls' and wrongly returns syscall pointer for
> non-existed system calls based on the previous initialization.
>
> So the patch set firstly addresses the issue for handling non-existed
> system calls, then it removes unused local variable and bpf map in
> augmented_raw_syscalls.c.
>
> Patch 01 is a minor refactoring to use macro to replace number, patch 02
> is to return error if a system call doesn't exist, especially when we
> cannot find corresponding trace point in sysfs node, patch 03 is to fix
> the issue that trace__syscall_info() returns a syscall pointer even the
> system call doesn't exist, the corrected result is to always return NULL
> pointer for non-existed system call.
>
> The last two patches remove the unused local variable and bpf map
> 'syscalls'.
>
> This patch set has been tested with mainline kernel on Arm64 Ampere
> Altra platform.
>
> Leo Yan (5):
>   perf trace: Use macro RAW_SYSCALL_ARGS_NUM to replace number
>   perf trace: Return error if a system call doesn't exist
>   perf trace: Handle failure when trace point folder is missed
>   perf augmented_raw_syscalls: Remove unused variable 'syscall'
>   perf trace: Remove unused bpf map 'syscalls'


Acked-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

>  tools/perf/builtin-trace.c                    | 131 +++---------------
>  .../examples/bpf/augmented_raw_syscalls.c     |  18 ---
>  2 files changed, 18 insertions(+), 131 deletions(-)
>
> --
> 2.34.1
>
  
Arnaldo Carvalho de Melo Nov. 21, 2022, 6:58 p.m. UTC | #2
Em Mon, Nov 21, 2022 at 09:05:14AM -0800, Ian Rogers escreveu:
> On Sun, Nov 20, 2022 at 11:52 PM Leo Yan <leo.yan@linaro.org> wrote:
> >
> > The initial purpose of this series is to cleanup the unused bpf map
> > 'syscalls' in the eBPF program augmented_raw_syscalls and perf trace
> > tool.  The relality is perf trace tool initializes system call table
> > based on map 'syscalls' and wrongly returns syscall pointer for
> > non-existed system calls based on the previous initialization.
> >
> > So the patch set firstly addresses the issue for handling non-existed
> > system calls, then it removes unused local variable and bpf map in
> > augmented_raw_syscalls.c.
> >
> > Patch 01 is a minor refactoring to use macro to replace number, patch 02
> > is to return error if a system call doesn't exist, especially when we
> > cannot find corresponding trace point in sysfs node, patch 03 is to fix
> > the issue that trace__syscall_info() returns a syscall pointer even the
> > system call doesn't exist, the corrected result is to always return NULL
> > pointer for non-existed system call.
> >
> > The last two patches remove the unused local variable and bpf map
> > 'syscalls'.
> >
> > This patch set has been tested with mainline kernel on Arm64 Ampere
> > Altra platform.
> >
> > Leo Yan (5):
> >   perf trace: Use macro RAW_SYSCALL_ARGS_NUM to replace number
> >   perf trace: Return error if a system call doesn't exist
> >   perf trace: Handle failure when trace point folder is missed
> >   perf augmented_raw_syscalls: Remove unused variable 'syscall'
> >   perf trace: Remove unused bpf map 'syscalls'
> 
> 
> Acked-by: Ian Rogers <irogers@google.com>

Thanks, applied.

- Arnaldo

 
> Thanks,
> Ian
> 
> >  tools/perf/builtin-trace.c                    | 131 +++---------------
> >  .../examples/bpf/augmented_raw_syscalls.c     |  18 ---
> >  2 files changed, 18 insertions(+), 131 deletions(-)
> >
> > --
> > 2.34.1
> >