mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-25 00:11:07 +00:00
bf62d6b896
Since the timer and timeout handling is part of the base library (the dynamic linker), it belongs to the base repository. Besides moving the timer and its related infrastructure (alarm, timeout libs, tests) to the base repository, this patch also moves the timer from the 'drivers' subdirectory directly to 'src' and disamibuates the timer's build locations for the various kernels. Otherwise the different timer implementations could interfere with each other when using one build directory with multiple kernels. Note that this patch changes the include paths for the former os/timer, os/alarm.h, os/duration.h, and os/timed_semaphore.h to base/. Issue #3101
120 lines
3.1 KiB
Plaintext
120 lines
3.1 KiB
Plaintext
#
|
|
# Build
|
|
#
|
|
|
|
#
|
|
# Wether the platform allows for timeouts that trigger with a precision < 50 milliseconds
|
|
#
|
|
proc precise_timeouts { } {
|
|
|
|
#
|
|
# On QEMU, NOVA uses the pretty unstable TSC emulation as primary time source.
|
|
#
|
|
if {[have_include "power_on/qemu"] && [have_spec nova]} { return false }
|
|
return true
|
|
}
|
|
|
|
#
|
|
# Wether the platform allows for a timestamp that has a precision < 1 millisecond
|
|
#
|
|
proc precise_time { } {
|
|
|
|
#
|
|
# On QEMU, timing is not stable enough for microseconds precision
|
|
#
|
|
if {[have_include "power_on/qemu"]} { return false }
|
|
|
|
#
|
|
# On ARM, we do not have a component-local time source in hardware. The ARM
|
|
# performance counter has no reliable frequency as the ARM idle command
|
|
# halts the counter. Thus, we do not use local time interpolation on ARM.
|
|
# Except we're on the HW kernel. In this case we can read out the kernel
|
|
# time instead.
|
|
#
|
|
if {[expr [have_spec arm] && ![have_spec hw]]} { return false }
|
|
|
|
#
|
|
# On x86 64 bit with SeL4, the test needs around 80MB that must be
|
|
# completely composed of 4KB-pages due to current limitations of the SeL4
|
|
# port. Thus, Core must flush the page table caches pretty often during
|
|
# the test which is an expensive high-prior operation and makes it
|
|
# impossible to provide a highly precise time.
|
|
#
|
|
if {[have_spec x86_64] && [have_spec sel4]} { return false }
|
|
|
|
#
|
|
# Older x86 machines do not have an invariant timestamp
|
|
#
|
|
if {[have_spec x86] && ![have_spec hw]} { return dynamic }
|
|
|
|
return true
|
|
}
|
|
|
|
#
|
|
# Wether the platform allows for a 'Timer::Connection::elapsed_ms'
|
|
# implementation that has a precision < 2 ms
|
|
#
|
|
proc precise_ref_time { } {
|
|
|
|
#
|
|
# On Fiasco and Fiasco.OC, that use kernel timing, 'elapsed_ms' is
|
|
# pretty inprecise/unsteady (up to 3 ms deviation) for a reason that
|
|
# is not clearly determined yet. So, on these platforms, our locally
|
|
# interpolated time seems to be fine but the reference time is bad.
|
|
#
|
|
if {[have_spec foc] || [have_spec fiasco]} { return false }
|
|
return true
|
|
}
|
|
|
|
build "core init drivers/platform timer test/timeout"
|
|
|
|
#
|
|
# Boot image
|
|
#
|
|
|
|
create_boot_directory
|
|
|
|
append config {
|
|
<config prio_levels="2">
|
|
<parent-provides>
|
|
<service name="ROM"/>
|
|
<service name="IRQ"/>
|
|
<service name="IO_MEM"/>
|
|
<service name="IO_PORT"/>
|
|
<service name="PD"/>
|
|
<service name="RM"/>
|
|
<service name="CPU"/>
|
|
<service name="LOG"/>
|
|
</parent-provides>
|
|
<default-route>
|
|
<any-service><parent/><any-child/></any-service>
|
|
</default-route>
|
|
<default caps="100"/>
|
|
<start name="timer">
|
|
<resource name="RAM" quantum="10M"/>
|
|
<provides><service name="Timer"/></provides>
|
|
</start>
|
|
<start name="test" priority="-1">
|
|
<binary name="test-timeout"/>
|
|
<resource name="RAM" quantum="250M"/>
|
|
<config precise_time="} [precise_time] {"
|
|
precise_ref_time="} [precise_ref_time] {"
|
|
precise_timeouts="} [precise_timeouts] {"/>
|
|
</start>
|
|
</config>
|
|
}
|
|
|
|
install_config $config
|
|
|
|
build_boot_image "core ld.lib.so init timer test-timeout"
|
|
|
|
#
|
|
# Execution
|
|
#
|
|
|
|
append qemu_args "-nographic "
|
|
|
|
run_genode_until "child \"test\" exited with exit value.*\n" 900
|
|
grep_output {\[init\] child "test" exited with exit value}
|
|
compare_output_to {[init] child "test" exited with exit value 0}
|