Commit Graph

58 Commits

Author SHA1 Message Date
Sam Leffler
b9e209b008 Overhaul ProcessManager support.
- Split support into three levels:
  o kata_proc_manager::process_manager is a single-threaded implementation
    of ProcessManagerInterface and PackageManagerInterface that uses an
    abstract manager interface to carry out low-level work (used mainly
    to inject fakes for unit testing).
  o kata_proc_manager is a thread-safe wrapper around process_manager that
    has the manager interfaces bound to KataOS; this is the level at which
    we integrate with external components.
  o kata_proc_component is the top-level glue code for the ProcessManager
    camkes component; it has a pre_init function to setup rust support
    (logger, allocator, etc), a run function for the component's control
    block, and wrapper functions for the camkes ProcessControl and
    PackageManagement interfaces.
- Add install, uninstall, start, stop, and bundles shell commands for
  exercising ProcessControlInterface & PackageManagementInterface.

Specifics:
- Bundle id's are now treated internally as SmallString's with &str
  used for passing bundle id's through api's. The BundleId type is
  temporarily used for get_running_bundles() to return information (but
  see below about RawBundleIdData).
- ArrayVec's are replaced with a hashbrown::HashMap
- Bundle objects are Box'd instead of holding refs (now that we have an
  allocator); this eliminates lifetime constraints.
- The manager interface is Box'd to eliminate lifetime constraints.
- Purge ProcessManager::empty(), it's infeasible with the hashmap and
  is not needed with kata_proc_manager support for static decls.
- Add RawBundleIdData support for serialize+deserialize of BundleIdArray;
  no more leaking internal data types to client code.
- Remove bounds check on #bundles recorded; set a nominal capacity
  and fallback to dynamic allocation of the hashmap.
- Manually update ProcessManagerBindings.h (using cbindgen).

Change-Id: I08deaecc997ea96cb794808036540bedd58b3fa4
GitOrigin-RevId: 6e0826940b43b1295d39769b57812a9494b5a4cb
2022-10-06 17:59:52 +00:00
Sam Leffler
64da97a4a6 Merge "Add kata-panic support."
GitOrigin-RevId: 86b4cf1b25c2796fff0b2f90da6ef76d773c80a9
2022-10-06 17:59:05 +00:00
Sam Leffler
c5e8722a24 Merge "Add LoggerInterface for logging msgs on the console."
GitOrigin-RevId: 256da9ba28b31f1ac3a87cce0098a52ac918de13
2022-10-06 17:58:54 +00:00
Sam Leffler
5cea7522fd Fixup kata RELEASE build handling.
- the RELEASE setting is a boolean, correct cmake check
- explicitly force log-level=0 & debug=true in cargo profile.dev entries

NB: to switch between RELEASE + non-RELEASE builds do "m clean",
  change easy-settings.cmake, then "m kata"
Change-Id: If56cd855a9f30313e264a808c0c12df0532194a0
GitOrigin-RevId: b15be5feba41a19a71ff86f00fee0b7bd0942049
2022-10-06 17:58:31 +00:00
Sam Leffler
94358ffec7 Switch to purpose-built global allocator.
Replace LockedHeap with a purpose-built equivalent. This works around
issues where rust_oom was undefined for certain build configs and
facilitates future sel4 integration (e.g. to use dynamically allocated
memory instead of bss).

Change-Id: I54f779ef794104ad1ae95590812d1cd49b4a3734
GitOrigin-RevId: 83474c02e6b6957946fbca4a9aa090bf3c4dbfdc
2022-10-06 17:58:08 +00:00
Sam Leffler
8d7e4bf44a Add a simple rust global allocator to each component.
- add a linked_list_allocator::LockedHeap instance to each component that
  might want to allocate memory and init the allocator with a fixed-size
  memory block in the component post_init hook
- add an alloc_test shell command that exercises the allocator

This does not dynamically add memory or support sharing memory between
components; this is an intermediate step to simplify bringing in crates
that want to allocate memory (e.g. hashbrown)..

Change-Id: Idaf11fb5d4999218c75bf932133df24de35e3053
GitOrigin-RevId: 7c9b14bf9463239ce030c374b58a140f0835759e
2022-10-06 17:57:56 +00:00
June Tate-Gans
83d2875eb2 rust: Add in link-time optimization by default
This turns on "fat" LTO for builds even in dev mode so that we can keep our
binaries size down. It's not a total solution, but eliminates the "kitchen sink"
effect that building Rust static libs has, allowing us to keep our dependencies
down a bit.

Change-Id: I5fb071d7cdb7b9964b2af25d8137944593bd065c
GitOrigin-RevId: fe7f105307e042c211be5d031870d6161d71e27c
2022-10-06 17:56:41 +00:00
Sam Leffler
e35c69ae4c Add initial ProcessMaanger interfaces.
- new ProcessManager component (aka kata-process-manager)

NB: interfaces/ProcessManagerBindings.h is manually generated by cbindgen
for the moment; e.g.
  cargo install cbindgen;
  cd components/ProcessManager; cbindgen -c cbindgen.toml \
      -o ../../interfaces/ProcessManagerBindings.h kata-proc-common

Change-Id: I153c6b193c6ba8e376b87a2563dc8543753f0b42
GitOrigin-RevId: 18c354f14cbec6ce01c020136fe9aefd88248ee9
2022-10-06 17:56:26 +00:00