mcs: allow kernel WCET estimate to be scaled

This configuration option allows for building images destined for
simulators, which may not simulate as fast as hardware, to still be
used.
This commit is contained in:
Adrian Danis
2017-08-23 16:48:31 +10:00
committed by Kent Mcleod
parent 2329cd81dc
commit 4768465027
3 changed files with 19 additions and 2 deletions

View File

@@ -442,4 +442,16 @@ config_option(
# of the currently running thread without a capability. # of the currently running thread without a capability.
config_set(KernelSetTLSBaseSelf SET_TLS_BASE_SELF ${KernelSetTLSBaseSelf}) config_set(KernelSetTLSBaseSelf SET_TLS_BASE_SELF ${KernelSetTLSBaseSelf})
config_string(
KernelWcetScale KERNEL_WCET_SCALE
"Multiplier to scale kernel WCET estimate by: the kernel WCET estimate \
is used to ensure a thread has enough budget to get in and out of the \
kernel. When running in a simulator the WCET estimate, which is tuned \
for hardware, may not be sufficient. This option provides a hacky knob \
that can be fiddled with when running inside a simulator."
DEFAULT 1
UNQUOTE
DEPENDS "KernelIsMCS" UNDEF_DISABLED
)
add_config_library(kernel "${configure_string}") add_config_library(kernel "${configure_string}")

View File

@@ -33,6 +33,10 @@
#ifndef CONFIG_BOOT_THREAD_TIME_SLICE #ifndef CONFIG_BOOT_THREAD_TIME_SLICE
#define CONFIG_BOOT_THREAD_TIME_SLICE 5 #define CONFIG_BOOT_THREAD_TIME_SLICE 5
#endif #endif
#ifndef CONFIG_KERNEL_WCET_SCALE
#define CONFIG_KERNEL_WCET_SCALE 1
#endif
#endif #endif
/* the number of scheduler domains */ /* the number of scheduler domains */

View File

@@ -28,6 +28,7 @@
* minimum size is 2, and can be configured by the user per scheduling context * minimum size is 2, and can be configured by the user per scheduling context
* above this) the next refill is merged. * above this) the next refill is merged.
*/ */
#include <config.h>
#include <types.h> #include <types.h>
#include <util.h> #include <util.h>
#include <object/structures.h> #include <object/structures.h>
@@ -36,8 +37,8 @@
/* To do an operation in the kernel, the thread must have /* To do an operation in the kernel, the thread must have
* at least this much budget - see comment on refill_sufficient */ * at least this much budget - see comment on refill_sufficient */
#define MIN_BUDGET_US (2u * getKernelWcetUs()) #define MIN_BUDGET_US (2u * getKernelWcetUs() * CONFIG_KERNEL_WCET_SCALE)
#define MIN_BUDGET (2u * getKernelWcetTicks()) #define MIN_BUDGET (2u * getKernelWcetTicks() * CONFIG_KERNEL_WCET_SCALE)
/* Short hand for accessing refill queue items */ /* Short hand for accessing refill queue items */
#define REFILL_INDEX(sc, index) (((refill_t *) (SC_REF(sc) + sizeof(sched_context_t)))[index]) #define REFILL_INDEX(sc, index) (((refill_t *) (SC_REF(sc) + sizeof(sched_context_t)))[index])