From 7c334e26708bdbd5cfbf96ca43971a922253e3e9 Mon Sep 17 00:00:00 2001 From: Tomas Hruby Date: Fri, 7 May 2010 18:12:16 +0000 Subject: [PATCH] RS - fixed timeouts - rs does not assume hz==60 - rs adjusts its timeout ticks by the system clock frequency - drivers have time to reply if hz is set too high (e.g. 1000+) for instance when debugging --- servers/rs/const.h | 4 ++-- servers/rs/glo.h | 2 ++ servers/rs/main.c | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/servers/rs/const.h b/servers/rs/const.h index 85e4a980c..cabac55cb 100644 --- a/servers/rs/const.h +++ b/servers/rs/const.h @@ -38,8 +38,8 @@ #define SF_USE_REPL 0x020 /* set when process has a replica */ /* Constants determining RS period and binary exponential backoff. */ -#define RS_INIT_T 600 /* allow T ticks for init */ -#define RS_DELTA_T 60 /* check every T ticks */ +#define RS_INIT_T (system_hz * 10) /* allow T ticks for init */ +#define RS_DELTA_T (system_hz) /* check every T ticks */ #define BACKOFF_BITS (sizeof(long)*8) /* bits in backoff field */ #define MAX_BACKOFF 30 /* max backoff in RS_DELTA_T */ diff --git a/servers/rs/glo.h b/servers/rs/glo.h index a6b897a79..4998e8553 100644 --- a/servers/rs/glo.h +++ b/servers/rs/glo.h @@ -52,5 +52,7 @@ EXTERN long rs_verbose; /* Set when we are shutting down. */ EXTERN int shutting_down; +EXTERN unsigned system_hz; + #endif /* RS_GLO_H */ diff --git a/servers/rs/main.c b/servers/rs/main.c index f9a3d1bc3..58f5af3be 100644 --- a/servers/rs/main.c +++ b/servers/rs/main.c @@ -169,6 +169,9 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) /* See if we run in verbose mode. */ env_parse("rs_verbose", "d", 0, &rs_verbose, 0, 1); + if ((s = sys_getinfo(GET_HZ, &system_hz, sizeof(system_hz), 0, 0)) != OK) + panic("Cannot get system timer frequency\n"); + /* Initialize the global init descriptor. */ rinit.rproctab_gid = cpf_grant_direct(ANY, (vir_bytes) rprocpub, sizeof(rprocpub), CPF_READ); -- 2.44.0