MemoryManager: correct initial memory use and add mdebug command

- Use seL4_Untyped_Describe to get an accurate view of each
  UntypedMemory slab being managed; this makes mstats reflect
  rootserver allocations.
- Track memory allocated before we run as "overhead" (was meant to
  track fragmentation but was always zero).
- Add an "mdebug" command to describe each managed memory slab;
  this is useful to see whether the kernel's view of memory use is
  consistent with MemoryManager.

Change-Id: I53b2738c430ad3356ecd16a1cad29ca92dc74beb
GitOrigin-RevId: 2ad43f9b7760c722a6590ea049a3814c8dcccba7
This commit is contained in:
Sam Leffler
2022-07-08 18:17:51 +00:00
parent a28057ea73
commit c2accc33b0
6 changed files with 76 additions and 7 deletions

View File

@@ -124,6 +124,7 @@ pub fn repl<T: io::BufRead>(
("kvwrite", kvwrite_command as CmdFn),
("install", install_command as CmdFn),
("loglevel", loglevel_command as CmdFn),
("mdebug", mdebug_command as CmdFn),
("mstats", mstats_command as CmdFn),
("ps", ps_command as CmdFn),
("start", start_command as CmdFn),
@@ -462,6 +463,18 @@ fn kvwrite_command(
Ok(())
}
fn mdebug_command(
_args: &mut dyn Iterator<Item = &str>,
_input: &mut dyn io::BufRead,
output: &mut dyn io::Write,
_builtin_cpio: &[u8],
) -> Result<(), CommandError> {
if let Err(status) = kata_memory_debug() {
writeln!(output, "stats failed: {:?}", status)?;
}
Ok(())
}
fn mstats(output: &mut dyn io::Write, stats: &MemoryManagerStats)
-> Result<(), CommandError>
{