]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Disabling the old IO event logger as it doesn't run from worker loops anyway
authorMaria Matejka <mq@ucw.cz>
Wed, 28 Aug 2024 13:43:15 +0000 (15:43 +0200)
committerMaria Matejka <mq@ucw.cz>
Sun, 23 Feb 2025 17:21:25 +0000 (18:21 +0100)
lib/event.c
lib/timer.c
lib/timer.h
nest/config.Y
sysdep/unix/io-loop.c
sysdep/unix/io.c

index 79b8eb2cfb92d8844e0240301c2caa940dff06ce..efd79d731a241edd41e19f8cec0d0405014f9db9 100644 (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);
index 85519f441b876c96f395f91928b2a3ce5532b8e0..04cbc890e2edc4492c72c53b7898654a769764e8 100644 (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();
   }
index f52694c8966cbcddfdd6f2f8c281e827ccabfd3a..84a6bac5dddff3eb4d78a3d6f5f1746955e77801 100644 (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);
index 9ed9c124fcf5f3e26f7d940b254d6a0fb709bf04..314865b70b43d668f3746c143f50c8147bc2fd4d 100644 (file)
@@ -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]])
index 1ee67a79fce03bc5671160ccdb6c3876a4b1567a..a45813940ee7139df76582d11d9dbfc8b00137b0 100644 (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);
@@ -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);
index f4071ba5c3ec5814b823ac53a5680f658a250772..427b22973829ed9b0d56161c965e45dc8ab8d66e 100644 (file)
    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;