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

Attempt to add arm64 support #151

Merged
merged 6 commits into from Jan 24, 2024
Merged

Attempt to add arm64 support #151

merged 6 commits into from Jan 24, 2024

Conversation

ShawnZhong
Copy link
Contributor

Description

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • bpftime_daemon_tests
  • bpftime runtime unit tests & old tests

Test Configuration:

  • Hardware: M1 Macbook Air w/ Ubuntu 23.04 running in QEMU

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@yunwei37
Copy link
Member

Thanks a lot!

@yunwei37
Copy link
Member

@ShawnZhong @Officeyutong By the way, is it possible to make a GitHub Action for testing bpftime on arm64?

@Officeyutong
Copy link
Contributor

@ShawnZhong @Officeyutong By the way, is it possible to make a GitHub Action for testing bpftime on arm64?

Many of features existing rely on x86, e.g user space syscall trace. We need a new syscall trace trampoline on arm64.

@Officeyutong
Copy link
Contributor

@ShawnZhong @Officeyutong By the way, is it possible to make a GitHub Action for testing bpftime on arm64?

Running tests itself is relatively easier

@yunwei37
Copy link
Member

yunwei37 commented Jan 23, 2024

Many of features existing rely on x86, e.g user space syscall trace. We need a new syscall trace trampoline on arm64.

That's fine. At least we can get the uprobe and runtime work. We can get this PR work first, and then consider others(syscall trace, CI, syscall trace should be easier on arm)

Is there any other features rely on x86?

@ShawnZhong
Copy link
Contributor Author

@ShawnZhong @Officeyutong By the way, is it possible to make a GitHub Action for testing bpftime on arm64?

It seems that Arm-based hosted runners are still in public beta as of January 2024: https://github.blog/changelog/2023-10-30-accelerate-your-ci-cd-with-arm-based-hosted-runners-in-github-actions/

One option is to use self-hosted runners, which requires some setup (and cost money)

My least favorable option is to run inside QEMU.

// a result provided by bpftime. So if we want to get things from kernel, we must
// manually execute `syscall` from libc
inline void* libc_handle = dlopen(LIBC_SO, RTLD_LAZY);
inline auto libc_syscall = reinterpret_cast<decltype(&::syscall)>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems there is some problem with the tailcall tests. Is it from here? The tailcall can use the prog_array to exec some eBPF programs in kernel.

@yunwei37
Copy link
Member

Thanks a lot!

@yunwei37 yunwei37 merged commit d0b9f66 into eunomia-bpf:master Jan 24, 2024
36 checks passed
@Officeyutong
Copy link
Contributor

Many of features existing rely on x86, e.g user space syscall trace. We need a new syscall trace trampoline on arm64.

That's fine. At least we can get the uprobe and runtime work. We can get this PR work first, and then consider others(syscall trace, CI, syscall trace should be easier on arm)

Is there any other features rely on x86?

Calling original syscall at prog array implementation was bound to x86, needs updating

// a result provided by bpftime. So if we want to get things from kernel, we must
// manually execute `syscall` from libc
static void* libc_handle = dlopen(LIBC_SO, RTLD_LAZY);
static auto libc_syscall = reinterpret_cast<decltype(&::syscall)>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need pay attention to all global variable initializations, since attaching might be executed before the initialization of global variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants