Commit d3b0b90f authored by Eurecom's avatar Eurecom Committed by mir

POLL and Sleep tunned

parent 68cd71b7
...@@ -198,7 +198,8 @@ void init_sq_task_manager(tpool_t *pool, int* lst, size_t num_threads) ...@@ -198,7 +198,8 @@ void init_sq_task_manager(tpool_t *pool, int* lst, size_t num_threads)
assert(it < 1024); assert(it < 1024);
bool performanceMeas = false; bool performanceMeas = false;
char name[] = "single_queue_thread_pool"; // Single Queue thread pool
char name[] = "sq_TPool-";
initNamedTpool(str, pool, performanceMeas, name); initNamedTpool(str, pool, performanceMeas, name);
} }
......
...@@ -356,20 +356,23 @@ bool pop_not_q(not_q_t* q, ret_try_t* out) ...@@ -356,20 +356,23 @@ bool pop_not_q(not_q_t* q, ret_try_t* out)
assert(rc == 0); assert(rc == 0);
assert(q->done == 0 || q->done ==1); assert(q->done == 0 || q->done ==1);
// printf("Sleeping idx %ld %ld \n", q->idx, time_now_us());
const struct timespec ns = {0,1024}; const struct timespec ns = {0,1};
int cnt = 0; int cnt = 0;
while(size_seq_ring_task(&q->r) == 0 && q->done == 0){ while(size_seq_ring_task(&q->r) == 0 && q->done == 0){
rc = pthread_mutex_unlock(&q->mtx); rc = pthread_mutex_unlock(&q->mtx);
assert(rc == 0); assert(rc == 0);
nanosleep(&ns, NULL); cnt++;
if(cnt % 64)
nanosleep(&ns, NULL);
int rc = pthread_mutex_lock(&q->mtx); int rc = pthread_mutex_lock(&q->mtx);
assert(rc == 0); assert(rc == 0);
if(cnt == 1024){ if(cnt == 4*1024){
cnt = 0; cnt = 0;
pthread_cond_wait(&q->cv , &q->mtx); pthread_cond_wait(&q->cv , &q->mtx);
} }
......
...@@ -336,9 +336,9 @@ void nr_feptx_tp(RU_t *ru, int frame_tx, int slot) { ...@@ -336,9 +336,9 @@ void nr_feptx_tp(RU_t *ru, int frame_tx, int slot) {
start_meas(&ru->ofdm_total_stats); start_meas(&ru->ofdm_total_stats);
size_t const sz = ru->nb_tx + (ru->half_slot_parallelization>0)*ru->nb_tx; size_t const sz = ru->nb_tx + (ru->half_slot_parallelization>0)*ru->nb_tx;
feptx_cmd_t arr[sz]; assert(sz < 64 && "Please, increase the buffer size");
task_ans_t ans[sz]; feptx_cmd_t arr[64] = {0};
memset(ans, 0, sz*sizeof(task_ans_t)); task_ans_t ans[64] = {0};
int nbfeptx = 0; int nbfeptx = 0;
for (int aid = 0; aid < ru->nb_tx; aid++) { for (int aid = 0; aid < ru->nb_tx; aid++) {
...@@ -414,9 +414,9 @@ void nr_fep_tp(RU_t *ru, int slot) { ...@@ -414,9 +414,9 @@ void nr_fep_tp(RU_t *ru, int slot) {
start_meas(&ru->ofdm_demod_stats); start_meas(&ru->ofdm_demod_stats);
size_t const sz = ru->nb_rx + (ru->half_slot_parallelization>0)*ru->nb_rx; size_t const sz = ru->nb_rx + (ru->half_slot_parallelization>0)*ru->nb_rx;
feprx_cmd_t arr[sz]; assert(sz < 64 && "Please, increase buffer size");
task_ans_t ans[sz]; feprx_cmd_t arr[64] = {0};
memset(&ans, 0, sz * sizeof(task_ans_t)); task_ans_t ans[64] = {0};
for (int aid=0;aid<ru->nb_rx;aid++) { for (int aid=0;aid<ru->nb_rx;aid++) {
feprx_cmd_t* feprx_cmd= &arr[nbfeprx]; feprx_cmd_t* feprx_cmd= &arr[nbfeprx];
......
...@@ -554,8 +554,12 @@ int main(int argc, char *argv[]) ...@@ -554,8 +554,12 @@ int main(int argc, char *argv[])
gNB->ofdm_offset_divisor = UINT_MAX; gNB->ofdm_offset_divisor = UINT_MAX;
gNB->num_pusch_symbols_per_thread = 1; gNB->num_pusch_symbols_per_thread = 1;
int lst_core_id[32] = {-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1}; const int max_cid = 32;
assert(threadCnt < 33); int lst_core_id[max_cid];
for(int i = 0; i < max_cid; ++i){
lst_core_id[i] = -1;
}
assert(threadCnt < max_cid);
init_task_manager(&gNB->man, lst_core_id, max(threadCnt, 1)); init_task_manager(&gNB->man, lst_core_id, max(threadCnt, 1));
initNotifiedFIFO(&gNB->respDecode); initNotifiedFIFO(&gNB->respDecode);
......
...@@ -326,14 +326,6 @@ static int nr_process_mac_pdu(instance_t module_idP, ...@@ -326,14 +326,6 @@ static int nr_process_mac_pdu(instance_t module_idP,
} }
} }
// Spin if not ready. This is a bad bad bad solution even in x86
const struct timespec ns = {0, 1024};
int cnt = 0;
while(UE_idx->CellGroup == NULL && cnt < 64){
nanosleep(&ns, NULL);
cnt++;
}
if (UE_idx->CellGroup) { if (UE_idx->CellGroup) {
LOG_D(NR_MAC, "Frame %d : ULSCH -> UL-DCCH %d (gNB %ld, %d bytes), rnti: 0x%04x \n", frameP, rx_lcid, module_idP, mac_len, crnti); LOG_D(NR_MAC, "Frame %d : ULSCH -> UL-DCCH %d (gNB %ld, %d bytes), rnti: 0x%04x \n", frameP, rx_lcid, module_idP, mac_len, crnti);
UE->mac_stats.ul.total_sdu_bytes += mac_len; UE->mac_stats.ul.total_sdu_bytes += mac_len;
......
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