Giter Club home page Giter Club logo

sel4bench's Introduction

sel4bench

sel4bench is a benchmarking applications and support library for seL4.

To get this project, check out the project manifest.

Applications

We provide multiple applications for benchmarking different paths in the kernel.

sel4bench

This is the driver application: it launches each benchmark in a separate process and collects, processes, and outputs results.

ipc

This is a hot-cache benchmark of the IPC path.

irq

This is a hot-cache benchmark of the IRQ path, measured from inside the kernel. It requires tracepoints to be placed on the IRQ path where the meaurements are to be taken from.

irquser

This is a hot-cache benchmark of the IRQ path, measured from user space.

scheduler

This is a hot-cache benchmark of a scheduling decision. It works by using a producer/consumer pattern between two notification objects. This benchmark also measures seL4_Yield().

signal

This is a hot-cache benchmark of the signal path in the kernel, measured from user space.

smp

This is an intra-core IPC round-trip benchmark to check overhead of kernel synchronization on IPC throughput.

vcpu (AArch64 only)

This benchmark will execute a thread as a VCPU (an EL1 guest kernel) and then obtain numbers for the following actions:

  • Privilege escalation from EL1 to EL2 using the HVC instruction.
  • Privilege de-escalation from EL2 to EL1 using the ERET instruction.
  • The cost of a null invocation of the EL2 kernel using HVC.
  • The cost of an seL4_Call() from an EL1 guest thread to a native seL4 thread.
  • The cost of an seL4_Reply() from an seL4 native thread to an EL1 guest thread.

Note: In order to run this benchmark, you must notify the build system that you wish to enable this benchmark by passing -DVCPU=true on the command line, which will cause the kernel to be compiled to run in EL2. You must also ensure that you pass -DHARDWARE=false to disable the hardware tests.

Since this benchmark will cause the kernel image to be an EL2 image, it will have an impact on the observed numbers for the other benchmark applications as well, since they'll be using an unexpected kernel build.

Adding a new benchmark

Contributing a new benchmark to seL4bench requires a few steps:

  • Under apps, create a directory for your new benchmark and:
    • Provide a CMakelists.txt file that defines a new executable.
    • Provide a src folder that contains the source code for your benchmark.
  • Under apps/sel4bench:
    • Update CMakeLists.txt to add your new benchmark to the list of benchmarks.
    • Under src:
      • Update benchmark.h to include your generated config for your benchmark, and provide a function declaration that will act as the entry point for your benchmark.
      • Provide a <benchmark_name>.c file that implements the above function declaration. This function should return a benchmark_t struct. Construct this struct accordingly. The struct expects a function to process the results of the benchmark, which you should provide in this file as well
      • Inside main.c, add your entry point function that was declared/defined above to the array of benchmark_t present.
  • Update easy-settings.cmake to add your new benchmark. You can define here whether the benchmark should be enabled by default or not.
  • Under libsel4benchsupport/include:
    • Provide a <benchmark_name.h> file that provides any extra definitions that your benchmark may need. You will also generally provide a benchmark_name_results_t struct here, which will be used to store the results of your benchmark when processing.
  • Update settings.cmake to include your new benchmark.

sel4bench's People

Contributors

adriandanis avatar axel-h avatar branden-data61 avatar courtney3141 avatar cvluca avatar fourkbomb avatar gnustomp avatar gridbugs avatar indanz avatar kent-mcleod avatar latentprion avatar lsf37 avatar malus-brandywine avatar niwis avatar pingerino avatar szhuang avatar wal-eed avatar xurtis avatar yyshen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sel4bench's Issues

Page-Mapping benchmark error "seL4_Fault_CapFault"

Test benchmark with page-mapping module on qemu-arm-virt platform.
error logs:

crash at:
benchmark_spawn_process

Caught cap fault in send phase at address 0
while trying to handle:
vm fault on data at address 0x46cde0 with status 0x92000007
in thread 0xffffff806ffde400 "Proc" at address 0x45598c
With stack:
0x10011d60: 0x0
0x10011d68: 0x0
0x10011d70: 0x10011e70
0x10011d78: 0x10011e70
0x10011d80: 0x0
0x10011d88: 0x0
0x10011d90: 0x10011e70
0x10011d98: 0x10011e70
0x10011da0: 0x10011e30
0x10011da8: 0xffffff80ffffffc8
0x10011db0: 0x0
0x10011db8: 0x0
0x10011dc0: 0x0
0x10011dc8: 0x0
0x10011dd0: 0x0
0x10011dd8: 0x0

CI actions should build with clang also

CI actions should build with clang also besides just gcc and benchmaks should run with both binaries. Building with clang is expected to improve code quality, because clang raises more warnings. Large discrepancies in the benchmark results can indicate that the benchmark either has a strong compiler dependency or its implementation has issues.

Building with clang also seems rather trivial, running both binaries will be more work.

Ability to change bench app options for RiscV

Hi,

