bugfix: fix UE realtime bug
When pushing traffic with iperf the UE was crashing. The argument passed to pthread_mutex_timedlock is absolute time based on the CLOCK_REALTIME timer, not relative time. That seems to be the root cause of the bug. (That there is a timeout is another story.) This commit uses absolute value. Also we separate cases between IS_SOFTMODEM_BASICSIM / IS_SOFTMODEM_RFSIM and standard realtime UE. In the 'sim' modes we don't care about timeout and just call pthread_mutex_lock. It seems to be the idea of the original work. If not, then to be fixed.
This commit is contained in:
@@ -1503,6 +1503,7 @@ void *UE_thread(void *arg) {
|
||||
int i;
|
||||
int th_id;
|
||||
static uint8_t thread_idx = 0;
|
||||
int ret;
|
||||
cpu_set_t cpuset;
|
||||
CPU_ZERO(&cpuset);
|
||||
|
||||
@@ -1724,15 +1725,27 @@ void *UE_thread(void *arg) {
|
||||
}
|
||||
|
||||
pickTime(gotIQs);
|
||||
struct timespec tv= {0};
|
||||
tv.tv_nsec=10*1000;
|
||||
|
||||
if( IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM)
|
||||
tv.tv_sec=INT_MAX;
|
||||
/* no timeout in IS_SOFTMODEM_BASICSIM or IS_SOFTMODEM_RFSIM mode */
|
||||
if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM) {
|
||||
ret = pthread_mutex_lock(&proc->mutex_rxtx);
|
||||
} else {
|
||||
struct timespec tv;
|
||||
if (clock_gettime(CLOCK_REALTIME, &tv) != 0) {
|
||||
perror("clock_gettime");
|
||||
exit(1);
|
||||
}
|
||||
tv.tv_nsec += 10*1000;
|
||||
if (tv.tv_nsec >= 1000 * 1000 * 1000) {
|
||||
tv.tv_sec++;
|
||||
tv.tv_nsec -= 1000 * 1000 * 1000;
|
||||
}
|
||||
ret = pthread_mutex_timedlock(&proc->mutex_rxtx, &tv);
|
||||
}
|
||||
|
||||
// operate on thread sf mod 2
|
||||
if (pthread_mutex_timedlock(&proc->mutex_rxtx, &tv) !=0) {
|
||||
if ( errno == ETIMEDOUT) {
|
||||
if (ret != 0) {
|
||||
if (ret == ETIMEDOUT) {
|
||||
LOG_E(PHY,"Missed real time\n");
|
||||
continue;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user