Skip to content

Add example for wasm_bpf plugin #75

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

Merged
merged 4 commits into from
May 31, 2023
Merged

Conversation

Officeyutong
Copy link
Contributor

@Officeyutong Officeyutong commented May 22, 2023

Add an document page for the wasm_bpf plugin, demonstrating how to write programs use the API provided by that plugin

Copy link
Collaborator

alabulei1 commented May 22, 2023

Hello, I am a code review bot on flows.network. Here are my reviews of code commits in this PR.


Overall, the Pull Request seems well-prepared and the changes seem well-explained. The potential problems that were identified have been addressed. The addition of a new .md file to the docs/develop/c folder provides clear instructions for using the wasm_bpf plugin of the WasmEdge runtime, along with a standalone example and output. Additionally, spell errors in the previous version of bpf.md were fixed. Finally, new documentation for bootstrap was added with code snippets to demonstrate the use of BPF features. Thus, the changes in this Pull Request are useful and valuable additions to the project.

Details

Commit b18ff36c9c4a47e0d8a790aee2c92c4a4954bcf0

Key changes:

  • A new .md file has been added to the docs/develop/c folder, called bpf.md.
  • The file provides an example for using the wasm_bpf plugin of the WasmEdge runtime.
  • The example is to trace the entry and exit of all processes, and a sample output has been provided.

Potential problems:

  • None apparent. The patch adds a standalone example and clearly describes what is needed to run it. Therefore, it seems well prepared.

Commit 0cb40e460abe8f307e3c4181855acd860a55e361

Key changes:

  • Spell errors in the develop/c/bpf.md documentation were fixed.

Potential problems:

  • None found.

Commit 5e022edbcae3fc98fdfdfb92990ac21b677ddd35

Key changes:

  • Addition of new documentation for bootstrap in bpf.md
  • Code snippets added to demonstrate use of BPF features in bootstrap.bpf.c and the core process of the userspace program.

Potential problems:

  • None apparent. The code snippets provide useful insight into how to use BPF and bootstrap.

@adithyaakrishna
Copy link
Contributor

@Officeyutong The DCO check is failing, could you please sign-off your commits?

@Officeyutong
Copy link
Contributor Author

@Officeyutong The DCO check is failing, could you please sign-off your commits?

Fixed now

For simplicity, we will just reuse the `Makefile` of [wasm-bpf](https://github.com/eunomia-bpf/wasm-bpf), since `wasmEdge_bpfPlugin` has the exactly same API as `wasm-bpf`

1. Clone the [`wasm-bpf`](https://github.com/eunomia-bpf/wasm-bpf) repo.
2. Run `make install-deps` and `make /opt/wasi-sdk` at the root of the project. This will install the build prerequisites.

This comment was marked as resolved.

Officeyutong and others added 3 commits May 23, 2023 13:24
Signed-off-by: officeyutong <yt.xyxx@gmail.com>
Signed-off-by: officeyutong <yt.xyxx@gmail.com>
Signed-off-by: officeyutong <yt.xyxx@gmail.com>
Signed-off-by: officeyutong <yt.xyxx@gmail.com>
@Officeyutong Officeyutong marked this pull request as ready for review May 23, 2023 13:34
@juntao
Copy link
Member

juntao commented May 24, 2023

This looks great! Can you also add a section on how to install the eBPF plugin here?

https://wasmedge.org/docs/develop/build-and-run/install/#install-wasmedge-with-plugins-1

Thanks.

@Officeyutong
Copy link
Contributor Author

Officeyutong commented May 25, 2023

This looks great! Can you also add a section on how to install the eBPF plugin here?

https://wasmedge.org/docs/develop/build-and-run/install/#install-wasmedge-with-plugins-1

Thanks.

The install script doesn't seem to support installing wasm_bpf plugin yet, it only supports plugins with their names hardcoded in the script

@yunwei37
Copy link
Contributor

Maybe we can open a pr and add the wasm_bpf plugin in it?

@alabulei1
Copy link
Collaborator

alabulei1 commented May 31, 2023

I will merge this first. When we have the installer for e-bpf plugin, the doc needs to be updated.

@alabulei1 alabulei1 merged commit ebd17ee into WasmEdge:main May 31, 2023
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.

5 participants