Commit ba6d47a7 authored by laurent's avatar laurent

rework threads in 5G

parent 4d787625
...@@ -117,8 +117,9 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) { ...@@ -117,8 +117,9 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
pool->allthreads->pool=pool; pool->allthreads->pool=pool;
//Configure the thread scheduler policy for Linux //Configure the thread scheduler policy for Linux
// set the thread name for debugging // set the thread name for debugging
sprintf(myThread->name,"Tpool_%d",myThread->coreID); sprintf(pool->allthreads->name,"Tpool_%d",pool->allthreads->coreID);
threadCreate(&pool->allthreads->threadID, one_thread, (void *)pool->allthreads, Tpool, myThread->name, myThread->coreID, OAI_PRIORITY_RT); threadCreate(&pool->allthreads->threadID, one_thread, (void *)pool->allthreads,
pool->allthreads->name, pool->allthreads->coreID, OAI_PRIORITY_RT);
pool->nbThreads++; pool->nbThreads++;
} }
......
...@@ -272,7 +272,6 @@ static void *gNB_L1_thread_tx(void *param) { ...@@ -272,7 +272,6 @@ static void *gNB_L1_thread_tx(void *param) {
//PHY_VARS_gNB *gNB = RC.gNB[0][proc->CC_id]; //PHY_VARS_gNB *gNB = RC.gNB[0][proc->CC_id];
char thread_name[100]; char thread_name[100];
sprintf(thread_name,"TXnp4_%d\n",&gNB->proc.L1_proc == proc ? 0 : 1); sprintf(thread_name,"TXnp4_%d\n",&gNB->proc.L1_proc == proc ? 0 : 1);
//thread_top_init(thread_name,1,470000,500000,500000);
//wait_sync("tx_thread"); //wait_sync("tx_thread");
...@@ -327,7 +326,6 @@ static void *gNB_L1_thread( void *param ) { ...@@ -327,7 +326,6 @@ static void *gNB_L1_thread( void *param ) {
// set default return value // set default return value
gNB_thread_rxtx_status = 0; gNB_thread_rxtx_status = 0;
sprintf(thread_name,"RXn_TXnp4_%d",&gNB->proc.L1_proc == proc ? 0 : 1); sprintf(thread_name,"RXn_TXnp4_%d",&gNB->proc.L1_proc == proc ? 0 : 1);
//thread_top_init(thread_name,1,850000L,1000000L,2000000L);
while (!oai_exit) { while (!oai_exit) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, 0 );
...@@ -651,7 +649,6 @@ static void* gNB_thread_prach( void* param ) { ...@@ -651,7 +649,6 @@ static void* gNB_thread_prach( void* param ) {
// set default return value // set default return value
gNB_thread_prach_status = 0; gNB_thread_prach_status = 0;
thread_top_init("gNB_thread_prach",1,500000L,1000000L,20000000L);
while (!oai_exit) { while (!oai_exit) {
......
...@@ -777,7 +777,6 @@ static void *ru_thread_asynch_rxtx( void *param ) { ...@@ -777,7 +777,6 @@ static void *ru_thread_asynch_rxtx( void *param ) {
RU_t *ru = (RU_t *)param; RU_t *ru = (RU_t *)param;
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
int subframe=0, frame=0; int subframe=0, frame=0;
thread_top_init("ru_thread_asynch_rxtx",1,870000L,1000000L,1000000L);
// wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe // wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe
wait_sync("ru_thread_asynch_rxtx"); wait_sync("ru_thread_asynch_rxtx");
// wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe // wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe
...@@ -825,7 +824,6 @@ static void *ru_thread_prach( void *param ) { ...@@ -825,7 +824,6 @@ static void *ru_thread_prach( void *param ) {
RU_proc_t *proc = (RU_proc_t *)&ru->proc; RU_proc_t *proc = (RU_proc_t *)&ru->proc;
// set default return value // set default return value
ru_thread_prach_status = 0; ru_thread_prach_status = 0;
thread_top_init("ru_thread_prach",1,500000L,1000000L,20000000L);
while (RC.ru_mask>0) { while (RC.ru_mask>0) {
usleep(1e6); usleep(1e6);
...@@ -1211,7 +1209,6 @@ static void *ru_thread_tx( void *param ) { ...@@ -1211,7 +1209,6 @@ static void *ru_thread_tx( void *param ) {
int i = 0; int i = 0;
cpu_set_t cpuset; cpu_set_t cpuset;
CPU_ZERO(&cpuset); CPU_ZERO(&cpuset);
thread_top_init("ru_thread_tx",1,400000,500000,500000);
//CPU_SET(5, &cpuset); //CPU_SET(5, &cpuset);
//pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); //pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
//wait_sync("ru_thread_tx"); //wait_sync("ru_thread_tx");
...@@ -1324,7 +1321,6 @@ static void *ru_thread( void *param ) { ...@@ -1324,7 +1321,6 @@ static void *ru_thread( void *param ) {
ru_thread_status = 0; ru_thread_status = 0;
// set default return value // set default return value
sprintf(threadname,"ru_thread %d",ru->idx); sprintf(threadname,"ru_thread %d",ru->idx);
thread_top_init(threadname,0,870000,1000000,1000000);
LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]); LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]);
if(emulate_rf) { if(emulate_rf) {
...@@ -1507,7 +1503,6 @@ void *ru_thread_synch(void *arg) { ...@@ -1507,7 +1503,6 @@ void *ru_thread_synch(void *arg) {
static int ru_thread_synch_status; static int ru_thread_synch_status;
thread_top_init("ru_thread_synch",0,5000000,10000000,10000000);
wait_sync("ru_thread_synch"); wait_sync("ru_thread_synch");
...@@ -1633,7 +1628,7 @@ void init_RU_proc(RU_t *ru) { ...@@ -1633,7 +1628,7 @@ void init_RU_proc(RU_t *ru) {
pthread_cond_init( &proc->cond_asynch_rxtx, NULL); pthread_cond_init( &proc->cond_asynch_rxtx, NULL);
pthread_cond_init( &proc->cond_synch,NULL); pthread_cond_init( &proc->cond_synch,NULL);
pthread_cond_init( &proc->cond_gNBs, NULL); pthread_cond_init( &proc->cond_gNBs, NULL);
threadCreate( &proc->pthread_FH, ru_thread, (void *)ru, "thread_FH", -1, OAI_PRIORITY_RT ); threadCreate( &proc->pthread_FH, ru_thread, (void *)ru, "thread_FH", -1, OAI_PRIORITY_RT_MAX );
if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT)
threadCreate( &proc->pthread_FH1, ru_thread_tx, (void *)ru, "thread_FH1", -1, OAI_PRIORITY_RT ); threadCreate( &proc->pthread_FH1, ru_thread_tx, (void *)ru, "thread_FH1", -1, OAI_PRIORITY_RT );
......
...@@ -1065,7 +1065,6 @@ int main( int argc, char **argv ) { ...@@ -1065,7 +1065,6 @@ int main( int argc, char **argv ) {
} // UE_id } // UE_id
threadCreate(&forms_thread, scope_thread, NULL, "scope", -1, OAI_PRIORITY_RT_LOW); threadCreate(&forms_thread, scope_thread, NULL, "scope", -1, OAI_PRIORITY_RT_LOW);
printf("Scope thread created, ret=%d\n",ret); printf("Scope thread created, ret=%d\n",ret);
} }
......
...@@ -760,7 +760,7 @@ void init_UE(int nb_inst) { ...@@ -760,7 +760,7 @@ void init_UE(int nb_inst) {
mac_inst->initial_bwp_ul.N_RB = UE->frame_parms.N_RB_UL; mac_inst->initial_bwp_ul.N_RB = UE->frame_parms.N_RB_UL;
mac_inst->initial_bwp_ul.cyclic_prefix = UE->frame_parms.Ncp; mac_inst->initial_bwp_ul.cyclic_prefix = UE->frame_parms.Ncp;
LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]); LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]);
threadCreate(&threads[inst], UE_thread, (void *)UE), "UEthread", -1, OAI_PRIORITY_RT); threadCreate(&threads[inst], UE_thread, (void *)UE, "UEthread", -1, OAI_PRIORITY_RT_MAX);
} }
printf("UE threads created by %ld\n", gettid()); printf("UE threads created by %ld\n", gettid());
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "assertions.h" #include "assertions.h"
#include "common/utils/system.h"
#include "msc.h" #include "msc.h"
#include <time.h> #include <time.h>
...@@ -483,7 +484,7 @@ void init_feptx_thread(RU_t *ru,pthread_attr_t *attr_feptx) { ...@@ -483,7 +484,7 @@ void init_feptx_thread(RU_t *ru,pthread_attr_t *attr_feptx) {
pthread_mutex_init( &proc->mutex_feptx, NULL); pthread_mutex_init( &proc->mutex_feptx, NULL);
pthread_cond_init( &proc->cond_feptx, NULL); pthread_cond_init( &proc->cond_feptx, NULL);
pthread_create(&proc->pthread_feptx, attr_feptx, feptx_thread, (void*)ru); threadCreate(&proc->pthread_feptx, feptx_thread, (void*)ru, "feptx", -1, OAI_PRIORITY_RT);
} }
...@@ -497,7 +498,7 @@ void init_fep_thread(RU_t *ru,pthread_attr_t *attr_fep) { ...@@ -497,7 +498,7 @@ void init_fep_thread(RU_t *ru,pthread_attr_t *attr_fep) {
pthread_mutex_init( &proc->mutex_fep, NULL); pthread_mutex_init( &proc->mutex_fep, NULL);
pthread_cond_init( &proc->cond_fep, NULL); pthread_cond_init( &proc->cond_fep, NULL);
pthread_create(&proc->pthread_fep, attr_fep, fep_thread, (void*)ru); threadCreate(&proc->pthread_fep, fep_thread, (void*)ru, "fep", -1, OAI_PRIORITY_RT);
} }
......
...@@ -180,7 +180,6 @@ static void *nr_feptx_thread(void *param) { ...@@ -180,7 +180,6 @@ static void *nr_feptx_thread(void *param) {
RU_t *ru = (RU_t *)param; RU_t *ru = (RU_t *)param;
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
thread_top_init("nr_feptx_thread",0,870000,1000000,1000000);
while (!oai_exit) { while (!oai_exit) {
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include "assertions.h" #include "assertions.h"
#include "common/utils/system.h"
#include "queue.h" #include "queue.h"
#include "intertask_interface.h" #include "intertask_interface.h"
......
...@@ -299,6 +299,7 @@ static int trx_usrp_start(openair0_device *device) { ...@@ -299,6 +299,7 @@ static int trx_usrp_start(openair0_device *device) {
if (u_sf_mode != 2) { // not replay mode if (u_sf_mode != 2) { // not replay mode
#endif #endif
uhd::set_thread_priority_safe(1.0);
usrp_state_t *s = (usrp_state_t *)device->priv; usrp_state_t *s = (usrp_state_t *)device->priv;
// setup GPIO for TDD, GPIO(4) = ATR_RX // setup GPIO for TDD, GPIO(4) = ATR_RX
//set data direction register (DDR) to output //set data direction register (DDR) to output
...@@ -1038,7 +1039,6 @@ extern "C" { ...@@ -1038,7 +1039,6 @@ extern "C" {
<< use_mmap << std::endl; << use_mmap << std::endl;
} else { } else {
#endif #endif
uhd::set_thread_priority_safe(1.0);
usrp_state_t *s = (usrp_state_t *)calloc(sizeof(usrp_state_t),1); usrp_state_t *s = (usrp_state_t *)calloc(sizeof(usrp_state_t),1);
if (openair0_cfg[0].clock_source==gpsdo) if (openair0_cfg[0].clock_source==gpsdo)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment