Remove set_latency_target(), add lock_memory_to_ram()
set_latency_target() attempts to set keep "low latency" by - writing a specific latency to /dev/cpu_dma_latency - setting manually the minimum CPU processor frequency to be the maximum There is no functionality to undo this after stopping the softmodem(s), and most users are probably not even aware that OAI does this. It is generally preferable to set this beforehand using a governor or by disabling sleep states (as outlined in the tutorial, and in a follow-up commit in the performance tuning docs). The previous mlockall() call, to lock memory to RAM, is retained in a new function. There were additional mlockall() calls, which have been replaced with lock_memory_to_ram(), where necessary.
This commit is contained in:
+6
-33
@@ -326,37 +326,10 @@ void thread_top_init(char *thread_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* \brief lock memory to RAM to avoid delays */
|
||||||
// Block CPU C-states deep sleep
|
void lock_memory_to_ram(void)
|
||||||
void set_latency_target(void) {
|
{
|
||||||
int ret;
|
int rc = mlockall(MCL_CURRENT | MCL_FUTURE);
|
||||||
static int latency_target_fd=-1;
|
if (rc != 0)
|
||||||
uint32_t latency_target_value=2; // in microseconds
|
LOG_W(UTIL, "mlockall() failed: %d, %s\n", errno, strerror(errno));
|
||||||
if (latency_target_fd == -1) {
|
|
||||||
if ( (latency_target_fd = open("/dev/cpu_dma_latency", O_RDWR)) != -1 ) {
|
|
||||||
ret = write(latency_target_fd, &latency_target_value, sizeof(latency_target_value));
|
|
||||||
if (ret == 0) {
|
|
||||||
printf("# error setting cpu_dma_latency to %u!: %s\n", latency_target_value, strerror(errno));
|
|
||||||
close(latency_target_fd);
|
|
||||||
latency_target_fd=-1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (latency_target_fd != -1)
|
|
||||||
LOG_I(HW,"# /dev/cpu_dma_latency set to %u us\n", latency_target_value);
|
|
||||||
else
|
|
||||||
LOG_E(HW,"Can't set /dev/cpu_dma_latency to %u us\n", latency_target_value);
|
|
||||||
|
|
||||||
// Set CPU frequency to it's maximum
|
|
||||||
int system_ret = system("for d in /sys/devices/system/cpu/cpu[0-9]*; do cat $d/cpufreq/cpuinfo_max_freq > $d/cpufreq/scaling_min_freq; done");
|
|
||||||
if (system_ret == -1) {
|
|
||||||
LOG_E(HW, "Can't set cpu frequency: [%d] %s\n", errno, strerror(errno));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!((WIFEXITED(system_ret)) && (WEXITSTATUS(system_ret) == 0))) {
|
|
||||||
LOG_E(HW, "Can't set cpu frequency\n");
|
|
||||||
}
|
|
||||||
mlockall(MCL_CURRENT | MCL_FUTURE);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ int background_system(char *command);
|
|||||||
|
|
||||||
void start_background_system(void);
|
void start_background_system(void);
|
||||||
|
|
||||||
void set_latency_target(void);
|
void lock_memory_to_ram(void);
|
||||||
|
|
||||||
void threadCreate(pthread_t *t, void *(*func)(void *), void *param, char *name, int affinity, int priority);
|
void threadCreate(pthread_t *t, void *(*func)(void *), void *param, char *name, int affinity, int priority);
|
||||||
|
|
||||||
|
|||||||
@@ -448,7 +448,7 @@ int main ( int argc, char **argv )
|
|||||||
|
|
||||||
mode = normal_txrx;
|
mode = normal_txrx;
|
||||||
logInit();
|
logInit();
|
||||||
set_latency_target();
|
lock_memory_to_ram();
|
||||||
printf("Reading in command-line options\n");
|
printf("Reading in command-line options\n");
|
||||||
get_options(uniqCfg);
|
get_options(uniqCfg);
|
||||||
|
|
||||||
@@ -518,7 +518,6 @@ int main ( int argc, char **argv )
|
|||||||
// init UE_PF_PO and mutex lock
|
// init UE_PF_PO and mutex lock
|
||||||
pthread_mutex_init(&ue_pf_po_mutex, NULL);
|
pthread_mutex_init(&ue_pf_po_mutex, NULL);
|
||||||
memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*MAX_MOBILES_PER_ENB*MAX_NUM_CCs);
|
memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*MAX_MOBILES_PER_ENB*MAX_NUM_CCs);
|
||||||
mlockall(MCL_CURRENT | MCL_FUTURE);
|
|
||||||
pthread_cond_init(&sync_cond,NULL);
|
pthread_cond_init(&sync_cond,NULL);
|
||||||
pthread_mutex_init(&sync_mutex, NULL);
|
pthread_mutex_init(&sync_mutex, NULL);
|
||||||
|
|
||||||
|
|||||||
@@ -530,7 +530,7 @@ int main( int argc, char **argv ) {
|
|||||||
mode = normal_txrx;
|
mode = normal_txrx;
|
||||||
memset(&openair0_cfg[0],0,sizeof(openair0_config_t)*MAX_CARDS);
|
memset(&openair0_cfg[0],0,sizeof(openair0_config_t)*MAX_CARDS);
|
||||||
logInit();
|
logInit();
|
||||||
set_latency_target();
|
lock_memory_to_ram();
|
||||||
printf("Reading in command-line options\n");
|
printf("Reading in command-line options\n");
|
||||||
|
|
||||||
for (int i=0; i<MAX_NUM_CCs; i++) tx_max_power[i]=23;
|
for (int i=0; i<MAX_NUM_CCs; i++) tx_max_power[i]=23;
|
||||||
@@ -617,7 +617,6 @@ int main( int argc, char **argv ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf("ITTI tasks created\n");
|
printf("ITTI tasks created\n");
|
||||||
mlockall(MCL_CURRENT | MCL_FUTURE);
|
|
||||||
rt_sleep_ns(10*100000000ULL);
|
rt_sleep_ns(10*100000000ULL);
|
||||||
int eMBMS_active = 0;
|
int eMBMS_active = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -169,7 +169,8 @@ int main ( int argc, char **argv )
|
|||||||
/* Read configuration */
|
/* Read configuration */
|
||||||
|
|
||||||
printf("About to Init RU threads\n");
|
printf("About to Init RU threads\n");
|
||||||
|
|
||||||
|
lock_memory_to_ram();
|
||||||
|
|
||||||
RU_t *ru=&ru_m;
|
RU_t *ru=&ru_m;
|
||||||
|
|
||||||
@@ -330,7 +331,6 @@ int main ( int argc, char **argv )
|
|||||||
|
|
||||||
set_worker_conf("WORKER_ENABLE");
|
set_worker_conf("WORKER_ENABLE");
|
||||||
|
|
||||||
mlockall(MCL_CURRENT | MCL_FUTURE);
|
|
||||||
pthread_cond_init(&sync_cond,NULL);
|
pthread_cond_init(&sync_cond,NULL);
|
||||||
pthread_mutex_init(&sync_mutex, NULL);
|
pthread_mutex_init(&sync_mutex, NULL);
|
||||||
|
|
||||||
|
|||||||
@@ -622,7 +622,7 @@ int main( int argc, char **argv ) {
|
|||||||
mode = normal_txrx;
|
mode = normal_txrx;
|
||||||
memset(tx_max_power,0,sizeof(int)*MAX_NUM_CCs);
|
memset(tx_max_power,0,sizeof(int)*MAX_NUM_CCs);
|
||||||
logInit();
|
logInit();
|
||||||
set_latency_target();
|
lock_memory_to_ram();
|
||||||
printf("Reading in command-line options\n");
|
printf("Reading in command-line options\n");
|
||||||
get_options(uniqCfg);
|
get_options(uniqCfg);
|
||||||
|
|
||||||
@@ -677,7 +677,6 @@ int main( int argc, char **argv ) {
|
|||||||
AssertFatal(ret == 0, "cannot create ITTI tasks\n");
|
AssertFatal(ret == 0, "cannot create ITTI tasks\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
mlockall(MCL_CURRENT | MCL_FUTURE);
|
|
||||||
pthread_cond_init(&sync_cond,NULL);
|
pthread_cond_init(&sync_cond,NULL);
|
||||||
pthread_mutex_init(&sync_mutex, NULL);
|
pthread_mutex_init(&sync_mutex, NULL);
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
|
|||||||
@@ -563,7 +563,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
init_openair0();
|
init_openair0();
|
||||||
set_latency_target();
|
lock_memory_to_ram();
|
||||||
|
|
||||||
if(IS_SOFTMODEM_DOSCOPE_QT) {
|
if(IS_SOFTMODEM_DOSCOPE_QT) {
|
||||||
load_softscope("nrqt",PHY_vars_UE_g[0][0]);
|
load_softscope("nrqt",PHY_vars_UE_g[0][0]);
|
||||||
|
|||||||
@@ -45,8 +45,7 @@ int main(int argc, char **argv) {
|
|||||||
get_common_options(uniqCfg, SOFTMODEM_GNB_BIT);
|
get_common_options(uniqCfg, SOFTMODEM_GNB_BIT);
|
||||||
config_process_cmdline(uniqCfg, cmdline_params, sizeofArray(cmdline_params), NULL);
|
config_process_cmdline(uniqCfg, cmdline_params, sizeofArray(cmdline_params), NULL);
|
||||||
CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
|
CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
|
||||||
set_latency_target();
|
lock_memory_to_ram();
|
||||||
|
|
||||||
|
|
||||||
int N_RB=50;
|
int N_RB=50;
|
||||||
int sampling_rate=30.72e6;
|
int sampling_rate=30.72e6;
|
||||||
|
|||||||
Reference in New Issue
Block a user