From 658aa0011929254b1edb955ed9629fa418b71e44 Mon Sep 17 00:00:00 2001 From: WANG Tsu-Han <wangts@eurecom.fr> Date: Tue, 10 Apr 2018 16:52:05 +0200 Subject: [PATCH] bug fix for threading with under 8core --- targets/RT/USER/lte-enb.c | 22 ++++++++++++++++++++-- targets/RT/USER/lte-ru.c | 5 +++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index 3a526a7380..d12cb3edb2 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -243,7 +243,17 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER , 0 ); if(oai_exit) return(-1); - if(get_nprocs() <= 4) phy_procedures_eNB_TX(eNB, proc, no_relay, NULL, 1); + if(get_nprocs() <= 4){ + phy_procedures_eNB_TX(eNB, proc, no_relay, NULL, 1); + pthread_mutex_lock( &proc[1].mutex_rxtx ); + proc[1].pipe_ready++; + // the thread can now be woken up + if (pthread_cond_signal(&proc[1].cond_rxtx) != 0) { + LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); + exit_fun( "ERROR pthread_cond_signal" ); + } + pthread_mutex_unlock( &proc[1].mutex_rxtx ); + } stop_meas( &softmodem_stats_rxtx_sf ); @@ -404,9 +414,17 @@ static void* eNB_thread_rxtx( void* param ) { } pthread_mutex_unlock( &proc->mutex_rxtx ); if(get_nprocs() >= 8) wakeup_tx(eNB,eNB->proc.ru_proc); - else if(get_nprocs() > 4) + else { phy_procedures_eNB_TX(eNB, proc, no_relay, NULL, 1); + pthread_mutex_lock( &proc[1].mutex_rxtx ); + proc[1].pipe_ready++; + // the thread can now be woken up + if (pthread_cond_signal(&proc[1].cond_rxtx) != 0) { + LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); + exit_fun( "ERROR pthread_cond_signal" ); + } + pthread_mutex_unlock( &proc->mutex_rxtx ); wakeup_txfh(proc,eNB->proc.ru_proc); } diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index ca2304e8bb..c634a12bb8 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -1940,6 +1940,8 @@ void kill_RU_proc(int inst) LOG_D(PHY, "Joining pthread_FH\n"); pthread_join(proc->pthread_FH, NULL); + LOG_D(PHY, "Joining pthread_FHTX\n"); + pthread_join(proc->pthread_FH1, NULL); if (ru->function == NGFI_RRU_IF4p5) { LOG_D(PHY, "Joining pthread_prach\n"); pthread_join(proc->pthread_prach, NULL); @@ -1990,15 +1992,18 @@ void kill_RU_proc(int inst) pthread_mutex_destroy(&proc->mutex_asynch_rxtx); pthread_mutex_destroy(&proc->mutex_synch); pthread_mutex_destroy(&proc->mutex_FH); + pthread_mutex_destroy(&proc->mutex_FH1); pthread_mutex_destroy(&proc->mutex_eNBs); pthread_cond_destroy(&proc->cond_prach); pthread_cond_destroy(&proc->cond_FH); + pthread_cond_destroy(&proc->cond_FH1); pthread_cond_destroy(&proc->cond_asynch_rxtx); pthread_cond_destroy(&proc->cond_synch); pthread_cond_destroy(&proc->cond_eNBs); pthread_attr_destroy(&proc->attr_FH); + pthread_attr_destroy(&proc->attr_FH1); pthread_attr_destroy(&proc->attr_prach); pthread_attr_destroy(&proc->attr_synch); pthread_attr_destroy(&proc->attr_asynch_rxtx); -- GitLab