0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Disabling the old IO event logger as it doesn't run from worker loops anyway

This commit is contained in:
Maria Matejka 2024-08-28 15:43:15 +02:00
parent 03a87c4f7c
commit 8e7fef42bb
6 changed files with 36 additions and 34 deletions

View File

@ -269,8 +269,6 @@ ev_send(event_list *l, event *e)
if (l->loop) birdloop_ping(l->loop);
}
void io_log_event(void *hook, void *data, uint flag);
/**
* ev_run_list - run an event list
* @l: an event list
@ -320,10 +318,6 @@ ev_run_list_limited(event_list *l, uint limit)
if (!--limit)
return 1;
/* This is ugly hack, we want to log just events executed from the main I/O loop */
if ((l == &global_event_list) || (l == &global_work_list))
io_log_event(e->hook, e->data, DL_EVENTS);
edlog(l, e, NULL, 6, EDL_RUN_LIST);
/* Inactivate the event */
event *next = atomic_load_explicit(&e->next, memory_order_relaxed);

View File

@ -156,10 +156,8 @@ timers_init(struct timeloop *loop, pool *p)
BUFFER_PUSH(loop->timers) = NULL;
}
void io_log_event(void *hook, void *data, uint flag);
void
timers_fire(struct timeloop *loop, int io_log)
timers_fire(struct timeloop *loop)
{
TLOCK_TIMER_ASSERT(loop);
@ -189,10 +187,6 @@ timers_fire(struct timeloop *loop, int io_log)
else
tm_stop(t);
/* This is ugly hack, we want to log just timers executed from the main I/O loop */
if (io_log)
io_log_event(t->hook, t->data, DL_TIMERS);
t->hook(t);
tmp_flush();
}

View File

@ -115,7 +115,7 @@ void times_update(void);
/* For I/O loop */
void timers_init(struct timeloop *loop, pool *p);
void timers_fire(struct timeloop *loop, int io_log);
void timers_fire(struct timeloop *loop);
/* For extra fine precision */
u64 ns_now(void);

View File

@ -952,7 +952,7 @@ CF_CLI(DUMP RESOURCES,,, [[Dump all allocated resource]])
CF_CLI(DUMP SOCKETS,,, [[Dump open sockets]])
{ sk_dump_all(); cli_msg(0, ""); } ;
CF_CLI(DUMP EVENTS,,, [[Dump event log]])
{ io_log_dump(); cli_msg(0, ""); } ;
{ /* io_log_dump(); */ cli_msg(0, "Warning: this command did nothing, needs reimplementation"); } ;
CF_CLI(DUMP INTERFACES,,, [[Dump interface information]])
{ if_dump_all(); cli_msg(0, ""); } ;
CF_CLI(DUMP NEIGHBORS,,, [[Dump neighbor cache]])

View File

@ -835,7 +835,7 @@ bird_thread_main(void *arg)
int timeout;
/* Schedule all loops with timed out timers */
timers_fire(&thr->meta->time, 0);
timers_fire(&thr->meta->time);
/* Pickup new loops */
birdloop_take(thr->group);
@ -1540,7 +1540,7 @@ birdloop_run(void *_loop)
sockets_fire(loop, 0, 1);
/* Run timers */
timers_fire(&loop->time, 0);
timers_fire(&loop->time);
/* Run events */
repeat = ev_run_list(&loop->event_list);

View File

