<p>fixeria has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmocom-bb/+/17449">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">trxcon/scheduler: fix: let pespin run it for more than 6 years<br><br>As was noted by Pau Espin Pedrol, there is a theoretical chance<br>that lchan->tdma.num_proc would overflow, so as a consequence,<br>subst_frame_loss() will be unable to compensate one<br>(potentionally lost) Downlink burst.<br><br>On practice, given the size of unsigned long and duration of a<br>single TDMA frame, it would only happen once in roughly ~6 years.<br><br>  FRAME_DURATION = 4615 * 10e-6<br>  ULONG_MAX = 2 ** 32 - 1<br><br>  FRAME_DURATION * ULONG_MAX -> ~198212740 seconds<br>                             -> ~55059 hours<br>                             -> ~2294 days<br>                             -> ~6 years.<br><br>Chances are that trxcon would crash much earlier, or even GSM<br>would be completely forgotten during such a long time run, but<br>let's make pespin run it as much as he needs, and simply start<br>counting from 1 if that eventually happens.<br><br>Change-Id: I3d40ef09b06039a85df52af06ab38de314e1a434<br>---<br>M src/host/trxcon/sched_trx.c<br>1 file changed, 10 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/49/17449/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c</span><br><span>index 1efae24..b53b0e8 100644</span><br><span>--- a/src/host/trxcon/sched_trx.c</span><br><span>+++ b/src/host/trxcon/sched_trx.c</span><br><span>@@ -721,7 +721,16 @@</span><br><span> </span><br><span>  /* Update TDMA frame statistics */</span><br><span>   lchan->tdma.last_proc = fn;</span><br><span style="color: hsl(0, 100%, 40%);">-  lchan->tdma.num_proc++;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  if (++lchan->tdma.num_proc == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+         /* Theoretically, we may have an integer overflow of num_proc counter.</span><br><span style="color: hsl(120, 100%, 40%);">+                 * As a consequence, subst_frame_loss() will be unable to compensate</span><br><span style="color: hsl(120, 100%, 40%);">+           * one (potentionally lost) Downlink burst. On practice, it would</span><br><span style="color: hsl(120, 100%, 40%);">+              * happen once in 4615 * 10e-6 * (2 ^ 32 - 1) seconds or ~6 years. */</span><br><span style="color: hsl(120, 100%, 40%);">+         LOGP(DSCHD, LOGL_NOTICE, "Too many TDMA frames have been processed. "</span><br><span style="color: hsl(120, 100%, 40%);">+                                        "Are you running trxcon for more than 6 years?!?\n");</span><br><span style="color: hsl(120, 100%, 40%);">+              lchan->tdma.num_proc = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+  }</span><br><span> </span><br><span>        return 0;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmocom-bb/+/17449">change 17449</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmocom-bb/+/17449"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmocom-bb </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I3d40ef09b06039a85df52af06ab38de314e1a434 </div>
<div style="display:none"> Gerrit-Change-Number: 17449 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: fixeria <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>