Repository navigation
Add native support for ARM builds - #59
Xenofon Foukas (xfoukas) merged 49 commits into
Conversation
* Update Dockerfiles to conditionally install gcc-multilib, which is not available on ARM
* Update examples Makefiles to include {platform}-linux-gnu
* Update approved libraries for ARM so
* Call jbpf_measure_{start|end}_time which only conditionally executes x86 asm based on detected platform
|
@microsoft-github-policy-service agree [company="Cloudflare"] |
|
@microsoft-github-policy-service agree company="Cloudflare" |
Xenofon Foukas (xfoukas)
left a comment
There was a problem hiding this comment.
Anita Tenjarla (@anita-tenjarla), thanks again for creating this PR. This is really helpful¬
I went over it and I have a few comments:
- [Issue with atomics]: The ARM version of ubpf (used for running the userspace eBPF code) does not support atomic operations. As such, two of the tests fail when building for ARM (
concurrency/atomic_concurrency_testandconcurrency/codelet_control_input_concurrency_atomic_test). Given that this is not a jbpf limitation, but rather a ubpf limitation, I think we should give out a warning for users compiling on ARM, that atomics are not supported and we should disable those tests when running for arm builds. A clean way to do this would be to modify the cmake file to check the arch (e.g., withCMAKE_SYSTEM_PROCESSOR()calls) and emit the warning and disable the tests, if the arch is aarch64. - [asm timers]: The reason for relying on asm code for getting the time instead of
clock_gettime()is to avoid making OS calls that can lead to context switches. This is critical for some real-time use cases that we need to support. As such, I would propose a different way of fixing the timer issue. We could extend the implementation ofjbpf_start_time()andjbpf_end_time()injbpf_utils.hwith an aarch64 based asm implementation of counting time to match the x86 one (using thecntvct_el0andcntfrq_el0registers). This way, we don't need to make any modifications tojbpf_perf.cand we avoid introducing unwanted OS calls. - The README.md file should be updated with a new section
Supported architectureswhich explains that both x86_64 and aarch64 are supported, stating the limitations of the aarch64 version in terms of the atomics operation.
We are also working on adding aarch64 VMs in our pipelines so that we can test against ARM once this PR is merged.
| @@ -1,3 +1,3 @@ | |||
| #!/bin/sh | |||
|
|
|||
| sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JBPF_PATH/out/lib ./example_app | |||
There was a problem hiding this comment.
This is used when running without docker containers, so it should not be removed.
There was a problem hiding this comment.
I removed the sudo call here because the other instances of run_app.sh (in first_example_standalone_json_udp and first_example_ipc folders) don't invoke root. I don't really mind either way, but just noting that in Docker (which already runs as root) running the script as-is will return an error.
Thank you for the quick review! I'm happy to add a commit and make the requested changes outlined in "issue with atomics" and "readme", but I don't feel equipped to make the changes in "asm timers." I'm not familiar with writing and testing asm. Is that something you might be able to help me out with? |
* Add section to README about supported architectures * Exclude atomic tests on aarch64 and emit log about skipped tests. Test will fail because ubpf does not support atomics for aarch64.
Certainly, I can take over the pending task regarding the ARM timers and complete the PR. |
|
Thank you! Please let me know if there's anything you'd like me to add or test in the meantime. |
|
Thanks for updating the PR! I am currently working on adding the code for the timers and should have something pushed soon. |
Xenofon Foukas (xfoukas)
left a comment
There was a problem hiding this comment.
Anita Tenjarla (@anita-tenjarla) I have pushed some changes to the PR as discussed, for measuring the time. What remains now is to test everything. We are currently working on adding new arm pipelines for this purpose.
In the meantime, can you please point your PR to dev instead of main, according to the latest contribution guidelines found here. Thanks!
This reverts commit 152606a.
|
Hey, not sure if this is the right place to bring this up. I originally raised this issue when I was building the jbpf shared object file on ARM. Since then, I've also been building jbpf on ARM as a static library, but I got the following error: I had to add the following to the CMakeLists.txt in order to compile: Should I add a commit here with that change? Or would you prefer I open a separate issue or PR? |
|
Anita Tenjarla (@anita-tenjarla), please add the change in this PR. Thanks! |
…cs via compile option in CMakeLists.txt
|
Just updated, thanks! |
Add memory barriers to aarch64 code for measuring time, to avoid scenarios where the start and the end time and up being the same.
Fix formatting issues.
Install yaml-cpp-dev from the Ubuntu repo.
Xenofon Foukas (xfoukas)
left a comment
There was a problem hiding this comment.
I made some small changes to fix a time measurement related bug and to clean up some issues related to the installation of packages to the containers.
The PR looks good to me. Thank you for your contribution!
* Add branch instructions in CONTRIBUTING.md and Update ADO pipeline triggers (#78) * Add Github Action Pipeline and Fixed INITIALIZE_SUBMODULES (#64) * Add Debug build configuration testing to CI pipeline (#57) --------- Co-authored-by: Zhihua Lai <[email protected]> Co-authored-by: Xenofon Foukas <[email protected]> * Add helper function for fixed points (#71) (#85) Co-authored-by: Zhihua Lai <[email protected]> * Fixes for tests to pass when cmake build type is Release (#86) This fixes issue #79. When the cmake build type is not defined it defaults to Release. Given that the tests rely on assert() to pass, the PR also undefs NDEBUG in the release build flags to prevent the optimizer from removing the assert() calls. * Improve Validation Error Messages in Linked Map (#82) * Matt/dev: MAX_NUM_HOOKS to 128 (#91) * Add helper function for fixed points (#71) * Increase MAX_NUM_HOOKS from 64 to 128 (#90) --------- Co-authored-by: Zhihua Lai <[email protected]> * Refactor run_lcm_subproc by removing memory allocation with new/delete. (#93) * Fix build/package error in ubuntu22.04 (#96) * Add native support for ARM builds (#59) --------- Co-authored-by: Zhihua Lai <[email protected]> Co-authored-by: Xenofon Foukas <[email protected]> Co-authored-by: Connor Settle <[email protected]> Co-authored-by: Zhihua Lai <[email protected]> * Bugfix: perf time measurement API with invalid times (#102) * Bump ubpf to the latest version (#103) * Matt/issue94 (#95) * Remove ado correctness + move to cloud agents (#100) * Sync dev with main (#105) * Add helper function for fixed points (#71) * Increase MAX_NUM_HOOKS from 64 to 128 (#90) --------- Co-authored-by: Zhihua Lai <[email protected]> Co-authored-by: matthewbalkwill <[email protected]> --------- Co-authored-by: Zhihua Lai <[email protected]> Co-authored-by: Xiaochuan Ye <[email protected]> Co-authored-by: matthewbalkwill <[email protected]> Co-authored-by: Anita Tenjarla <[email protected]> Co-authored-by: Zhihua Lai <[email protected]> Co-authored-by: Connor Settle <[email protected]>
sudofromrun_app.shsince we're already running as root in containercloses #58