Does anyone remember why sel4bench configuration for RiscV was not allowed to change bench app options?

If it was skipped because it was not necessary then I'd like to fix it.

I would add a line to
https://github.com/seL4/sel4bench/blob/master/apps/sel4bench/CMakeLists.txt

--- a/apps/sel4bench/CMakeLists.txt
+++ b/apps/sel4bench/CMakeLists.txt
@@ -35,14 +35,15 @@ config_string(
 
 # Default dependencies on kernel benchmarking features. Declared here so that
 # all the benchmark applications can use it
 if(
     (KernelArchX86 AND KernelExportPMCUser AND KernelX86DangerousMSR)
     OR (KernelArchARM AND KernelArmExportPMUUser)
     OR (KernelArchArmCortexA8 AND KernelDangerousCodeInjection)
+    OR (KernelArchRiscV)
 )
     set(DefaultBenchDeps TRUE)
 else()
     set(DefaultBenchDeps FALSE)
 endif()
 
 find_package(musllibc REQUIRED)

(copying it to devel mailing list)

Thanks!

avoid memset warning in apps/sel4bench/src/irq.c

Look into the build warning, maybe there is a way to avoid it, if this is a dynamically assigned region:

RISC-V:

 /github/workspace/projects/sel4bench/apps/sel4bench/src/irq.c: In function 'process':
  cc1: warning: '__builtin_memset' writing between 8 and 17179869176 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]

ARMv8:

/github/workspace/projects/sel4bench/apps/sel4bench/src/irq.c:42:28: warning: ‘__builtin_memset’ writing between 8 and 17179869176 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
   42 |         kernel_log_data[i] = kernel_logging_entry_get_data(&irq_results->kernel_log[i]);
      |         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

sel4bench build is failing for Quartz64

I thought I had seen this building successfully before, but it seems that was not the case.

Error message is:

In file included from /github/workspace/projects/seL4_libs/libsel4bench/arch_include/arm/armv/armv8-a/sel4bench/armv/private.h:9,
                   from /github/workspace/projects/seL4_libs/libsel4bench/arch_include/arm/armv/armv8-a/sel4bench/armv/sel4bench.h:10,
                   from /github/workspace/projects/seL4_libs/libsel4bench/arch_include/arm/sel4bench/arch/sel4bench.h:12,
                   from /github/workspace/projects/seL4_libs/libsel4bench/include/sel4bench/sel4bench.h:13,
                   from /github/workspace/projects/seL4_libs/libsel4bench/src/arch/arm/event_counters.h:8,
                   from /github/workspace/projects/seL4_libs/libsel4bench/src/arch/arm/event_counters.c:6:
  /github/workspace/projects/seL4_libs/libsel4bench/arch_include/arm/armv/armv8-a/sel4bench/armv/events.h:74:10: fatal error: sel4bench/cpu/events.h: No such file or directory
     74 | #include <sel4bench/cpu/events.h>
        |          ^~~~~~~~~~~~~~~~~~~~~~~~
  compilation terminated.

Also here: https://github.com/seL4/sel4bench/actions/runs/3527176346/jobs/5915946235

Remove the IRQ Benchmark

The IRQ benchmark at sel4bench/apps/irq can be removed. It is disabled at the moment as it out of date and does not build. The purpose of this benchmark is to use with tracepoints, which can be done using any of the IRQUser benchmarks anyway - the only change required is to set up and read the kernel log buffer.

The results are not stable when using sel4bench.

I currently use the seL4bench to test some benchmarks. I use a for loop to evaluate the performance of my benchmark, and the results show that the performance of the first loop is 20 times slower than the next loops, and the next loops are steady. The following are the APIs I used in my experiment.

seL4_BenchmarkResetThreadUtilisation(simple_get_tcb(&env.simple)); 
 seL4_BenchmarkResetLog();
 test_suits();
 seL4_BenchmarkFinalizeLog();
 seL4_BenchmarkGetThreadUtilisation(simple_get_tcb(&env.simple))

And the following are the evaluation results.
image

CI action repo checkout python script get-prs can't find github module

The "Freeze Code" -> "Repo checkout" step shows an error that the python script get-prs can't find the module github. See in https://github.com/seL4/sel4bench/runs/5187557758?check_suite_focus=true for an example. The error is ignored, but I think the "test with" features for PR is broken due to this eventually.

Repo checkout
  Starting repo checkout on branch master with manifest master.xml:
  Downloading manifest from https://github.com/seL4/sel4bench-manifest
  
  repo has been initialized in /home/runner/work/sel4bench/sel4bench
  repo sync has finished successfully.
  Fetching refs/heads/master from github.com/seL4/sel4bench.git
  Traceback (most recent call last):
    File "/home/runner/work/_actions/seL4/ci-actions/master/js/../scripts/get-prs", line [21](https://github.com/seL4/sel4bench/runs/5187557758?check_suite_focus=true#step:2:21), in <module>
      from github import Github
  ModuleNotFoundError: No module named 'github'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.