Commit d449a4de authored by Michael Cook's avatar Michael Cook

Align thread priorities

```
$ ps -eL -o pid,lwp,class,priority,comm | grep -E softmodem|oai:'
 6500  6500 RR  -80 lte-softmodem
 6500  6520 RR  -80 oai:enb-L1-rx
 6500  6522 RR  -80 oai:enb-L1-tx
 6508  6508 RR  -80 lte-uesoftmodem
 6508  6537 RR  -80 oai:ue-phy
 6508  6538 RR  -80 oai:ue-stand
 6509  6509 RR  -80 lte-uesoftmodem
$
```
parent d61bb983
...@@ -397,8 +397,20 @@ static void *L1_thread( void *param ) { ...@@ -397,8 +397,20 @@ static void *L1_thread( void *param ) {
// set default return value // set default return value
eNB_thread_rxtx_status = 0; eNB_thread_rxtx_status = 0;
sprintf(thread_name,"RXn_TXnp4_%d\n",&eNB->proc.L1_proc == proc ? 0 : 1); sprintf(thread_name,"RXn_TXnp4_%d\n",&eNB->proc.L1_proc == proc ? 0 : 1);
#if 1
{
struct sched_param sparam =
{
.sched_priority = 79,
};
if (pthread_setschedparam(pthread_self(), SCHED_RR, &sparam) != 0)
{
LOG_E(PHY,"pthread_setschedparam: %s\n", strerror(errno));
}
}
#else
thread_top_init(thread_name,1,470000,500000,500000); thread_top_init(thread_name,1,470000,500000,500000);
pthread_setname_np( pthread_self(),"rxtx processing"); #endif
LOG_I(PHY,"thread rxtx created id=%ld\n", syscall(__NR_gettid)); LOG_I(PHY,"thread rxtx created id=%ld\n", syscall(__NR_gettid));
while (!oai_exit) { while (!oai_exit) {
...@@ -919,8 +931,18 @@ void init_eNB_proc(int inst) { ...@@ -919,8 +931,18 @@ void init_eNB_proc(int inst) {
// Original Code from Fujitsu w/ old structure/field name // Original Code from Fujitsu w/ old structure/field name
//pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] ); //pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] );
//pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] ); //pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] );
pthread_create( &L1_proc->pthread, attr0, L1_thread, L1_proc ); pthread_create( &L1_proc->pthread, attr0, L1_thread, L1_proc );
if (pthread_setname_np(L1_proc->pthread, "oai:enb-L1-rx") != 0)
{
LOG_E(PHY, "pthread_setname_np: %s\n", strerror(errno));
}
pthread_create( &L1_proc_tx->pthread, attr1, L1_thread, L1_proc_tx); pthread_create( &L1_proc_tx->pthread, attr1, L1_thread, L1_proc_tx);
if (pthread_setname_np(L1_proc_tx->pthread, "oai:enb-L1-tx") != 0)
{
LOG_E(PHY, "pthread_setname_np: %s\n", strerror(errno));
}
} }
if (NFAPI_MODE!=NFAPI_MODE_VNF) { if (NFAPI_MODE!=NFAPI_MODE_VNF) {
...@@ -930,7 +952,10 @@ void init_eNB_proc(int inst) { ...@@ -930,7 +952,10 @@ void init_eNB_proc(int inst) {
AssertFatal(proc->instance_cnt_prach == -1,"instance_cnt_prach = %d\n",proc->instance_cnt_prach); AssertFatal(proc->instance_cnt_prach == -1,"instance_cnt_prach = %d\n",proc->instance_cnt_prach);
if (opp_enabled == 1) pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void *)eNB); if (opp_enabled == 1)
{
pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void *)eNB);
}
} }
//for multiple CCs: setup master and slaves //for multiple CCs: setup master and slaves
......
...@@ -516,15 +516,12 @@ int main ( int argc, char **argv ) ...@@ -516,15 +516,12 @@ int main ( int argc, char **argv )
{ {
struct sched_param param = struct sched_param param =
{ {
.sched_priority = 1 .sched_priority = 79
}; };
if (sched_setscheduler( 0, SCHED_RR, &param ) == -1 ) if (sched_setscheduler( 0, SCHED_RR, &param ) == -1 )
{ {
fprintf(stderr,"error setting scheduler ... are you root?\n"); fprintf(stderr,"error setting scheduler ... are you root?\n");
} return EXIT_FAILURE;
else
{
fprintf(stderr,"selected rt scheduler\n");
} }
int i; int i;
......
...@@ -437,6 +437,7 @@ void init_UE_standalone_thread() ...@@ -437,6 +437,7 @@ void init_UE_standalone_thread()
if (pthread_create(&thread, NULL, ue_standalone_pnf_task, NULL) != 0) { if (pthread_create(&thread, NULL, ue_standalone_pnf_task, NULL) != 0) {
LOG_E(MAC, "pthread_create failed for calling ue_standalone_pnf_task"); LOG_E(MAC, "pthread_create failed for calling ue_standalone_pnf_task");
} }
pthread_setname_np(thread, "oai:ue-stand");
} }
void init_UE_stub(int nb_inst, void init_UE_stub(int nb_inst,
...@@ -1001,7 +1002,21 @@ static void reset_queue(queue_t *q) ...@@ -1001,7 +1002,21 @@ static void reset_queue(queue_t *q)
static void *UE_phy_stub_standalone_pnf_task(void *arg) static void *UE_phy_stub_standalone_pnf_task(void *arg)
{ {
#if 1
{
struct sched_param sparam =
{
.sched_priority = 79,
};
if (pthread_setschedparam(pthread_self(), SCHED_RR, &sparam) != 0)
{
LOG_E(PHY,"pthread_setschedparam: %s\n", strerror(errno));
}
}
#else
thread_top_init("UE_phy_stub_thread_rxn_txnp4", 1, 870000L, 1000000L, 1000000L); thread_top_init("UE_phy_stub_thread_rxn_txnp4", 1, 870000L, 1000000L, 1000000L);
#endif
// for multipule UE's L2-emulator // for multipule UE's L2-emulator
//module_id_t Mod_id = 0; //module_id_t Mod_id = 0;
//int init_ra_UE = -1; // This counter is used to initiate the RA of each UE in different SFrames //int init_ra_UE = -1; // This counter is used to initiate the RA of each UE in different SFrames
...@@ -2467,6 +2482,7 @@ void init_UE_single_thread_stub(int nb_inst) ...@@ -2467,6 +2482,7 @@ void init_UE_single_thread_stub(int nb_inst)
UE->proc.proc_rxtx[i].sub_frame_step=nb_threads; UE->proc.proc_rxtx[i].sub_frame_step=nb_threads;
printf("Init_UE_threads rtd %d proc %d nb_threads %d i %d\n",rtd->proc->sub_frame_start, UE->proc.proc_rxtx[i].sub_frame_start,nb_threads, i); printf("Init_UE_threads rtd %d proc %d nb_threads %d i %d\n",rtd->proc->sub_frame_start, UE->proc.proc_rxtx[i].sub_frame_start,nb_threads, i);
pthread_create(&UE->proc.proc_rxtx[i].pthread_rxtx, NULL, task_func, rtd); pthread_create(&UE->proc.proc_rxtx[i].pthread_rxtx, NULL, task_func, rtd);
pthread_setname_np(UE->proc.proc_rxtx[i].pthread_rxtx, "oai:ue-phy");
} }
} }
......
...@@ -545,15 +545,12 @@ void init_pdcp(void) { ...@@ -545,15 +545,12 @@ void init_pdcp(void) {
int main( int argc, char **argv ) { int main( int argc, char **argv ) {
struct sched_param param = struct sched_param param =
{ {
.sched_priority = 1 .sched_priority = 79
}; };
if (sched_setscheduler( 0, SCHED_RR, &param ) == -1 ) if (sched_setscheduler( 0, SCHED_RR, &param ) == -1 )
{ {
fprintf(stderr,"error setting scheduler ... are you root?\n"); fprintf(stderr,"error setting scheduler ... are you root?\n");
} return EXIT_FAILURE;
else
{
fprintf(stderr,"selected rt scheduler\n");
} }
int CC_id; int CC_id;
......
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