LOWLATENCY fix2
This commit is contained in:
@@ -8,14 +8,14 @@ include $(OPENAIR_TARGETS)/Makefile.common
|
|||||||
|
|
||||||
KERNEL_VERSION:=$(shell echo `uname -r | cut -d. -f-2`)
|
KERNEL_VERSION:=$(shell echo `uname -r | cut -d. -f-2`)
|
||||||
KERNEL_TYPE:=$(shell echo `uname -r | cut -d. -f-3 | cut -d- -f3`)
|
KERNEL_TYPE:=$(shell echo `uname -r | cut -d. -f-3 | cut -d- -f3`)
|
||||||
LOWLATENCY_KERNEL:=$(shell if [ $(KERNEL_TYPE) = "lowlatency" ]; then echo "1" ; else echo "0" ; fi)
|
DEADLINE_SCHEDULER_KERNEL:=$(shell if [ $(KERNEL_TYPE) = "lowlatency" ]; then echo "1" ; else echo "0" ; fi)
|
||||||
|
|
||||||
include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
|
include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
|
||||||
|
|
||||||
ifdef EXMIMO
|
ifdef EXMIMO
|
||||||
#ifdef LOWLATENCY # this ifdef is to be removed after the debugging
|
#ifdef DEADLINE_SCHEDULER # this ifdef is to be removed after the debugging
|
||||||
ifeq ($(LOWLATENCY_KERNEL),1)
|
ifeq ($(DEADLINE_SCHEDULER_KERNEL),1)
|
||||||
CFLAGS+=-DLOWLATENCY
|
CFLAGS+=-DDEADLINE_SCHEDULER
|
||||||
endif
|
endif
|
||||||
#endif
|
#endif
|
||||||
endif
|
endif
|
||||||
@@ -431,7 +431,7 @@ show:
|
|||||||
@echo IS_REL10 is $(IS_REL10)
|
@echo IS_REL10 is $(IS_REL10)
|
||||||
@echo openssl $(OPENSSL_FOUND)
|
@echo openssl $(OPENSSL_FOUND)
|
||||||
@echo nettle $(NETTLE_FOUND)
|
@echo nettle $(NETTLE_FOUND)
|
||||||
@echo lowlatency kernel: $(LOWLATENCY_KERNEL)
|
@echo lowlatency kernel: $(DEADLINE_SCHEDULER_KERNEL)
|
||||||
|
|
||||||
beautiful:
|
beautiful:
|
||||||
astyle --style=gnu -s2 $(SRC)
|
astyle --style=gnu -s2 $(SRC)
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ void *rrh_eNB_thread(void *arg) {
|
|||||||
pthread_mutex_init(&sync_trx_mutex,NULL);
|
pthread_mutex_init(&sync_trx_mutex,NULL);
|
||||||
|
|
||||||
/* create eNB module's TX/RX threads */
|
/* create eNB module's TX/RX threads */
|
||||||
#ifdef LOWLATENCY
|
#ifdef DEADLINE_SCHEDULER
|
||||||
error_code_eNB_rx = pthread_create(&eNB_rx_thread, NULL, rrh_eNB_rx_thread, (void *)dev);
|
error_code_eNB_rx = pthread_create(&eNB_rx_thread, NULL, rrh_eNB_rx_thread, (void *)dev);
|
||||||
error_code_eNB_tx = pthread_create(&eNB_tx_thread, NULL, rrh_eNB_tx_thread, (void *)dev);
|
error_code_eNB_tx = pthread_create(&eNB_tx_thread, NULL, rrh_eNB_tx_thread, (void *)dev);
|
||||||
LOG_I(RRH,"[eNB][SCHED] deadline scheduling applied to eNB TX/RX threads\n");
|
LOG_I(RRH,"[eNB][SCHED] deadline scheduling applied to eNB TX/RX threads\n");
|
||||||
@@ -302,7 +302,7 @@ void *rrh_eNB_thread(void *arg) {
|
|||||||
timerspec.it_interval.tv_nsec = rt_period%1000000000;
|
timerspec.it_interval.tv_nsec = rt_period%1000000000;
|
||||||
|
|
||||||
|
|
||||||
#ifdef LOWLATENCY
|
#ifdef DEADLINE_SCHEDULER
|
||||||
error_code_timer = pthread_create(&main_timer_proc_thread, NULL, timer_proc, (void *)&timerspec);
|
error_code_timer = pthread_create(&main_timer_proc_thread, NULL, timer_proc, (void *)&timerspec);
|
||||||
LOG_I(RRH,"[eNB][SCHED] deadline scheduling applied to timer thread \n");
|
LOG_I(RRH,"[eNB][SCHED] deadline scheduling applied to timer thread \n");
|
||||||
#else
|
#else
|
||||||
@@ -368,7 +368,7 @@ void *rrh_eNB_rx_thread(void *arg) {
|
|||||||
measurements = dev->measurements;
|
measurements = dev->measurements;
|
||||||
next_rx_pos = spp_eth;
|
next_rx_pos = spp_eth;
|
||||||
|
|
||||||
#ifdef LOWLATENCY
|
#ifdef DEADLINE_SCHEDULER
|
||||||
struct sched_attr attr;
|
struct sched_attr attr;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
|
|
||||||
@@ -560,7 +560,7 @@ void *rrh_eNB_tx_thread(void *arg) {
|
|||||||
unsigned int subframe=0,frame=0;
|
unsigned int subframe=0,frame=0;
|
||||||
unsigned int pck_tx=0;
|
unsigned int pck_tx=0;
|
||||||
|
|
||||||
#ifdef LOWLATENCY
|
#ifdef DEADLINE_SCHEDULER
|
||||||
struct sched_attr attr;
|
struct sched_attr attr;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ pthread_t main_ue_thread;
|
|||||||
pthread_attr_t attr_dlsch_threads;
|
pthread_attr_t attr_dlsch_threads;
|
||||||
pthread_attr_t attr_UE_thread;
|
pthread_attr_t attr_UE_thread;
|
||||||
|
|
||||||
#ifndef LOWLATENCY
|
#ifndef DEADLINE_SCHEDULER
|
||||||
struct sched_param sched_param_dlsch;
|
struct sched_param sched_param_dlsch;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -192,7 +192,7 @@ struct sched_param sched_param_UE_thread;
|
|||||||
|
|
||||||
pthread_attr_t attr_eNB_proc_tx[MAX_NUM_CCs][NUM_ENB_THREADS];
|
pthread_attr_t attr_eNB_proc_tx[MAX_NUM_CCs][NUM_ENB_THREADS];
|
||||||
pthread_attr_t attr_eNB_proc_rx[MAX_NUM_CCs][NUM_ENB_THREADS];
|
pthread_attr_t attr_eNB_proc_rx[MAX_NUM_CCs][NUM_ENB_THREADS];
|
||||||
#ifndef LOWLATENCY
|
#ifndef DEADLINE_SCHEDULER
|
||||||
struct sched_param sched_param_eNB_proc_tx[MAX_NUM_CCs][NUM_ENB_THREADS];
|
struct sched_param sched_param_eNB_proc_tx[MAX_NUM_CCs][NUM_ENB_THREADS];
|
||||||
struct sched_param sched_param_eNB_proc_rx[MAX_NUM_CCs][NUM_ENB_THREADS];
|
struct sched_param sched_param_eNB_proc_rx[MAX_NUM_CCs][NUM_ENB_THREADS];
|
||||||
#endif
|
#endif
|
||||||
@@ -1087,7 +1087,7 @@ static void* eNB_thread_tx( void* param )
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#ifdef LOWLATENCY
|
#ifdef DEADLINE_SCHEDULER
|
||||||
struct sched_attr attr;
|
struct sched_attr attr;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
uint64_t runtime = 850000 ;
|
uint64_t runtime = 850000 ;
|
||||||
@@ -1295,7 +1295,7 @@ static void* eNB_thread_tx( void* param )
|
|||||||
if (proc->frame_tx==1024)
|
if (proc->frame_tx==1024)
|
||||||
proc->frame_tx=0;
|
proc->frame_tx=0;
|
||||||
stop_meas( &softmodem_stats_tx_sf[proc->subframe] );
|
stop_meas( &softmodem_stats_tx_sf[proc->subframe] );
|
||||||
#ifdef LOWLATENCY
|
#ifdef DEADLINE_SCHEDULER
|
||||||
if (opp_enabled){
|
if (opp_enabled){
|
||||||
if(softmodem_stats_tx_sf[proc->subframe].diff_now/(cpuf) > attr.sched_runtime){
|
if(softmodem_stats_tx_sf[proc->subframe].diff_now/(cpuf) > attr.sched_runtime){
|
||||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_TX_ENB, (softmodem_stats_tx_sf[proc->subframe].diff_now/cpuf - attr.sched_runtime)/1000000.0);
|
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_TX_ENB, (softmodem_stats_tx_sf[proc->subframe].diff_now/cpuf - attr.sched_runtime)/1000000.0);
|
||||||
@@ -1370,7 +1370,7 @@ static void* eNB_thread_rx( void* param )
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#ifdef LOWLATENCY
|
#ifdef DEADLINE_SCHEDULER
|
||||||
struct sched_attr attr;
|
struct sched_attr attr;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
uint64_t runtime = 870000 ;
|
uint64_t runtime = 870000 ;
|
||||||
@@ -1534,7 +1534,7 @@ LOG_I( HW, "[SCHED][eNB] RX thread %d started on CPU %d TID %ld, sched_policy =
|
|||||||
proc->frame_rx=0;
|
proc->frame_rx=0;
|
||||||
|
|
||||||
stop_meas( &softmodem_stats_rx_sf[proc->subframe] );
|
stop_meas( &softmodem_stats_rx_sf[proc->subframe] );
|
||||||
#ifdef LOWLATENCY
|
#ifdef DEADLINE_SCHEDULER
|
||||||
if (opp_enabled){
|
if (opp_enabled){
|
||||||
if(softmodem_stats_rx_sf[proc->subframe].diff_now/(cpuf) > attr.sched_runtime){
|
if(softmodem_stats_rx_sf[proc->subframe].diff_now/(cpuf) > attr.sched_runtime){
|
||||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_RX_ENB, (softmodem_stats_rx_sf[proc->subframe].diff_now/cpuf - attr.sched_runtime)/1000000.0);
|
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_RX_ENB, (softmodem_stats_rx_sf[proc->subframe].diff_now/cpuf - attr.sched_runtime)/1000000.0);
|
||||||
@@ -1576,7 +1576,7 @@ void init_eNB_proc(void)
|
|||||||
// set the stack size
|
// set the stack size
|
||||||
|
|
||||||
|
|
||||||
#ifndef LOWLATENCY
|
#ifndef DEADLINE_SCHEDULER
|
||||||
/*
|
/*
|
||||||
pthread_attr_init( &attr_eNB_proc_tx[CC_id][i] );
|
pthread_attr_init( &attr_eNB_proc_tx[CC_id][i] );
|
||||||
if (pthread_attr_setstacksize( &attr_eNB_proc_tx[CC_id][i], 64 *PTHREAD_STACK_MIN ) != 0)
|
if (pthread_attr_setstacksize( &attr_eNB_proc_tx[CC_id][i], 64 *PTHREAD_STACK_MIN ) != 0)
|
||||||
@@ -1603,7 +1603,7 @@ void init_eNB_proc(void)
|
|||||||
pthread_mutex_init( &PHY_vars_eNB_g[0][CC_id]->proc[i].mutex_rx, NULL);
|
pthread_mutex_init( &PHY_vars_eNB_g[0][CC_id]->proc[i].mutex_rx, NULL);
|
||||||
pthread_cond_init( &PHY_vars_eNB_g[0][CC_id]->proc[i].cond_tx, NULL);
|
pthread_cond_init( &PHY_vars_eNB_g[0][CC_id]->proc[i].cond_tx, NULL);
|
||||||
pthread_cond_init( &PHY_vars_eNB_g[0][CC_id]->proc[i].cond_rx, NULL);
|
pthread_cond_init( &PHY_vars_eNB_g[0][CC_id]->proc[i].cond_rx, NULL);
|
||||||
#ifndef LOWLATENCY
|
#ifndef DEADLINE_SCHEDULER
|
||||||
pthread_create( &PHY_vars_eNB_g[0][CC_id]->proc[i].pthread_tx, &attr_eNB_proc_tx[CC_id][i], eNB_thread_tx, &PHY_vars_eNB_g[0][CC_id]->proc[i] );
|
pthread_create( &PHY_vars_eNB_g[0][CC_id]->proc[i].pthread_tx, &attr_eNB_proc_tx[CC_id][i], eNB_thread_tx, &PHY_vars_eNB_g[0][CC_id]->proc[i] );
|
||||||
pthread_create( &PHY_vars_eNB_g[0][CC_id]->proc[i].pthread_rx, &attr_eNB_proc_rx[CC_id][i], eNB_thread_rx, &PHY_vars_eNB_g[0][CC_id]->proc[i] );
|
pthread_create( &PHY_vars_eNB_g[0][CC_id]->proc[i].pthread_rx, &attr_eNB_proc_rx[CC_id][i], eNB_thread_rx, &PHY_vars_eNB_g[0][CC_id]->proc[i] );
|
||||||
#else
|
#else
|
||||||
@@ -1778,7 +1778,7 @@ static void* eNB_thread( void* arg )
|
|||||||
#ifdef RTAI
|
#ifdef RTAI
|
||||||
RT_TASK* task = rt_task_init_schmod(nam2num("eNBmain"), 0, 0, 0, SCHED_FIFO, 0xF);
|
RT_TASK* task = rt_task_init_schmod(nam2num("eNBmain"), 0, 0, 0, SCHED_FIFO, 0xF);
|
||||||
#else
|
#else
|
||||||
#ifdef LOWLATENCY
|
#ifdef DEADLINE_SCHEDULER
|
||||||
struct sched_attr attr;
|
struct sched_attr attr;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
|
|
||||||
@@ -3305,7 +3305,7 @@ int main( int argc, char **argv )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef LOWLATENCY
|
#ifndef DEADLINE_SCHEDULER
|
||||||
|
|
||||||
/* Currently we set affinity for UHD to CPU 0 for eNB/UE and only if number of CPUS >2 */
|
/* Currently we set affinity for UHD to CPU 0 for eNB/UE and only if number of CPUS >2 */
|
||||||
|
|
||||||
@@ -3608,7 +3608,7 @@ int main( int argc, char **argv )
|
|||||||
pthread_attr_init (&attr_UE_thread);
|
pthread_attr_init (&attr_UE_thread);
|
||||||
pthread_attr_setstacksize(&attr_UE_thread,8192);//5*PTHREAD_STACK_MIN);
|
pthread_attr_setstacksize(&attr_UE_thread,8192);//5*PTHREAD_STACK_MIN);
|
||||||
|
|
||||||
#ifndef LOWLATENCY
|
#ifndef DEADLINE_SCHEDULER
|
||||||
sched_param_UE_thread.sched_priority = sched_get_priority_max(SCHED_FIFO);
|
sched_param_UE_thread.sched_priority = sched_get_priority_max(SCHED_FIFO);
|
||||||
pthread_attr_setschedparam(&attr_UE_thread,&sched_param_UE_thread);
|
pthread_attr_setschedparam(&attr_UE_thread,&sched_param_UE_thread);
|
||||||
sched_param_dlsch.sched_priority = sched_get_priority_max(SCHED_FIFO); //OPENAIR_THREAD_PRIORITY;
|
sched_param_dlsch.sched_priority = sched_get_priority_max(SCHED_FIFO); //OPENAIR_THREAD_PRIORITY;
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ static void *UE_thread_synch(void *arg)
|
|||||||
printf("UE_thread_sync in with PHY_vars_UE %p\n",arg);
|
printf("UE_thread_sync in with PHY_vars_UE %p\n",arg);
|
||||||
printf("waiting for sync (UE_thread_synch) \n");
|
printf("waiting for sync (UE_thread_synch) \n");
|
||||||
|
|
||||||
#ifndef LOWLATENCY
|
#ifndef DEADLINE_SCHEDULER
|
||||||
int policy, s, j;
|
int policy, s, j;
|
||||||
struct sched_param sparam;
|
struct sched_param sparam;
|
||||||
char cpu_affinity[1024];
|
char cpu_affinity[1024];
|
||||||
@@ -701,7 +701,7 @@ static void *UE_thread_tx(void *arg)
|
|||||||
LOG_D(HW,"Started UE TX thread (id %p)\n",task);
|
LOG_D(HW,"Started UE TX thread (id %p)\n",task);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifdef LOWLATENCY
|
#ifdef DEADLINE_SCHEDULER
|
||||||
struct sched_attr attr;
|
struct sched_attr attr;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
|
|
||||||
@@ -920,7 +920,7 @@ static void *UE_thread_rx(void *arg)
|
|||||||
LOG_D(HW,"Started UE RX thread (id %p)\n",task);
|
LOG_D(HW,"Started UE RX thread (id %p)\n",task);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifdef LOWLATENCY
|
#ifdef DEADLINE_SCHEDULER
|
||||||
struct sched_attr attr;
|
struct sched_attr attr;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
|
|
||||||
@@ -1237,7 +1237,7 @@ void *UE_thread(void *arg)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifdef LOWLATENCY
|
#ifdef DEADLINE_SCHEDULER
|
||||||
struct sched_attr attr;
|
struct sched_attr attr;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
|
|
||||||
@@ -1616,7 +1616,7 @@ void *UE_thread(void *arg)
|
|||||||
|
|
||||||
int wait_sync_cnt = 0;
|
int wait_sync_cnt = 0;
|
||||||
int first_synch = 1;
|
int first_synch = 1;
|
||||||
#ifdef LOWLATENCY
|
#ifdef DEADLINE_SCHEDULER
|
||||||
struct sched_attr attr;
|
struct sched_attr attr;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
// unsigned long mask = 1; // processor 0
|
// unsigned long mask = 1; // processor 0
|
||||||
@@ -1640,7 +1640,7 @@ void *UE_thread(void *arg)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef LOWLATENCY
|
#ifdef DEADLINE_SCHEDULER
|
||||||
attr.size = sizeof(attr);
|
attr.size = sizeof(attr);
|
||||||
attr.sched_flags = 0;
|
attr.sched_flags = 0;
|
||||||
attr.sched_nice = 0;
|
attr.sched_nice = 0;
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ void *timer_proc(void *arg) {
|
|||||||
struct itimerspec *old_value;
|
struct itimerspec *old_value;
|
||||||
|
|
||||||
|
|
||||||
#ifdef LOWLATENCY
|
#ifdef DEADLINE_SCHEDULER
|
||||||
struct sched_attr attr;
|
struct sched_attr attr;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
/*! \file rt_wrapper.h
|
/*! \file rt_wrapper.h
|
||||||
* \brief provides a wrapper for the timing function, runtime calculations for real-time opeartions depending on weather RTAI or LOWLATENCY kernels are used or not
|
* \brief provides a wrapper for the timing function, runtime calculations for real-time opeartions depending on weather RTAI or DEADLINE_SCHEDULER kernels are used or not
|
||||||
* \author F. Kaltenberger and Navid Nikaein
|
* \author F. Kaltenberger and Navid Nikaein
|
||||||
* \date 2013
|
* \date 2013
|
||||||
* \version 0.1
|
* \version 0.1
|
||||||
@@ -241,7 +241,7 @@ double get_runtime_rx(int rx_subframe, uint16_t runtime_phy_rx[29][6], uint32_t
|
|||||||
return runtime;
|
return runtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LOWLATENCY
|
#ifdef DEADLINE_SCHEDULER
|
||||||
int sched_setattr(pid_t pid, const struct sched_attr *attr, unsigned int flags)
|
int sched_setattr(pid_t pid, const struct sched_attr *attr, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ double get_runtime_rx(int rx_subframe, uint16_t runtime_phy_rx[29][6], uint32_t
|
|||||||
* see https://www.kernel.org/doc/Documentation/scheduler/sched-deadline.txt or
|
* see https://www.kernel.org/doc/Documentation/scheduler/sched-deadline.txt or
|
||||||
* http://www.blaess.fr/christophe/2014/04/05/utiliser-un-appel-systeme-inconnu-de-la-libc/
|
* http://www.blaess.fr/christophe/2014/04/05/utiliser-un-appel-systeme-inconnu-de-la-libc/
|
||||||
*/
|
*/
|
||||||
#ifdef LOWLATENCY
|
#ifdef DEADLINE_SCHEDULER
|
||||||
|
|
||||||
#define gettid() syscall(__NR_gettid)
|
#define gettid() syscall(__NR_gettid)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user