Skip to content
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

Tracking: Couple IPCData array sizes with number of apps on board #1583

Closed
hudson-ayers opened this issue Feb 5, 2020 · 2 comments · Fixed by #2342
Closed

Tracking: Couple IPCData array sizes with number of apps on board #1583

hudson-ayers opened this issue Feb 5, 2020 · 2 comments · Fixed by #2342
Labels

Comments

@hudson-ayers
Copy link
Contributor

Currently, the IPCData array in kernel/src/ipc.rs is hardcoded to hold 8 elements, and whenever an application registers as an IPC client, the callback and shared memory for that client is stored at that place in the array. Currently the Hail board is initialized with support for up to 20 apps. If an app with an index greater than 7 attempts to use IPC, IPC will fail.

Ideally we would tie the size of these arrays to the size of the PROCESSES array, though I am not yet sure exactly how that should be done.

@hudson-ayers hudson-ayers linked a pull request Feb 7, 2020 that will close this issue
2 tasks
@hudson-ayers hudson-ayers changed the title IPCData array sizes decoupled from number of apps on board Tracking: Couple IPCData array sizes with number of apps on board Feb 7, 2020
@hudson-ayers
Copy link
Contributor Author

The cleanest fix for this (IMO) is to use const generics to tie the size of these arrays to the number of processes, as initially attempted in #1585 . However this approach introduces additional uses of unsafe which can be removed once either rust-lang/rust#61415 or rust-lang/rust#68567 are addressed, at which point #1585 can be modified and reopened.

Alternatively someone could attempt a more significant restructuring of IPC to avoid this issue, but I suspect that it is not worth the effort for now.

@hudson-ayers
Copy link
Contributor Author

hudson-ayers commented May 11, 2020

Update: this can now be achieved on latest nightly without unsafe thanks to rust-lang/rust#69981 . However it still requires const generics, which is maybe less stable than most unstable features currently used in Tock (rust labels it an incomplete feature).

Working branch: https://github.com/hudson-ayers/tock/tree/ipc-const-generics . For imix this branch reduces the size of the IPCData structure from 412 to 220 bytes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant