From: Maria Matejka Date: Wed, 28 Aug 2024 13:43:15 +0000 (+0200) Subject: Disabling the old IO event logger as it doesn't run from worker loops anyway X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9852d09684d396a2d504e68f130039f9d478abe;p=thirdparty%2Fbird.git Disabling the old IO event logger as it doesn't run from worker loops anyway --- diff --git a/lib/event.c b/lib/event.c index 79b8eb2cf..efd79d731 100644 --- a/lib/event.c +++ b/lib/event.c @@ -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); diff --git a/lib/timer.c b/lib/timer.c index 85519f441..04cbc890e 100644 --- a/lib/timer.c +++ b/lib/timer.c @@ -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(); } diff --git a/lib/timer.h b/lib/timer.h index f52694c89..84a6bac5d 100644 --- a/lib/timer.h +++ b/lib/timer.h @@ -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); diff --git a/nest/config.Y b/nest/config.Y index 9ed9c124f..314865b70 100644 --- a/nest/config.Y +++ b/nest/config.Y @@ -938,7 +938,7 @@ CF_CLI(DUMP RESOURCES, text,, [[Dump all allocated resource]]) CF_CLI(DUMP SOCKETS, text,, [[Dump open sockets]]) { cmd_dump_file(this_cli, $3, "sockets", sk_dump_all); } ; CF_CLI(DUMP EVENTS, text,, [[Dump event log]]) -{ cmd_dump_file(this_cli, $3, "event log", io_log_dump); } ; +{ /* cmd_dump_file(this_cli, $3, "event log", io_log_dump); */ cli_msg(0, "Warning: this command did nothing and we still need to figure out how to reimplement it properly."); } ; CF_CLI(DUMP INTERFACES, text,, [[Dump interface information]]) { cmd_dump_file(this_cli, $3, "interfaces", if_dump_all); } ; CF_CLI(DUMP NEIGHBORS, text,, [[Dump neighbor cache]]) diff --git a/sysdep/unix/io-loop.c b/sysdep/unix/io-loop.c index 1ee67a79f..a45813940 100644 --- a/sysdep/unix/io-loop.c +++ b/sysdep/unix/io-loop.c @@ -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); @@ -1549,7 +1549,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); diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index f4071ba5c..427b22973 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -61,6 +61,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 @@ -152,13 +158,19 @@ io_log_dump(struct dump_request *dreq) } } +#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"); @@ -169,18 +181,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) @@ -193,7 +201,7 @@ watchdog_start(void) static inline void watchdog_stop(void) { - io_update_time(); + last_io_time = current_time_now(); if (watchdog_active) { @@ -203,9 +211,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)); } @@ -256,8 +270,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) || @@ -285,21 +299,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; @@ -346,7 +360,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); @@ -359,7 +373,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); @@ -390,7 +404,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;