From 41f750163fcd9e037169698b421f83ff9016ae07 Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 25 Nov 2025 01:08:47 +0800 Subject: [PATCH] change timing of PDDB mount moving it a shy later into the boot makes the mount process faster because it's not fighting for swap memory with everything else trying to initialize at the time. --- apps-baosec/vault2/src/main.rs | 6 ++++++ services/bao-console/src/cmds/pddb.rs | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/apps-baosec/vault2/src/main.rs b/apps-baosec/vault2/src/main.rs index 7d2a594b1..198ca6faa 100644 --- a/apps-baosec/vault2/src/main.rs +++ b/apps-baosec/vault2/src/main.rs @@ -148,6 +148,7 @@ fn main() -> ! { log::info!("Vault2 PID is {}", xous::process::id()); let xns = xous_names::XousNames::new().unwrap(); + let tt = ticktimer_server::Ticktimer::new().unwrap(); // Register the server with xous let sid = xns.register_name(SERVER_NAME_VAULT2, None).expect("can't register server"); @@ -388,6 +389,11 @@ fn main() -> ! { let modals = modals::Modals::new(&xns).unwrap(); vault_ui.apply_glyph_style(); + // give the system a second to stabilize, then try to mount + tt.sleep_ms(1000).ok(); + let pddb = pddb::Pddb::new(); + pddb.try_mount(); + // reload the database xous::send_message( actions_conn, diff --git a/services/bao-console/src/cmds/pddb.rs b/services/bao-console/src/cmds/pddb.rs index a89d4e3e3..8c10f5890 100644 --- a/services/bao-console/src/cmds/pddb.rs +++ b/services/bao-console/src/cmds/pddb.rs @@ -12,12 +12,12 @@ use crate::{CommonEnv, ShellCmdApi}; pub struct PddbCmd { pddb: pddb::Pddb, + mounted: bool, } impl PddbCmd { pub fn new() -> Self { let pddb = pddb::Pddb::new(); - log::info!("PDDB mount result: {:?}", pddb.try_mount()); - PddbCmd { pddb } + PddbCmd { pddb, mounted: false } } } @@ -25,6 +25,11 @@ impl<'a> ShellCmdApi<'a> for PddbCmd { cmd_api!(pddb); fn process(&mut self, args: String, _env: &mut CommonEnv) -> Result, xous::Error> { + // lazy-eval this mount + if !self.mounted { + log::info!("PDDB mount result: {:?}", self.pddb.try_mount()); + self.mounted = true; + } let mut ret = String::new(); #[cfg(not(feature = "pddbtest"))] let helpstring = "pddb [basislist] [basiscreate] [basisunlock] [basislock] [basisdelete] [default]\n[dictlist] [keylist] [write] [writeover] [query] [copy] [dictdelete] [keydelete] [churn] [flush] [sync]";