From c7c294a1fc7b7ddd0c1e442a2d3fe99775aeb988 Mon Sep 17 00:00:00 2001 From: Hesham Almatary Date: Wed, 28 Sep 2016 10:52:27 +1000 Subject: [PATCH 1/2] Benchmarks: Add new generic benchmark entry mode This enables non-feature specific benchmarking mode. It just defines CONFIG_ENABLE_BENCHMARKS. --- Kconfig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Kconfig b/Kconfig index ac8b36d40..47f6f9b10 100644 --- a/Kconfig +++ b/Kconfig @@ -540,6 +540,12 @@ menu "Build Options" config NO_BENCHMARKS bool "No benchmarking features enabled" + config BENCHMARK_GENERIC + bool "Enable generic benchmarks" + select ENABLE_BENCHMARKS + help + Enable global benchmarks config variable with no specific features + config BENCHMARK_TRACK_KERNEL_ENTRIES bool "Keep track of kernel entries" select ENABLE_BENCHMARKS From 9c507cffd1472a41700417c91d87d7e12d1eb641 Mon Sep 17 00:00:00 2001 From: Hesham Almatary Date: Wed, 28 Sep 2016 10:57:08 +1000 Subject: [PATCH 2/2] SELFOUR-603 - Benchmark: Add null syscall --- libsel4/include/api/syscall.xml | 1 + .../aarch32/sel4/sel4_arch/syscalls.h | 11 +++++++++++ .../ia32/sel4/sel4_arch/syscalls.h | 19 +++++++++++++++++++ src/api/syscall.c | 3 +++ 4 files changed, 34 insertions(+) diff --git a/libsel4/include/api/syscall.xml b/libsel4/include/api/syscall.xml index 67c070266..37792580d 100644 --- a/libsel4/include/api/syscall.xml +++ b/libsel4/include/api/syscall.xml @@ -41,6 +41,7 @@ + diff --git a/libsel4/sel4_arch_include/aarch32/sel4/sel4_arch/syscalls.h b/libsel4/sel4_arch_include/aarch32/sel4/sel4_arch/syscalls.h index 370b97583..a29e5b5a6 100644 --- a/libsel4/sel4_arch_include/aarch32/sel4/sel4_arch/syscalls.h +++ b/libsel4/sel4_arch_include/aarch32/sel4/sel4_arch/syscalls.h @@ -626,6 +626,17 @@ seL4_BenchmarkSetLogBuffer(seL4_Word frame_cptr) return (seL4_Error) arg1; } + +static inline void +seL4_BenchmarkNullSyscall(void) +{ + register seL4_Word scno asm("r7") = seL4_SysBenchmarkNullSyscall; + asm volatile ("swi %[swi_num]" + : /* no outputs */ + : [swi_num] "i" __SEL4_SWINUM(seL4_SysBenchmarkNullSyscall), "r"(scno) + : "memory"); +} + #ifdef CONFIG_BENCHMARK_TRACK_UTILISATION static inline void seL4_BenchmarkGetThreadUtilisation(seL4_Word tcp_cptr) diff --git a/libsel4/sel4_arch_include/ia32/sel4/sel4_arch/syscalls.h b/libsel4/sel4_arch_include/ia32/sel4/sel4_arch/syscalls.h index 120d55678..3af478a4f 100644 --- a/libsel4/sel4_arch_include/ia32/sel4/sel4_arch/syscalls.h +++ b/libsel4/sel4_arch_include/ia32/sel4/sel4_arch/syscalls.h @@ -730,6 +730,25 @@ seL4_BenchmarkSetLogBuffer(seL4_Word frame_cptr) return (seL4_Error) frame_cptr; } + +static inline void +seL4_BenchmarkNullSyscall(void) +{ + asm volatile ( + "pushl %%ebp \n" + SEL4_REGS_SAVE + "movl %%esp, %%ecx \n" + "leal 1f, %%edx \n" + "1: \n" + "sysenter \n" + SEL4_REGS_RESTORE + "popl %%ebp \n" + : + : "a" (seL4_SysBenchmarkNullSyscall) + : SEL4_REGS_CLOBBER_EBX "%ecx", "%edx", "%esi", "%edi", "memory" + ); +} + #ifdef CONFIG_BENCHMARK_TRACK_UTILISATION static inline void seL4_BenchmarkGetThreadUtilisation(seL4_Word tcb_cptr) diff --git a/src/api/syscall.c b/src/api/syscall.c index b1bd25a64..15b3c8970 100644 --- a/src/api/syscall.c +++ b/src/api/syscall.c @@ -171,6 +171,9 @@ handleUnknownSyscall(word_t w) } #endif /* CONFIG_BENCHMARK_TRACK_UTILISATION */ + else if (w == SysBenchmarkNullSyscall) { + return EXCEPTION_NONE; + } #endif /* CONFIG_ENABLE_BENCHMARKS */ current_fault = fault_unknown_syscall_new(w);