@ -59,6 +59,12 @@
this to gen small latencies */
#define MAX_RX_STEPS 4
#if 0
/**********
* Internal event log for the mainloop only makes no sense.
* To be replaced by a lockless event log keeping much more information
* about all the logs throughout all the threads.
*/
/*
* Internal event log and watchdog
@ -150,13 +156,19 @@ io_log_dump(void)
}
}
#endif
static btime last_io_time, loop_time;
static int watchdog_active;
void
watchdog_sigalrm(int sig UNUSED)
{
/* Update last_io_time and duration, but skip latency check */
struct global_runtime *gr = atomic_load_explicit(&global_runtime, memory_order_relaxed);
gr->latency_limit = 0xffffffff;
io_update_time();
last_io_time = current_time_now();
debug_safe("Watchdog timer timed out\n");
@ -167,18 +179,14 @@ watchdog_sigalrm(int sig UNUSED)
static inline void
watchdog_start1(void)
{
io_update_time();
loop_time = last_io_time;
loop_time = last_io_time = current_time_now();
}
static inline void
watchdog_start(void)
{
io_update_time();
loop_time = last_io_time;
event_log_num = 0;
loop_time = last_io_time = current_time_now();
// event_log_num = 0;
union bird_global_runtime *gr = BIRD_GLOBAL_RUNTIME;
if (gr->watchdog_timeout)
@ -191,7 +199,7 @@ watchdog_start(void)
static inline void
watchdog_stop(void)
{
io_update_time();
last_io_time = current_time_now();
if (watchdog_active)
{
@ -201,9 +209,15 @@ watchdog_stop(void)
btime duration = last_io_time - loop_time;
union bird_global_runtime *gr = BIRD_GLOBAL_RUNTIME;
/*
if (duration > gr->watchdog_warning)
log(L_WARN "I/O loop cycle took %u.%03u ms for %d events",
(uint) (duration TO_MS), (uint) (duration % 1000), event_log_num);
*/
if (duration > gr->watchdog_warning)
log(L_WARN "I/O loop cycle took %u.%03u ms",
(uint) (duration TO_MS), (uint) (duration % 1000));
}
@ -254,8 +268,8 @@ io_loop(void)
ev_run_list(&global_event_list);
ev_run_list_limited(&global_work_list, WORK_EVENTS_MAX);
ev_run_list(&main_birdloop.event_list);
timers_fire(&main_birdloop.time, 1);
io_close_event();
timers_fire(&main_birdloop.time);
// io_close_event();
events =
!ev_list_empty(&global_event_list) ||
@ -283,21 +297,21 @@ io_loop(void)
if (async_config_flag)
{
io_log_event(async_config, NULL, DL_EVENTS);
// io_log_event(async_config, NULL, DL_EVENTS);
async_config();
async_config_flag = 0;
continue;
}
if (async_dump_flag)
{
io_log_event(async_dump, NULL, DL_EVENTS);
// io_log_event(async_dump, NULL, DL_EVENTS);
async_dump();
async_dump_flag = 0;
continue;
}
if (async_shutdown_flag)
{
io_log_event(async_shutdown, NULL, DL_EVENTS);
// io_log_event(async_shutdown, NULL, DL_EVENTS);
async_shutdown();
async_shutdown_flag = 0;
continue;
@ -344,7 +358,7 @@ io_loop(void)
do
{
steps--;
io_log_event(s->rx_hook, s->data, DL_SOCKETS);
// io_log_event(s->rx_hook, s->data, DL_SOCKETS);
e = sk_read(s, pfd.pfd.data[s->index].revents);
}
while (e && (main_birdloop.sock_active == s) && s->rx_hook && steps);
@ -357,7 +371,7 @@ io_loop(void)
do
{
steps--;
io_log_event(s->tx_hook, s->data, DL_SOCKETS);
// io_log_event(s->tx_hook, s->data, DL_SOCKETS);
e = sk_write(s);
}
while (e && (main_birdloop.sock_active == s) && steps);
@ -388,7 +402,7 @@ io_loop(void)
if (!s->fast_rx && (pfd.pfd.data[s->index].revents & POLLIN) && s->rx_hook)
{
count++;
io_log_event(s->rx_hook, s->data, DL_SOCKETS);
// io_log_event(s->rx_hook, s->data, DL_SOCKETS);
sk_read(s, pfd.pfd.data[s->index].revents);
if (s != main_birdloop.sock_active)
continue;