diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c index 9b5a898aac87ef678f8dd464d9558d50b56ea2b3..e407f2c4bfdc3a6d111dc126d28e69e37d699c36 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c @@ -354,9 +354,15 @@ int dlsch_encoding_2threads0(te_params *tep) { extern int oai_exit; void *te_thread(void *param) { + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + pthread_setname_np( pthread_self(),"te processing"); LOG_I(PHY,"thread te created id=%ld", syscall(__NR_gettid)); + CPU_SET(4, &cpuset); + pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + eNB_proc_t *proc = &((te_params *)param)->eNB->proc; while (!oai_exit) { diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c index e927fcdbc2046fd6badf8d3a730c58775207ca28..f60f066ef56e4a37cbef40976c73b1f735f691c5 100644 --- a/openair1/SCHED/ru_procedures.c +++ b/openair1/SCHED/ru_procedures.c @@ -140,6 +140,12 @@ static void *feptx_thread(void *param) { RU_t *ru = (RU_t *)param; RU_proc_t *proc = &ru->proc; + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + + CPU_SET(6, &cpuset); + pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + thread_top_init("feptx_thread",0,870000,1000000,1000000); @@ -418,6 +424,11 @@ static void *fep_thread(void *param) { thread_top_init("fep_thread",0,870000,1000000,1000000); + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + CPU_SET(2, &cpuset); + pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + while (!oai_exit) { if (wait_on_condition(&proc->mutex_fep,&proc->cond_fep,&proc->instance_cnt_fep,"fep thread")<0) break; diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.c b/openair2/UTIL/LOG/vcd_signal_dumper.c index 665e5b4384b30364e8df83f40e875e0bc874b2ab..dfd48c77f7c623e49faaa3503f72c9771a4a1e44 100644 --- a/openair2/UTIL/LOG/vcd_signal_dumper.c +++ b/openair2/UTIL/LOG/vcd_signal_dumper.c @@ -195,6 +195,9 @@ const char* eurecomVariablesNames[] = { "ue0_trx_write_ns", "ue0_trx_read_ns_missing", "ue0_trx_write_ns_missing", + "enb_thread_rxtx_CPUID", + "ru_thread_CPUID", + "ru_thread_tx_CPUID" }; const char* eurecomFunctionsNames[] = { diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.h b/openair2/UTIL/LOG/vcd_signal_dumper.h index d777236b34d6585fbb9f40ef6d60206f5df5e478..e13ee7cfdc9d12faf37cdcba2812a72464f994a0 100644 --- a/openair2/UTIL/LOG/vcd_signal_dumper.h +++ b/openair2/UTIL/LOG/vcd_signal_dumper.h @@ -167,6 +167,9 @@ typedef enum { VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS, VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS_MISSING, VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS_MISSING, + VCD_SIGNAL_DUMPER_VARIABLES_CPUID_ENB_THREAD_RXTX, + VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD, + VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD_TX, VCD_SIGNAL_DUMPER_VARIABLES_END } vcd_signal_dump_variables; diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index 4a35a817fbf3bcefb07f33526766d9c020c529a6..90a096285e65fd2cfc425650af885152ae079a3f 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -219,6 +219,8 @@ static void* eNB_thread_rxtx( void* param ) { char thread_name[100]; + cpu_set_t cpuset; + CPU_ZERO(&cpuset); // set default return value eNB_thread_rxtx_status = 0; @@ -227,11 +229,15 @@ static void* eNB_thread_rxtx( void* param ) { sprintf(thread_name,"RXn_TXnp4_%d\n",&eNB->proc.proc_rxtx[0] == proc ? 0 : 1); thread_top_init(thread_name,1,850000L,1000000L,2000000L); + CPU_SET(3, &cpuset); + pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + while (!oai_exit) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 ); if (wait_on_condition(&proc->mutex_rxtx,&proc->cond_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break; + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_ENB_THREAD_RXTX,sched_getcpu()); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 1 ); //ru_proc = eNB_proc->ru_proc; @@ -356,12 +362,9 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) { wait.tv_nsec=5000000L; /* accept some delay in processing - up to 5ms */ - for (i = 0; i < 10 && proc_rxtx->instance_cnt_rxtx == 0; i++) { - LOG_W( PHY,"[eNB] Frame %d, eNB RXn-TXnp4 thread busy!! (cnt_rxtx %i)\n", proc_rxtx->frame_tx, proc_rxtx->instance_cnt_rxtx); - usleep(500); - } + if (proc_rxtx->instance_cnt_rxtx == 0) { - exit_fun( "TX thread busy" ); + LOG_E(PHY,"Frame %d, subframe %d: RXTX thread busy, dropping",proc_rxtx->frame_rx,proc_rxtx->subframe_rx); return(-1); } diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 1dc3a8780ce64fcb986fe85f11cee6a380091fb0..a106012815f4e3fefd873df7220bd93e2588612d 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -1126,12 +1126,12 @@ void wakeup_eNBs(RU_t *ru) { ru->eNB_top(eNB_list[0],ru->proc.frame_rx,ru->proc.subframe_rx,string,ru); } else { - + for (i=0;i<ru->num_eNB;i++) - { - if (ru->wakeup_rxtx(eNB_list[i],ru) < 0) - LOG_E(PHY,"could not wakeup eNB rxtx process for subframe %d\n", ru->proc.subframe_rx); - } + { + if (ru->wakeup_rxtx(eNB_list[i],ru) < 0) + LOG_E(PHY,"could not wakeup eNB rxtx process for subframe %d\n", ru->proc.subframe_rx); + } } } @@ -1367,14 +1367,21 @@ static void* ru_thread_tx( void* param ) { RU_t *ru = (RU_t*)param; RU_proc_t *proc = &ru->proc; int subframe=0, frame=0; + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + thread_top_init("ru_thread_tx",1,870000L,1000000L,1000000L); + CPU_SET(5, &cpuset); + pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + wait_on_condition(&proc->mutex_FH1,&proc->cond_FH1,&proc->instance_cnt_FH1,"ru_thread_tx"); printf( "ru_thread_tx ready\n"); while (!oai_exit) { - + + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD_TX,sched_getcpu()); if (oai_exit) break; if (subframe==9) { @@ -1416,6 +1423,9 @@ static void* ru_thread( void* param ) { int ret; int subframe =9; int frame =1023; + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + // set default return value ru_thread_status = 0; @@ -1424,6 +1434,9 @@ static void* ru_thread( void* param ) { // set default return value thread_top_init("ru_thread",0,870000,1000000,1000000); + CPU_SET(1, &cpuset); + pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx,eNB_functions[ru->function],eNB_timing[ru->if_timing]); @@ -1491,6 +1504,8 @@ static void* ru_thread( void* param ) { // This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices while (!oai_exit) { + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD,sched_getcpu()); + // these are local subframe/frame counters to check that we are in synch with the fronthaul timing. // They are set on the first rx/tx in the underly FH routines. if (subframe==9) { @@ -1537,6 +1552,7 @@ static void* ru_thread( void* param ) { // wakeup all eNB processes waiting for this RU if (ru->num_eNB>0) wakeup_eNBs(ru); + /* if(fh_two_thread == 0) { // wait until eNBs are finished subframe RX n and TX n+4 @@ -1553,7 +1569,7 @@ static void* ru_thread( void* param ) { if (ru->fh_north_out) ru->fh_north_out(ru); } - + */ } diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index e21fd12428560c6ff8d603930abe1e2f0b116929..b126e70a2561eae487af28ef314d1a046957c427 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -206,7 +206,7 @@ extern void reset_opp_meas(void); extern void print_opp_meas(void); int transmission_mode=1; -int numerology = 0; +int numerology = 1; int fh_two_thread = 1;