Change in osmo-bts[master]: bts-trx: reorder first timerfd schedule to decrease first timeout skew

pespin gerrit-no-reply at lists.osmocom.org
Mon Mar 15 17:33:28 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/23368 )


Change subject: bts-trx: reorder first timerfd schedule to decrease first timeout skew
......................................................................

bts-trx: reorder first timerfd schedule to decrease first timeout skew

By reordering the instruction, we scheduler the timerfd prior to
processing the FN on the upper layers. This means the first timerfd
expiration even will happen more inline with the expected time, that is,
CLOCK IND time + GSM_TDMA_FN_DURATION_nS.

Let T(trx_sched_fn) be the time spent executing function trx_sched_fn().
With previous order, the timerfd would have been scheduled later, which
in the end would mean expiration would happen at time CLOCK_IND +
GSM_TDMA_FN_DURATION_nS + T(trx_sched_fn), hence ending up with an extra
skew of T(trx_sched_fn) added by ourselves.
This extra skew added may be important specially at startup time (when
this code path is used), since usually the load in the system is high
and skew is usually already higher, which means helping crossing
unacceptable thresholds which may end up in osmo-bts-trx stopping with
"No clock from osmo-trx" reason.

Change-Id: Ie2ba35cd87f0bd4078ac3b4b5ec2eacad36c4258
---
M src/osmo-bts-trx/scheduler_trx.c
1 file changed, 3 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/68/23368/1

diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 6e54d43..efd4954 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -369,15 +369,14 @@
 static int trx_setup_clock(struct gsm_bts *bts, struct osmo_trx_clock_state *tcs,
 	struct timespec *tv_now, const struct timespec *interval, uint32_t fn)
 {
-	tcs->last_fn_timer.fn = fn;
-	/* call trx cheduler function for new 'last' FN */
-	trx_sched_fn(bts, tcs->last_fn_timer.fn);
-
 	/* schedule first FN clock timer */
 	osmo_timerfd_setup(&tcs->fn_timer_ofd, trx_fn_timer_cb, bts);
 	osmo_timerfd_schedule(&tcs->fn_timer_ofd, NULL, interval);
 
+	tcs->last_fn_timer.fn = fn;
 	tcs->last_fn_timer.tv = *tv_now;
+	/* call trx scheduler function for new 'last' FN */
+	trx_sched_fn(bts, tcs->last_fn_timer.fn);
 
 	return 0;
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/23368
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ie2ba35cd87f0bd4078ac3b4b5ec2eacad36c4258
Gerrit-Change-Number: 23368
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210315/c594572b/attachment.htm>


More information about the gerrit-log mailing list