fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/40156?usp=email )
Change subject: osmo-bts-trx: trx_fn_timer_cb(): fix misleading shutdown reason ......................................................................
osmo-bts-trx: trx_fn_timer_cb(): fix misleading shutdown reason
If osmo-bts-trx exit()s due to the PC clock issues, e.g. if the process stalls, it produces rather confusing logging messages:
DL1C ERROR PC clock skew: elapsed_us=387574, error_us=382959 DOML NOTICE ... Shutting down BTS, exit 1, reason: No clock from osmo-trx
The second message suggests that the transceiver (osmo-trx) is the culprit, but the first one reflects the actual reason (PC clock skew).
Let's pass proper shutdown reason to avoid confusion.
Change-Id: Ibbbbc4e919e6eb812882fc60de4be13fa77934b7 --- M src/osmo-bts-trx/scheduler_trx.c 1 file changed, 11 insertions(+), 7 deletions(-)
Approvals: laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve fixeria: Looks good to me, approved Jenkins Builder: Verified
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c index 00143ab..a9a53f6 100644 --- a/src/osmo-bts-trx/scheduler_trx.c +++ b/src/osmo-bts-trx/scheduler_trx.c @@ -411,6 +411,7 @@ struct timespec tv_now; uint64_t expire_count; int64_t elapsed_us, error_us; + const char *reason = NULL; int rc, i;
if (!(what & OSMO_FD_READ)) @@ -430,8 +431,9 @@
/* check if transceiver is still alive */ if (tcs->fn_without_clock_ind++ == TRX_LOSS_FRAMES) { - LOGP(DL1C, LOGL_NOTICE, "No more clock from transceiver\n"); - goto no_clock; + reason = "No more clock from transceiver"; + LOGP(DL1C, LOGL_ERROR, "%s\n", reason); + goto shutdown; }
/* compute actual elapsed time and resulting OS scheduling error */ @@ -446,9 +448,11 @@
/* if someone played with clock, or if the process stalled */ if (elapsed_us > GSM_TDMA_FN_DURATION_uS * MAX_FN_SKEW || elapsed_us < 0) { - LOGP(DL1C, LOGL_ERROR, "PC clock skew: elapsed_us=%" PRId64 ", error_us=%" PRId64 "\n", - elapsed_us, error_us); - goto no_clock; + LOGP(DL1C, LOGL_ERROR, + "PC clock skew: elapsed_us=%" PRId64 ", error_us=%" PRId64 "\n", + elapsed_us, error_us); + reason = "PC clock skew too high"; + goto shutdown; }
/* call bts_sched_fn() for all expired FN */ @@ -457,9 +461,9 @@
return 0;
-no_clock: +shutdown: osmo_timerfd_disable(&tcs->fn_timer_ofd); - bts_shutdown(bts, "No clock from osmo-trx"); + bts_shutdown(bts, reason); return -1; }