mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
throttle debug messages
This commit is contained in:
parent
fc4a598a9b
commit
727135b347
3 changed files with 14 additions and 4 deletions
|
|
@ -13,6 +13,11 @@ use std::num::NonZeroU32;
|
||||||
// note this name cannot be changed because it is baked into `libstd`
|
// note this name cannot be changed because it is baked into `libstd`
|
||||||
pub(crate) const SERVER_NAME_PDDB: &str = "_Plausibly Deniable Database_";
|
pub(crate) const SERVER_NAME_PDDB: &str = "_Plausibly Deniable Database_";
|
||||||
pub(crate) const SERVER_NAME_PDDB_POLLER: &str = "_PDDB Mount Poller_";
|
pub(crate) const SERVER_NAME_PDDB_POLLER: &str = "_PDDB Mount Poller_";
|
||||||
|
/// This is the registered name for a dedicated private API channel to the PDDB for doing the time reset
|
||||||
|
/// Even though nobody but the PDDB should connect to this, we have to share it publicly so the PDDB can
|
||||||
|
/// depend upon this constant.
|
||||||
|
pub const TIME_SERVER_PDDB: &'static str = "_dedicated pddb timeserver connection_";
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub(crate) const BASIS_NAME_LEN: usize = 64; // don't want this too long anyways, because it's not recorded anywhere - users have to type it in.
|
pub(crate) const BASIS_NAME_LEN: usize = 64; // don't want this too long anyways, because it's not recorded anywhere - users have to type it in.
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|
@ -28,8 +33,8 @@ pub(crate) const PDDB_VERSION: u32 = 0x00_00_01_01;
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
// PDDB_A_LEN may be shorter than xous::PDDB_LEN, to speed up testing.
|
// PDDB_A_LEN may be shorter than xous::PDDB_LEN, to speed up testing.
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
//pub(crate) const PDDB_A_LEN: usize = xous::PDDB_LEN as usize;
|
pub(crate) const PDDB_A_LEN: usize = xous::PDDB_LEN as usize;
|
||||||
pub(crate) const PDDB_A_LEN: usize = 4 * 1024 * 1024;
|
// pub(crate) const PDDB_A_LEN: usize = 4 * 1024 * 1024;
|
||||||
|
|
||||||
/// range for the starting point of a journal number, picked from a random seed
|
/// range for the starting point of a journal number, picked from a random seed
|
||||||
/// the goal is to reduce info leakage about the age of structures relative to each other
|
/// the goal is to reduce info leakage about the age of structures relative to each other
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ impl DictCacheEntry {
|
||||||
|
|
||||||
if index_cache.data.is_none() || index_cache.tag.is_none() {
|
if index_cache.data.is_none() || index_cache.tag.is_none() {
|
||||||
// somehow we hit a page where nothing was allocated (perhaps it was previously deleted?), or less likely, the data was corrupted. Note the isuse, skip past it.
|
// somehow we hit a page where nothing was allocated (perhaps it was previously deleted?), or less likely, the data was corrupted. Note the isuse, skip past it.
|
||||||
if (errcnt < 16) || (errcnt % 8192 == 0) {
|
if (errcnt < 4) || (errcnt % 8192 == 0) {
|
||||||
log::warn!("Dictionary fill: encountered unallocated page at {} in the dictionary map. {}/{}", try_entry, key_count, self.key_count);
|
log::warn!("Dictionary fill: encountered unallocated page at {} in the dictionary map. {}/{}", try_entry, key_count, self.key_count);
|
||||||
}
|
}
|
||||||
errcnt += 1;
|
errcnt += 1;
|
||||||
|
|
@ -217,6 +217,7 @@ impl DictCacheEntry {
|
||||||
let mut try_entry = 1;
|
let mut try_entry = 1;
|
||||||
let mut key_count = 0;
|
let mut key_count = 0;
|
||||||
let mut index_cache = PlaintextCache { data: None, tag: None };
|
let mut index_cache = PlaintextCache { data: None, tag: None };
|
||||||
|
let mut warn_count = 0;
|
||||||
while try_entry < KEY_MAXCOUNT && key_count < self.key_count && try_entry <= self.last_disk_key_index as usize {
|
while try_entry < KEY_MAXCOUNT && key_count < self.key_count && try_entry <= self.last_disk_key_index as usize {
|
||||||
// cache our decryption data -- there's about 32 entries per page, and the scan is largely linear/sequential, so this should
|
// cache our decryption data -- there's about 32 entries per page, and the scan is largely linear/sequential, so this should
|
||||||
// be a substantial savings in effort.
|
// be a substantial savings in effort.
|
||||||
|
|
@ -229,7 +230,10 @@ impl DictCacheEntry {
|
||||||
// this case "should not happen" in practice, because the last_disk_key_index would either be correctly set as
|
// this case "should not happen" in practice, because the last_disk_key_index would either be correctly set as
|
||||||
// short by a dict_add(), or a mount() operation would have limited the extent of the search.
|
// short by a dict_add(), or a mount() operation would have limited the extent of the search.
|
||||||
// if we are hitting this, that means the last_disk_key_index operator was not managed correctly.
|
// if we are hitting this, that means the last_disk_key_index operator was not managed correctly.
|
||||||
log::warn!("expensive search op");
|
if warn_count < 4 || (warn_count % 8192 == 0) {
|
||||||
|
log::warn!("expensive search op");
|
||||||
|
}
|
||||||
|
warn_count += 1;
|
||||||
try_entry += DK_PER_VPAGE;
|
try_entry += DK_PER_VPAGE;
|
||||||
} else {
|
} else {
|
||||||
let cache = index_cache.data.as_ref().expect("Cache should be full, it was already checked...");
|
let cache = index_cache.data.as_ref().expect("Cache should be full, it was already checked...");
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ impl PddbMountPoller {
|
||||||
PddbMountPoller { conn }
|
PddbMountPoller { conn }
|
||||||
}
|
}
|
||||||
pub fn is_mounted_nonblocking(&self) -> bool {
|
pub fn is_mounted_nonblocking(&self) -> bool {
|
||||||
|
log::info!("mount poll");
|
||||||
match send_message(self.conn,
|
match send_message(self.conn,
|
||||||
Message::new_blocking_scalar(PollOp::Poll.to_usize().unwrap(), 0, 0, 0, 0)
|
Message::new_blocking_scalar(PollOp::Poll.to_usize().unwrap(), 0, 0, 0, 0)
|
||||||
).expect("couldn't poll mount poller") {
|
).expect("couldn't poll mount poller") {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue