Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
promise
OpenXG-RAN
Commits
b9cf09b2
Commit
b9cf09b2
authored
Apr 13, 2016
by
Rohit Gupta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable CPU affinity for 2 CPUS + fix deadline scheduler
parent
ea2f0067
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
29 deletions
+27
-29
targets/RT/USER/lte-softmodem.c
targets/RT/USER/lte-softmodem.c
+27
-29
No files found.
targets/RT/USER/lte-softmodem.c
View file @
b9cf09b2
...
@@ -1090,13 +1090,9 @@ static void* eNB_thread_tx( void* param )
...
@@ -1090,13 +1090,9 @@ static void* eNB_thread_tx( void* param )
#ifdef LOWLATENCY
#ifdef LOWLATENCY
struct
sched_attr
attr
;
struct
sched_attr
attr
;
unsigned
int
flags
=
0
;
unsigned
int
flags
=
0
;
uint64_t
runtime
=
(
uint64_t
)
(
get_runtime_tx
(
proc
->
subframe
,
runtime_phy_tx
,
target_dl_mcs
,
frame_parms
[
0
]
->
N_RB_DL
,
cpuf
,
PHY_vars_eNB_g
[
0
][
0
]
->
lte_frame_parms
.
nb_antennas_tx
)
*
1000000
);
uint64_t
runtime
=
900000
;
uint64_t
deadline
=
1
*
1000000
;
// each tx thread will finish within 1ms
uint64_t
deadline
=
1
*
1000000
;
// each tx thread will finish within 1ms
uint64_t
period
=
1
*
10000000
;
// each tx thread has a period of 10ms from the starting point
uint64_t
period
=
1
*
10000000
;
// each tx thread has a period of 10ms from the starting point
if
(
runtime
>
1000000
){
LOG_W
(
HW
,
"estimated runtime %d is larger than 1ms, adjusting
\n
"
,
runtime
);
runtime
=
(
0
.
97
*
100
)
*
10000
;
}
attr
.
size
=
sizeof
(
attr
);
attr
.
size
=
sizeof
(
attr
);
attr
.
sched_flags
=
0
;
attr
.
sched_flags
=
0
;
...
@@ -1123,16 +1119,19 @@ static void* eNB_thread_tx( void* param )
...
@@ -1123,16 +1119,19 @@ static void* eNB_thread_tx( void* param )
/* Set affinity mask to include CPUs 1 to MAX_CPUS */
/* Set affinity mask to include CPUs 1 to MAX_CPUS */
/* CPU 0 is reserved for UHD threads */
/* CPU 0 is reserved for UHD threads */
/* CPU 1 is reserved for all TX threads */
/* CPU 1 is reserved for all TX threads */
/* Enable CPU Affinity only if number of CPUs >2 */
CPU_ZERO
(
&
cpuset
);
CPU_ZERO
(
&
cpuset
);
//for (j = 1; j < get_nprocs(); j++)
if
(
get_nprocs
()
>
2
)
CPU_SET
(
1
,
&
cpuset
);
s
=
pthread_setaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
&
cpuset
);
if
(
s
!=
0
)
{
{
perror
(
"pthread_setaffinity_np"
);
CPU_SET
(
1
,
&
cpuset
);
exit_fun
(
"Error setting processor affinity"
);
s
=
pthread_setaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
&
cpuset
);
if
(
s
!=
0
)
{
perror
(
"pthread_setaffinity_np"
);
exit_fun
(
"Error setting processor affinity"
);
}
}
}
/* Check the actual affinity mask assigned to the thread */
/* Check the actual affinity mask assigned to the thread */
s
=
pthread_getaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
&
cpuset
);
s
=
pthread_getaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
&
cpuset
);
...
@@ -1370,15 +1369,10 @@ static void* eNB_thread_rx( void* param )
...
@@ -1370,15 +1369,10 @@ static void* eNB_thread_rx( void* param )
#ifdef LOWLATENCY
#ifdef LOWLATENCY
struct
sched_attr
attr
;
struct
sched_attr
attr
;
unsigned
int
flags
=
0
;
unsigned
int
flags
=
0
;
uint64_t
runtime
=
get_runtime_rx
(
proc
->
subframe
,
runtime_phy_rx
,
target_ul_mcs
,
frame_parms
[
0
]
->
N_RB_DL
,
cpuf
,
PHY_vars_eNB_g
[
0
][
0
]
->
lte_frame_parms
.
nb_antennas_rx
)
*
1000000
;
uint64_t
runtime
=
900000
;
uint64_t
deadline
=
1
*
1000000
;
uint64_t
deadline
=
1
*
1000000
;
uint64_t
period
=
1
*
10000000
;
// each rx thread has a period of 10ms from the starting point
uint64_t
period
=
1
*
10000000
;
// each rx thread has a period of 10ms from the starting point
if
(
runtime
>
2300000
)
{
LOG_W
(
HW
,
"estimated rx runtime %d is larger than expected, adjusting
\n
"
,
runtime
);
runtime
=
2300000
;
deadline
=
runtime
+
100000
;
}
attr
.
size
=
sizeof
(
attr
);
attr
.
size
=
sizeof
(
attr
);
attr
.
sched_flags
=
0
;
attr
.
sched_flags
=
0
;
attr
.
sched_nice
=
0
;
attr
.
sched_nice
=
0
;
...
@@ -1405,16 +1399,21 @@ static void* eNB_thread_rx( void* param )
...
@@ -1405,16 +1399,21 @@ static void* eNB_thread_rx( void* param )
/* CPU 0 is reserved for UHD */
/* CPU 0 is reserved for UHD */
/* CPU 1 is reserved for all TX threads */
/* CPU 1 is reserved for all TX threads */
/* CPU 2..MAX_CPUS is reserved for all RX threads */
/* CPU 2..MAX_CPUS is reserved for all RX threads */
/* Set CPU Affinity only if number of CPUs >2 */
CPU_ZERO
(
&
cpuset
);
CPU_ZERO
(
&
cpuset
);
for
(
j
=
2
;
j
<
get_nprocs
();
j
++
)
if
(
get_nprocs
()
>
2
)
CPU_SET
(
j
,
&
cpuset
);
s
=
pthread_setaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
&
cpuset
);
if
(
s
!=
0
)
{
{
perror
(
"pthread_setaffinity_np"
);
for
(
j
=
2
;
j
<
get_nprocs
();
j
++
)
exit_fun
(
" Error setting processor affinity :"
);
CPU_SET
(
j
,
&
cpuset
);
s
=
pthread_setaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
&
cpuset
);
if
(
s
!=
0
)
{
perror
(
"pthread_setaffinity_np"
);
exit_fun
(
" Error setting processor affinity :"
);
}
}
}
/* Check the actual affinity mask assigned to the thread */
/* Check the actual affinity mask assigned to the thread */
s
=
pthread_getaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
&
cpuset
);
s
=
pthread_getaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
&
cpuset
);
...
@@ -3303,9 +3302,8 @@ int main( int argc, char **argv )
...
@@ -3303,9 +3302,8 @@ int main( int argc, char **argv )
#ifndef LOWLATENCY
#ifndef LOWLATENCY
/* Currently we set affinity for UHD to CPU 0 for eNB only 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 */
/* ToDo: Set CPU affinity for UE */
if
(
get_nprocs
()
>
2
)
if
(
UE_flag
==
0
&&
get_nprocs
()
>
2
)
{
{
cpu_set_t
cpuset
;
cpu_set_t
cpuset
;
int
s
;
int
s
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment