[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH v3] plat/*: Configure timer interrupt frequency
Add new configuration options for choosing a timer interrupt frequency. This patch adds only 100 Hz and 1000 Hz as currently supported values. The configured frequency is converted to the timer tick length which can be of use for other modules (e.g. preemptive schedulers). We choose 100 Hz as the default value (timer tick value being 10 ms) which keeps the same behavior on KVM platform, but it changes from 1000 Hz on Xen platform. Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx> --- include/uk/plat/time.h | 4 ++++ plat/Config.uk | 17 +++++++++++++++++ plat/kvm/x86/tscclock.c | 8 ++++---- plat/linuxu/include/linuxu/time.h | 3 ++- plat/xen/x86/arch_time.c | 2 +- 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/include/uk/plat/time.h b/include/uk/plat/time.h index 202e0f9..ca29aaf 100644 --- a/include/uk/plat/time.h +++ b/include/uk/plat/time.h @@ -47,6 +47,10 @@ void ukplat_time_fini(void); __nsec ukplat_monotonic_clock(void); +/* Time tick length */ +#define UKPLAT_TIME_TICK_MSEC (1000 / CONFIG_HZ) +#define UKPLAT_TIME_TICK_NSEC ukarch_time_msec_to_nsec(UKPLAT_TIME_TICK_MSEC) + #ifdef __cplusplus } #endif diff --git a/plat/Config.uk b/plat/Config.uk index b776c45..849d7c2 100644 --- a/plat/Config.uk +++ b/plat/Config.uk @@ -17,3 +17,20 @@ config EARLY_PRINT_PL011_UART_ADDR Pl011 serial address used by early debug console. endmenu + +choice + prompt "Timer frequency" + default HZ_100 + help + Configure the timer interrupt frequency. + + config HZ_100 + bool "100 HZ" + config HZ_1000 + bool "1000 HZ" +endchoice + +config HZ + int + default 100 if HZ_100 + default 1000 if HZ_1000 diff --git a/plat/kvm/x86/tscclock.c b/plat/kvm/x86/tscclock.c index 4ef2179..3488e34 100644 --- a/plat/kvm/x86/tscclock.c +++ b/plat/kvm/x86/tscclock.c @@ -131,7 +131,7 @@ static void i8254_delay(unsigned int n) { unsigned int cur_tick, initial_tick; int remaining; - const unsigned long timer_rval = TIMER_HZ / 100; + const unsigned long timer_rval = TIMER_HZ / CONFIG_HZ; initial_tick = i8254_gettick(); @@ -211,10 +211,10 @@ int tscclock_init(void) { __u64 tsc_freq, rtc_boot; - /* Initialise i8254 timer channel 0 to mode 2 at 100 Hz */ + /* Initialise i8254 timer channel 0 to mode 2 at CONFIG_HZ frequency */ outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); - outb(TIMER_CNTR, (TIMER_HZ / 100) & 0xff); - outb(TIMER_CNTR, (TIMER_HZ / 100) >> 8); + outb(TIMER_CNTR, (TIMER_HZ / CONFIG_HZ) & 0xff); + outb(TIMER_CNTR, (TIMER_HZ / CONFIG_HZ) >> 8); /* * Read RTC "time at boot". This must be done just before tsc_base is diff --git a/plat/linuxu/include/linuxu/time.h b/plat/linuxu/include/linuxu/time.h index 2df881e..09518a4 100644 --- a/plat/linuxu/include/linuxu/time.h +++ b/plat/linuxu/include/linuxu/time.h @@ -35,9 +35,10 @@ #ifndef __LINUXU_TIME_H__ #define __LINUXU_TIME_H__ +#include <uk/plat/time.h> #include <linuxu/signal.h> -#define TIMER_INTVAL_MSEC 10 +#define TIMER_INTVAL_MSEC UKPLAT_TIME_TICK_MSEC #define TIMER_SIGNUM SIGALRM diff --git a/plat/xen/x86/arch_time.c b/plat/xen/x86/arch_time.c index 95d7b10..a4b77b9 100644 --- a/plat/xen/x86/arch_time.c +++ b/plat/xen/x86/arch_time.c @@ -233,7 +233,7 @@ void time_block_until(__snsec until) static void timer_handler(evtchn_port_t ev __unused, struct __regs *regs __unused, void *ign __unused) { - __nsec until = ukplat_monotonic_clock() + ukarch_time_msec_to_nsec(1); + __nsec until = ukplat_monotonic_clock() + UKPLAT_TIME_TICK_NSEC; HYPERVISOR_set_timer_op(until); } -- 2.11.0 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |