-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cfe2cos, the mega-merge #333
base: ppos
Are you sure you want to change the base?
Conversation
… simple queue" This reverts commit 2d0a358.
There are known issues, but it should be fine for now
This commit also removes the redundant scheddev directory
I've addressed most of the above comments, will investigate the others. I also got rid of the cFE_emu library, and used the existing c_stubs mechanism. @gparmer In terms of review ordering, this order would be great:
Otherwise the original order of the summaries is a proxy for my desire to have that part reviewed. (Although, I think the filesystem should go last. It's already been reviewed after all.) Thanks! |
|
||
int emu_backend_request_memory(spdid_t client); | ||
|
||
int32 emu_CFE_ES_GetGenCount(spdid_t client); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use the cos_inv_token()
in the server component for the client's spdid instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to go, and I'm half way through ostask.c
, but I figured I'd leave these comments for now. Will continue when I can.
ADDITIONAL_LIBS=-lcobj_format -lcos_kernel_api -lcos_defkernel_api -lsl_capmgr -lsl_sched -lheap -lsl_lock | ||
|
||
include ../../Makefile.subsubdir | ||
CFLAGS += -I./gen -I ./test/shared $(CPPFLAGS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't think there's supposed to be a space between -I .test...
. I'm wondering what this test
dir is. We'll see!
#include <cos_component.h> | ||
#include <cos_debug.h> | ||
#include <cos_types.h> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You said you want feedback on style so: no spaces between many of these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We follow the std => cos => interface => cFE => internal header convention. Otherwise it becomes very confusing where each header is coming from. Especially since we have 5 header sources. Is this something the cos style guide takes a strong stance on?
int | ||
emu_backend_request_memory(spdid_t client) | ||
{ | ||
vaddr_t our_addr = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty line after definitions
int id = memmgr_shared_page_alloc(&our_addr); | ||
assert(our_addr); | ||
shared_regions[client] = (void *)our_addr; | ||
return id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line before final return.
emu_CFE_EVS_Register(spdid_t client) | ||
{ | ||
union shared_region *s = shared_regions[client]; | ||
return CFE_EVS_Register(s->cfe_evs_register.filters, s->cfe_evs_register.NumEventFilters, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing about blank line after definitions. Won't repeat too many times, to keep the comment # down.
cycles_t now, start; | ||
|
||
rdtscll(start); | ||
start += sl_usec2cyc(HZ_PAUSE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we uniformly 64 bit here? If not, could overflow easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uniformly 64 bit.
|
||
while (1) { | ||
rdtscll(now); | ||
if (now > start) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start
is not a good name for the variable being used here. Would use deadline
as deadline = start + sl_usec2cyc(HZ_PAUSE)
.
We need to think through how to have assert
s for all of the overflow possibilities everywhere. I'm concerned this is why your scheduling is wonky.
void | ||
OS_SchedulerStart(cos_thd_fn_t main_delegate) | ||
{ | ||
sl_init(SL_MIN_PERIOD_US); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defs at head of block
struct sl_thd * main_delegate_thread = sl_thd_alloc(main_delegate, NULL); | ||
union sched_param_union sp = {.c = {.type = SCHEDP_PRIO, .value = MAIN_DELEGATE_THREAD_PRIORITY}}; | ||
sl_thd_param_set(main_delegate_thread, sp.v); | ||
main_delegate_thread_id = sl_thd_thdid(main_delegate_thread); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"delegate thread" is a little bit of a strange name. Not really sure what "delegate" has to do with all of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's called main_delegate_thread
. It's the thread we delegate main execution to. Do you have a better name in mind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read it as, "of all the delegate threads, it is the main one". Both grammatical parsings are correct.
Maybe just a comment somewhere when it is first used to clarify.
it. */ | ||
} | ||
|
||
sl_thd_block_periodic(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to make sure we aren't spinning in this loop for some strange interaction in the system, it might be smart to count how many times we've iterated without triggering the now > start
condition, and assert if it goes above some level (say 64).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ostask done.
struct sl_thd * main_delegate_thread = sl_thd_alloc(main_delegate, NULL); | ||
union sched_param_union sp = {.c = {.type = SCHEDP_PRIO, .value = MAIN_DELEGATE_THREAD_PRIORITY}}; | ||
sl_thd_param_set(main_delegate_thread, sp.v); | ||
main_delegate_thread_id = sl_thd_thdid(main_delegate_thread); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read it as, "of all the delegate threads, it is the main one". Both grammatical parsings are correct.
Maybe just a comment somewhere when it is first used to clarify.
task_info->osal_task_prop.priority = MAIN_DELEGATE_THREAD_PRIORITY; | ||
task_info->osal_task_prop.OStask_id = (uint32)sl_thd_thdid(main_delegate_thread); | ||
|
||
struct sl_thd * timer_thd = sl_thd_alloc(timer_fn_1hz, NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defs at head of block
void | ||
osal_task_entry_wrapper(void *task_entry) | ||
{ | ||
((osal_task_entry)task_entry)(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we define this type, it should be osal_task_entry_t
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, this is a cFE definition
|
||
if (priority > 255 || priority < 1) { return OS_ERR_INVALID_PRIORITY; } | ||
|
||
struct sl_thd *thd = sl_thd_alloc(osal_task_entry_wrapper, function_pointer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def....block....blah ;-)
union sched_param_union sp = {.c = {.type = SCHEDP_PRIO, .value = priority}}; | ||
sl_thd_param_set(thd, sp.v); | ||
|
||
struct cfe_task_info *task_info = &cfe_tasks[sl_thd_thdid(thd)]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha, our thdid function has a pretty redundant name.
OS_MutSemDelete(uint32 sem_id) | ||
{ | ||
int32 result = OS_SUCCESS; | ||
sl_lock_take(&mutex_data_lock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty line before
|
||
sl_lock_take(&mutex_data_lock); | ||
|
||
if (sem_id == NULL || sem_name == NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move outside of lock along with next error check
} | ||
} | ||
|
||
/* The name was not found in the table, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/*
* ...
*/
|
||
sl_lock_take(&semaphore_data_lock); | ||
|
||
if (sem_id == NULL || sem_name == NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move these error checks out of the lock
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since these checks are repetitive, you might want to move them into a function.
OS_SemaphoreDelete(struct semaphore *semaphores, uint32 max_semaphores, uint32 sem_id) | ||
{ | ||
int32 result = OS_SUCCESS; | ||
sl_lock_take(&semaphore_data_lock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty line
Brought five new apps into the cFE repo. They each run as their own component. mm is current not working, requiring more stubs to be written. All of the infrastructure is there from the cFE side of things, but it is excluded from the make.py list of apps.
This includes a critical hypercall to advance intialization
Summary of this Pull Request (PR)
The cFE is a complex piece of software, consequently our support implementation is quite complex. I will attempt to summarize what is going on with each change.
cFE_booter Support Code
cos_init
to the actual cFE is a bit of code, most of which is inspired by the posix implementation. We need to set up all of our data structures, start our scheduler, and make sure the filesystem is in good order. It's spread across of few files -- but again, not too complicated. We also boost the stack size so that the cFE doesn't blow the small stack. You can trace configuration logic fromcFE_entrypoint.c
The only other interesting stuff is incFE_util.c
.cFE_booter/cFE_entrypoint.c
cFE_booter/cFE_util.c
cFE_booter/cFE_util.h
parts ofcFE_booter/osapi.c
andcFE_booter/ostask.c
include/shared/consts.h
General OSAL Method Implementations
cFE_booter/osapi.c
cFE_booter/psp.c
cFE_booter/ostimer.c
cFE_booter/osnetwork.c
Copied Files
cFE_booter/cfe_psp_*
App Loading
cFE_booter/osloader.c
cFE Tasks + Scheduling
cFE_booter/ostask.c
cFE_booter/ostask.h
cFE_booter/sl_mod_fprr.c
cFE_booter/sl_mod_policy.h
cFE_booter/sl_thd_static_backend.c
OSAL Filesystem APIS
cFE_booter/osfiles.c
cFE_booter/osfilesys.c
cFE_booter/osfilesys.h
cFE_booter/tar.c
cFE_booter/tar.h
Queue Implementation
cFE_booter/osqueue.c
Major Build System Changes
make
wrangling. We kept most of our original build logic--in python--but it now runs totally under composite'smake
. I think most of the custom stuff is well commented..gitignore
.gitmodules
src/Makefile
extern/make.py
make
foo is weak, so some of this is a bit of a cludge. I just don't know how to do it better.cFE App Component Wrappers
no_interface/sch_lab/*
no_interface/sample_lib/*
no_interface/sample_app/*
cFE emulation for apps
src/components/Makefile.comp
cFE_booter/cFE_emu_support.c
lib/cFE_emu.c
lib/Makefile
include/cFE_emu.h
cFE_booter Build System
cFE_booter/.gitignore
cFE_booter/Makefile
Running the cFE
tools/Vagrantfile
runscripts/cFE_booter.sh
runscripts/llboot_cFE.sh
Other Outstanding Issues
llbooter/boot_deps.h
andllbooter/llbooter.c
are modified to map an extra page per component. This sucks, but without it the cFE breaks.include/cos_asm_simple_stacks.h
) This is because their composite versions are utterly broken and don't respectconsts.h
. I don't implement the most elegant solution, but w/e.Intent for your PR
Choose one (Mandatory):
Reviewers (Mandatory):
(Specify @<github.com username(s)> of the reviewers. Ex: @user1, @user2)
@gparmer @base0x10 @phanikishoreg
Code Quality
As part of this pull request, I've considered the following:
Style:
Code Craftsmanship:
Testing
I've tested the code using the following test programs (provide list here):