Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: BPF support for ARCv2 and ARCv3 #85

Draft
wants to merge 11 commits into
base: arc64
Choose a base branch
from
Draft

WIP: BPF support for ARCv2 and ARCv3 #85

wants to merge 11 commits into from

Conversation

geomatsi
Copy link

@geomatsi geomatsi commented Apr 12, 2022

This PR enables a couple of features required for better BPF support on ARCompact/ARCv2/ARCv3 architectures:

  • HAVE_REGS_AND_STACK_ACCESS_API
  • HAVE_SYSCALL_TRACEPOINTS

Known issues with BTF generation:

With quick workaround applied BTF can be generated. So far the following examples from libbpf-tools have been tried: biopattern, softirqs, vfsstat, filetop, ksnoop, tcpconnect, execsnoop, exitsnoop, mountsnoop, opensnoop, statsnoop, syscount.

Sergey Matyukevich and others added 2 commits April 12, 2022 15:54
Define appropriate uapi for the BPF_PROG_TYPE_PERF_EVENT program type
by exporting the user_regs_struct structure instead of the pt_regs
structure that is in-kernel only.

Signed-off-by: Sergey Matyukevich <[email protected]>
Add PT_REGS macros suitable for ARCompact and ARCv2.

Signed-off-by: Vladimir Isaev <[email protected]>
@geomatsi geomatsi requested a review from VVIsaev April 12, 2022 16:36
Sergey Matyukevich added 7 commits April 12, 2022 20:36
Enable HAVE_REGS_AND_STACK_ACCESS_API feature for ARC architecture,
including ARCcompact and ARCv2 flavors. Add supporting functions
and defines.

Signed-off-by: Sergey Matyukevich <[email protected]>
Function syscall_trace_exit expects pointer to pt_regs. However
r0 is also used to keep syscall return value. Restore pointer
to pt_regs before calling syscall_trace_exit.

Signed-off-by: Sergey Matyukevich <[email protected]>
Implement all the bits required to support HAVE_SYSCALL_TRACEPOINTS
according to Documentation/trace/ftrace-design.rst.

Signed-off-by: Sergey Matyukevich <[email protected]>
Layout of pt_regs structure differs between ARCompact/ARCv2/ARCv3.
Fix set_reg/get_reg functions to handle proper registers.

Signed-off-by: Sergey Matyukevich <[email protected]>
All the supporting functions and defines are the same for all three ARC
architecture flavors. Define missing regoffset_table for ARCv3.

Signed-off-by: Sergey Matyukevich <[email protected]>
Fix typo in genregs_get that makes it store field address
instead of its value.

Signed-off-by: Sergey Matyukevich <[email protected]>
Sergey Matyukevich and others added 2 commits April 15, 2022 16:19
Properly handle kgdb and kprobes addresses in kernel translated memory.
Update address check: throw bugs for user mappings and inconsistent
vmalloc areas.

Signed-off-by: Sergey Matyukevich <[email protected]>
ARC toolchains generate 'complex float' DIE entries in libgcc.
At the moment such entries are not yet handled by pahole.
So for now disable BTF floats.

Signed-off-by: Vladimir Isaev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant