From 6d5523de2ad092a8b3a66e9fe57c366b6a9919ff Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Sat, 1 Nov 2025 19:36:38 -0600 Subject: [PATCH] Set all log levels, reduce unnecessary logs --- acpid/src/aml_physmem.rs | 6 +-- acpid/src/main.rs | 2 +- audio/ac97d/src/main.rs | 2 +- audio/ihdad/src/main.rs | 2 +- audio/sb16d/src/main.rs | 2 +- graphics/virtio-gpud/src/main.rs | 4 +- hwd/src/backend/acpi.rs | 2 +- hwd/src/backend/devicetree.rs | 2 +- hwd/src/main.rs | 4 +- input/ps2d/src/main.rs | 2 +- input/usbhidd/src/main.rs | 2 +- inputd/src/main.rs | 2 +- net/rtl8139d/src/main.rs | 2 +- net/rtl8168d/src/main.rs | 2 +- net/virtio-netd/src/main.rs | 4 +- pcid-spawner/src/main.rs | 2 +- pcid/src/main.rs | 7 +-- storage/ahcid/src/main.rs | 2 +- storage/ided/src/main.rs | 2 +- storage/lived/src/main.rs | 59 ++++++++++++------------- storage/nvmed/src/main.rs | 2 +- storage/virtio-blkd/src/main.rs | 4 +- usb/usbhubd/src/main.rs | 2 +- usb/xhcid/src/main.rs | 2 +- usb/xhcid/src/xhci/device_enumerator.rs | 8 ++-- usb/xhcid/src/xhci/mod.rs | 16 +++---- 26 files changed, 72 insertions(+), 74 deletions(-) diff --git a/acpid/src/aml_physmem.rs b/acpid/src/aml_physmem.rs index 8e0d47d7bc..eb5dcfb24c 100644 --- a/acpid/src/aml_physmem.rs +++ b/acpid/src/aml_physmem.rs @@ -353,16 +353,16 @@ impl acpi::Handler for AmlPhysMemHandler { } fn create_mutex(&self) -> Handle { - log::warn!("TODO: Handler::create_mutex"); + log::info!("TODO: Handler::create_mutex"); Handle(0) } fn acquire(&self, mutex: Handle, timeout: u16) -> Result<(), AmlError> { - log::warn!("TODO: Handler::acquire"); + log::info!("TODO: Handler::acquire"); Ok(()) } fn release(&self, mutex: Handle) { - log::warn!("TODO: Handler::release"); + log::info!("TODO: Handler::release"); } } diff --git a/acpid/src/main.rs b/acpid/src/main.rs index 65e35513fb..215ccb43fd 100644 --- a/acpid/src/main.rs +++ b/acpid/src/main.rs @@ -18,8 +18,8 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! { "misc", "acpi", "acpid", - log::LevelFilter::Info, log::LevelFilter::Warn, + log::LevelFilter::Info, ); let rxsdt_raw_data: Arc<[u8]> = std::fs::read("/scheme/kernel.acpi/rxsdt") diff --git a/audio/ac97d/src/main.rs b/audio/ac97d/src/main.rs index 3249fb2e1e..bbd5d954e3 100644 --- a/audio/ac97d/src/main.rs +++ b/audio/ac97d/src/main.rs @@ -40,7 +40,7 @@ fn main() { "audio", "pci", &name, - log::LevelFilter::Info, + log::LevelFilter::Warn, log::LevelFilter::Info, ); diff --git a/audio/ihdad/src/main.rs b/audio/ihdad/src/main.rs index fefaf2f0ad..31aee8a65d 100755 --- a/audio/ihdad/src/main.rs +++ b/audio/ihdad/src/main.rs @@ -70,7 +70,7 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! { "audio", "pci", &name, - log::LevelFilter::Info, + log::LevelFilter::Warn, log::LevelFilter::Info, ); diff --git a/audio/sb16d/src/main.rs b/audio/sb16d/src/main.rs index 352313dbda..cfe25f77e7 100644 --- a/audio/sb16d/src/main.rs +++ b/audio/sb16d/src/main.rs @@ -23,7 +23,7 @@ fn main() { "audio", "pci", "sb16", - log::LevelFilter::Info, + log::LevelFilter::Warn, log::LevelFilter::Info, ); diff --git a/graphics/virtio-gpud/src/main.rs b/graphics/virtio-gpud/src/main.rs index 0c000f53ae..780148f2b6 100644 --- a/graphics/virtio-gpud/src/main.rs +++ b/graphics/virtio-gpud/src/main.rs @@ -553,8 +553,8 @@ pub fn main() { "misc", "pci", "virtio-gpud", - log::LevelFilter::Trace, - log::LevelFilter::Trace, + log::LevelFilter::Warn, + log::LevelFilter::Info, ); redox_daemon::Daemon::new(daemon_runner).expect("virtio-core: failed to daemonize"); } diff --git a/hwd/src/backend/acpi.rs b/hwd/src/backend/acpi.rs index 42170b2221..53b96a9d33 100644 --- a/hwd/src/backend/acpi.rs +++ b/hwd/src/backend/acpi.rs @@ -89,7 +89,7 @@ impl Backend for AcpiBackend { "PNP0F13" => "PS/2 port for PS/2-style mouse", _ => "?", }; - log::debug!("{}: {} ({})", name, id, what); + log::info!("{}: {} ({})", name, id, what); } } } diff --git a/hwd/src/backend/devicetree.rs b/hwd/src/backend/devicetree.rs index 8a91d04e42..a2dc7706dc 100644 --- a/hwd/src/backend/devicetree.rs +++ b/hwd/src/backend/devicetree.rs @@ -20,7 +20,7 @@ impl DeviceTreeBackend { line.push_str(id); } } - log::debug!("{}", line); + log::info!("{}", line); for child in node.children() { Self::dump(&child, level + 1); } diff --git a/hwd/src/main.rs b/hwd/src/main.rs index e71cbbf198..5b772af0a8 100644 --- a/hwd/src/main.rs +++ b/hwd/src/main.rs @@ -6,8 +6,8 @@ fn main() { "misc", "hwd", "hwd", - log::LevelFilter::Debug, - log::LevelFilter::Debug, + log::LevelFilter::Warn, + log::LevelFilter::Info, ); // Prefer DTB if available (matches kernel preference) diff --git a/input/ps2d/src/main.rs b/input/ps2d/src/main.rs index 3a8922bbe4..9aad438168 100644 --- a/input/ps2d/src/main.rs +++ b/input/ps2d/src/main.rs @@ -30,7 +30,7 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! { "misc", "ps2", "ps2", - log::LevelFilter::Info, + log::LevelFilter::Warn, log::LevelFilter::Info, ); diff --git a/input/usbhidd/src/main.rs b/input/usbhidd/src/main.rs index 4cef9c7c6e..9da7803011 100644 --- a/input/usbhidd/src/main.rs +++ b/input/usbhidd/src/main.rs @@ -188,7 +188,7 @@ fn main() { "usb", "device", &name, - log::LevelFilter::Info, + log::LevelFilter::Warn, log::LevelFilter::Info, ); diff --git a/inputd/src/main.rs b/inputd/src/main.rs index 6853a5769a..863c2a226a 100644 --- a/inputd/src/main.rs +++ b/inputd/src/main.rs @@ -576,8 +576,8 @@ fn main() { "misc", "inputd", "inputd", + log::LevelFilter::Warn, log::LevelFilter::Info, - log::LevelFilter::Debug, ); let mut args = std::env::args().skip(1); diff --git a/net/rtl8139d/src/main.rs b/net/rtl8139d/src/main.rs index 03fd17dd52..5be7ba6452 100644 --- a/net/rtl8139d/src/main.rs +++ b/net/rtl8139d/src/main.rs @@ -113,7 +113,7 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! { "net", "pci", &name, - log::LevelFilter::Info, + log::LevelFilter::Warn, log::LevelFilter::Info, ); diff --git a/net/rtl8168d/src/main.rs b/net/rtl8168d/src/main.rs index 59c25ba985..243cb43b2a 100644 --- a/net/rtl8168d/src/main.rs +++ b/net/rtl8168d/src/main.rs @@ -113,7 +113,7 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! { "net", "pci", &name, - log::LevelFilter::Info, + log::LevelFilter::Warn, log::LevelFilter::Info, ); diff --git a/net/virtio-netd/src/main.rs b/net/virtio-netd/src/main.rs index c0231618f7..d9d9e3d602 100644 --- a/net/virtio-netd/src/main.rs +++ b/net/virtio-netd/src/main.rs @@ -124,8 +124,8 @@ pub fn main() { "net", "pci", "virtio-netd", - log::LevelFilter::Trace, - log::LevelFilter::Trace, + log::LevelFilter::Warn, + log::LevelFilter::Info, ); redox_daemon::Daemon::new(daemon_runner).expect("virtio-core: failed to daemonize"); } diff --git a/pcid-spawner/src/main.rs b/pcid-spawner/src/main.rs index e99ce2e320..ecdcda1d6d 100644 --- a/pcid-spawner/src/main.rs +++ b/pcid-spawner/src/main.rs @@ -16,8 +16,8 @@ fn main() -> Result<()> { "bus", "pci", "pci-spawner.log", + log::LevelFilter::Warn, log::LevelFilter::Info, - log::LevelFilter::Trace, ); let config_data = if fs::metadata(&config_path)?.is_file() { diff --git a/pcid/src/main.rs b/pcid/src/main.rs index c06e583c63..3102cdbbbb 100644 --- a/pcid/src/main.rs +++ b/pcid/src/main.rs @@ -191,12 +191,13 @@ fn main() { let mut args = pico_args::Arguments::from_env(); let verbosity = (0..).find(|_| !args.contains("-v")).unwrap_or(0); let log_level = match verbosity { - 0 => log::LevelFilter::Info, - 1 => log::LevelFilter::Debug, + 0 => log::LevelFilter::Warn, + 1 => log::LevelFilter::Info, + 2 => log::LevelFilter::Debug, _ => log::LevelFilter::Trace, }; - common::setup_logging("bus", "pci", "pcid", log_level, log::LevelFilter::Trace); + common::setup_logging("bus", "pci", "pcid", log_level, log::LevelFilter::Info); redox_daemon::Daemon::new(move |daemon| main_inner(daemon)).unwrap(); } diff --git a/storage/ahcid/src/main.rs b/storage/ahcid/src/main.rs index 3df8947f73..dd8a06319c 100644 --- a/storage/ahcid/src/main.rs +++ b/storage/ahcid/src/main.rs @@ -33,7 +33,7 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! { "disk", "pci", &name, - log::LevelFilter::Info, + log::LevelFilter::Warn, log::LevelFilter::Info, ); diff --git a/storage/ided/src/main.rs b/storage/ided/src/main.rs index 45592aedf6..0bab7a4ed8 100644 --- a/storage/ided/src/main.rs +++ b/storage/ided/src/main.rs @@ -33,7 +33,7 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! { "disk", "pci", &name, - log::LevelFilter::Info, + log::LevelFilter::Warn, log::LevelFilter::Info, ); diff --git a/storage/lived/src/main.rs b/storage/lived/src/main.rs index eadc62965e..eadc3a5c89 100644 --- a/storage/lived/src/main.rs +++ b/storage/lived/src/main.rs @@ -24,36 +24,7 @@ struct LiveDisk { } impl LiveDisk { - fn new() -> anyhow::Result { - let mut phys = 0; - let mut size = 0; - - // TODO: handle error - for line in std::fs::read_to_string("/scheme/sys/env") - .context("failed to read env")? - .lines() - { - let mut parts = line.splitn(2, '='); - let name = parts.next().unwrap_or(""); - let value = parts.next().unwrap_or(""); - - if name == "DISK_LIVE_ADDR" { - phys = usize::from_str_radix(value, 16).unwrap_or(0); - } - - if name == "DISK_LIVE_SIZE" { - size = usize::from_str_radix(value, 16).unwrap_or(0); - } - } - - if phys == 0 || size == 0 { - bail!( - "either livedisk phys ({}) or size ({}) was zero", - phys, - size - ); - } - + fn new(phys: usize, size: usize) -> anyhow::Result { let start = phys.div_floor(PAGE_SIZE) * PAGE_SIZE; let end = phys .checked_add(size) @@ -133,6 +104,32 @@ impl Disk for LiveDisk { } fn main() -> anyhow::Result<()> { + let mut phys = 0; + let mut size = 0; + + // TODO: handle error + for line in std::fs::read_to_string("/scheme/sys/env") + .context("failed to read env")? + .lines() + { + let mut parts = line.splitn(2, '='); + let name = parts.next().unwrap_or(""); + let value = parts.next().unwrap_or(""); + + if name == "DISK_LIVE_ADDR" { + phys = usize::from_str_radix(value, 16).unwrap_or(0); + } + + if name == "DISK_LIVE_SIZE" { + size = usize::from_str_radix(value, 16).unwrap_or(0); + } + } + + if phys == 0 || size == 0 { + // No live disk data, no need to say anything or exit with error + std::process::exit(0); + } + redox_daemon::Daemon::new(move |daemon| { let event_queue = event::EventQueue::new().unwrap(); @@ -147,7 +144,7 @@ fn main() -> anyhow::Result<()> { "disk.live".to_owned(), BTreeMap::from([( 0, - LiveDisk::new().unwrap_or_else(|err| { + LiveDisk::new(phys, size).unwrap_or_else(|err| { eprintln!("failed to initialize livedisk scheme: {}", err); std::process::exit(1) }), diff --git a/storage/nvmed/src/main.rs b/storage/nvmed/src/main.rs index ca0802c406..7a3a44b616 100644 --- a/storage/nvmed/src/main.rs +++ b/storage/nvmed/src/main.rs @@ -156,7 +156,7 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! { "disk", "pci", &scheme_name, - log::LevelFilter::Info, + log::LevelFilter::Warn, log::LevelFilter::Info, ); diff --git a/storage/virtio-blkd/src/main.rs b/storage/virtio-blkd/src/main.rs index b27343dce9..609d42002a 100644 --- a/storage/virtio-blkd/src/main.rs +++ b/storage/virtio-blkd/src/main.rs @@ -35,8 +35,8 @@ pub fn main() -> anyhow::Result<()> { "disk", "pci", "virtio-blkd", - log::LevelFilter::Trace, - log::LevelFilter::Trace, + log::LevelFilter::Warn, + log::LevelFilter::Info, ); redox_daemon::Daemon::new(daemon_runner).expect("virtio-core: failed to daemonize"); } diff --git a/usb/usbhubd/src/main.rs b/usb/usbhubd/src/main.rs index 408b776a74..fa3c2ee784 100644 --- a/usb/usbhubd/src/main.rs +++ b/usb/usbhubd/src/main.rs @@ -35,7 +35,7 @@ fn main() { "usb", "device", &name, - log::LevelFilter::Info, + log::LevelFilter::Warn, log::LevelFilter::Info, ); diff --git a/usb/xhcid/src/main.rs b/usb/xhcid/src/main.rs index d85df737d9..b7d3e4d15d 100644 --- a/usb/xhcid/src/main.rs +++ b/usb/xhcid/src/main.rs @@ -134,7 +134,7 @@ fn daemon_with_context_size( "usb", "host", &name, - log::LevelFilter::Info, + log::LevelFilter::Warn, log::LevelFilter::Info, ); diff --git a/usb/xhcid/src/xhci/device_enumerator.rs b/usb/xhcid/src/xhci/device_enumerator.rs index a48900c226..547ba11905 100644 --- a/usb/xhcid/src/xhci/device_enumerator.rs +++ b/usb/xhcid/src/xhci/device_enumerator.rs @@ -35,7 +35,7 @@ impl DeviceEnumerator { let port_id = request.port_id; let port_array_index = port_id.root_hub_port_index(); - info!("Device Enumerator request for port {}", port_id); + debug!("Device Enumerator request for port {}", port_id); let (len, flags) = { let ports = self.hci.ports.lock().unwrap(); @@ -54,7 +54,7 @@ impl DeviceEnumerator { }; if flags.contains(PortFlags::CCS) { - info!( + debug!( "Received Device Connect Port Status Change Event with port flags {:?}", flags ); @@ -114,14 +114,14 @@ impl DeviceEnumerator { } Err(err) => { if err.errno == EAGAIN { - info!("Received a device connect notification for an already connected device. Ignoring...") + debug!("Received a device connect notification for an already connected device. Ignoring...") } else { warn!("processing of device attach request failed! Error: {}", err); } } } } else { - info!( + debug!( "Device Enumerator received Detach request on port {} which is in state {}", port_id, self.hci.get_pls(port_id) diff --git a/usb/xhcid/src/xhci/mod.rs b/usb/xhcid/src/xhci/mod.rs index aea7439397..14203a70f5 100644 --- a/usb/xhcid/src/xhci/mod.rs +++ b/usb/xhcid/src/xhci/mod.rs @@ -765,7 +765,7 @@ impl Xhci { pub async fn attach_device(&self, port_id: PortId) -> syscall::Result<()> { if self.port_states.contains_key(&port_id) { - println!("Already contains port {}", port_id); + debug!("Already contains port {}", port_id); return Err(syscall::Error::new(EAGAIN)); } @@ -798,7 +798,7 @@ impl Xhci { } }; - info!("Enabled port {}, which the xHC mapped to {}", port_id, slot); + debug!("Enabled port {}, which the xHC mapped to {}", port_id, slot); //TODO: get correct speed for child devices let protocol_speed = self @@ -895,7 +895,7 @@ impl Xhci { match child.try_wait() { Ok(status_opt) => match status_opt { Some(status) => { - info!( + debug!( "driver process {} for port {} exited with status {}", child.id(), port_id, @@ -904,7 +904,7 @@ impl Xhci { } None => { //TODO: kill harder - info!( + warn!( "driver process {} for port {} still running", child.id(), port_id @@ -912,7 +912,7 @@ impl Xhci { } }, Err(err) => { - info!( + warn!( "failed to wait for the driver process {} for port {}: {}", child.id(), port_id, @@ -934,16 +934,16 @@ impl Xhci { } if let Some(state) = self.port_states.remove(&port_id) { - info!("disabling port slot {} for port {}", state.slot, port_id); + debug!("disabling port slot {} for port {}", state.slot, port_id); let result = self.disable_port_slot(state.slot).await; - info!( + debug!( "disabled port slot {} for port {} with result: {:?}", state.slot, port_id, result ); result } else { - warn!( + debug!( "Attempted to detach from port {}, which wasn't previously attached.", port_id );