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
Michael Black
OpenXG-RAN
Commits
69fc902b
Commit
69fc902b
authored
Oct 18, 2021
by
Michael Cook
Committed by
Melissa
Oct 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set alarm
parent
2800fbe0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
46 additions
and
33 deletions
+46
-33
common/utils/utils.c
common/utils/utils.c
+32
-0
common/utils/utils.h
common/utils/utils.h
+1
-0
executables/nr-uesoftmodem.c
executables/nr-uesoftmodem.c
+7
-0
nfapi/oai_integration/nfapi.c
nfapi/oai_integration/nfapi.c
+2
-8
nfapi/oai_integration/nfapi_pnf.c
nfapi/oai_integration/nfapi_pnf.c
+2
-7
targets/RT/USER/lte-softmodem.c
targets/RT/USER/lte-softmodem.c
+1
-9
targets/RT/USER/lte-uesoftmodem.c
targets/RT/USER/lte-uesoftmodem.c
+1
-9
No files found.
common/utils/utils.c
View file @
69fc902b
...
...
@@ -2,6 +2,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <sched.h>
#include <errno.h>
#include "utils.h"
void
*
calloc_or_fail
(
size_t
size
)
{
...
...
@@ -137,3 +140,32 @@ void *memcpy1(void *dst,const void *src,size_t n) {
asm
volatile
(
"rep movsb"
:
"+D"
(
dst
)
:
"c"
(
n
),
"S"
(
src
)
:
"cc"
,
"memory"
);
return
(
ret
);
}
void
set_priority
(
int
priority
)
{
/* When running with a realtime scheduler, a buggy run-away process can take
down the host requiring a reboot to recover. To avoid this scenario, we
use alarm(2) to set a maximum running time */
unsigned
max_runtime_seconds
=
10
*
60
;
/* default */
const
char
*
env
=
getenv
(
"MAX_RUNTIME_SECONDS"
);
if
(
env
!=
NULL
)
{
max_runtime_seconds
=
atoi
(
env
);
}
unsigned
was_alarm
=
alarm
(
max_runtime_seconds
);
/* Normally, was_alarm should be 0 indicating there was no previous alarm set.
A non-zero value could indicate a mistake */
fprintf
(
stderr
,
"Set alarm for %u seconds, was %u (see $MAX_RUNTIME_SECONDS)
\n
"
,
max_runtime_seconds
,
was_alarm
);
struct
sched_param
param
=
{
.
sched_priority
=
priority
,
};
fprintf
(
stderr
,
"Calling sched_setscheduler(%d)
\n
"
,
priority
);
if
(
sched_setscheduler
(
0
,
SCHED_RR
,
&
param
)
==
-
1
)
{
fprintf
(
stderr
,
"sched_setscheduler: %s
\n
"
,
strerror
(
errno
));
abort
();
}
}
common/utils/utils.h
View file @
69fc902b
...
...
@@ -19,6 +19,7 @@ int hex_string_to_hex_value (uint8_t *hex_value, const char *hex_string, int siz
void
*
memcpy1
(
void
*
dst
,
const
void
*
src
,
size_t
n
);
void
set_priority
(
int
priority
);
char
*
itoa
(
int
i
);
...
...
executables/nr-uesoftmodem.c
View file @
69fc902b
...
...
@@ -415,6 +415,13 @@ void *rrc_enb_process_msg(void *notUsed) {
int
main
(
int
argc
,
char
**
argv
)
{
set_priority
(
79
);
if
(
mlockall
(
MCL_CURRENT
|
MCL_FUTURE
)
==
-
1
)
{
fprintf
(
stderr
,
"mlockall: %s
\n
"
,
strerror
(
errno
));
return
EXIT_FAILURE
;
}
//uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2;
PHY_VARS_NR_UE
*
UE
[
MAX_NUM_CCs
];
start_background_system
();
...
...
nfapi/oai_integration/nfapi.c
View file @
69fc902b
...
...
@@ -40,15 +40,9 @@ typedef struct {
static
nfapi_params_t
nfapi_params
=
{
0
};
void
set_thread_priority
(
int
priority
)
{
//printf("%s(priority:%d)\n", __FUNCTION__, priority);
pthread_attr_t
ptAttr
;
struct
sched_param
schedParam
;
schedParam
.
__sched_priority
=
priority
;
//79;
if
(
sched_setscheduler
(
0
,
SCHED_RR
,
&
schedParam
)
!=
0
)
{
printf
(
"Failed to set scheduler to SCHED_RR
\n
"
);
}
set_priority
(
priority
);
pthread_attr_t
ptAttr
;
if
(
pthread_attr_setschedpolicy
(
&
ptAttr
,
SCHED_RR
)
!=
0
)
{
printf
(
"Failed to set pthread sched policy SCHED_RR
\n
"
);
}
...
...
nfapi/oai_integration/nfapi_pnf.c
View file @
69fc902b
...
...
@@ -218,14 +218,9 @@ void pnf_nfapi_trace(nfapi_trace_level_t nfapi_level, const char *message, ...)
}
void
pnf_set_thread_priority
(
int
priority
)
{
pthread_attr_t
ptAttr
;
struct
sched_param
schedParam
;
schedParam
.
__sched_priority
=
priority
;
if
(
sched_setscheduler
(
0
,
SCHED_RR
,
&
schedParam
)
!=
0
)
{
printf
(
"failed to set SCHED_RR
\n
"
);
}
set_priority
(
priority
);
pthread_attr_t
ptAttr
;
if
(
pthread_attr_setschedpolicy
(
&
ptAttr
,
SCHED_RR
)
!=
0
)
{
printf
(
"failed to set pthread SCHED_RR %d
\n
"
,
errno
);
}
...
...
targets/RT/USER/lte-softmodem.c
View file @
69fc902b
...
...
@@ -524,15 +524,7 @@ static void wait_nfapi_init(char *thread_name) {
int
main
(
int
argc
,
char
**
argv
)
{
struct
sched_param
param
=
{
.
sched_priority
=
79
};
if
(
sched_setscheduler
(
0
,
SCHED_RR
,
&
param
)
==
-
1
)
{
fprintf
(
stderr
,
"sched_setscheduler: %s
\n
"
,
strerror
(
errno
));
return
EXIT_FAILURE
;
}
set_priority
(
79
);
if
(
mlockall
(
MCL_CURRENT
|
MCL_FUTURE
)
==
-
1
)
{
fprintf
(
stderr
,
"mlockall: %s
\n
"
,
strerror
(
errno
));
...
...
targets/RT/USER/lte-uesoftmodem.c
View file @
69fc902b
...
...
@@ -547,15 +547,7 @@ AssertFatal(false,"");
}
int
main
(
int
argc
,
char
**
argv
)
{
struct
sched_param
param
=
{
.
sched_priority
=
79
};
if
(
sched_setscheduler
(
0
,
SCHED_RR
,
&
param
)
==
-
1
)
{
fprintf
(
stderr
,
"sched_setscheduler: %s
\n
"
,
strerror
(
errno
));
return
EXIT_FAILURE
;
}
set_priority
(
79
);
if
(
mlockall
(
MCL_CURRENT
|
MCL_FUTURE
)
==
-
1
)
{
fprintf
(
stderr
,
"mlockall: %s
\n
"
,
strerror
(
errno
));
...
...
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