From ef3422320165031abbbc9431b134ca5345fdffa8 Mon Sep 17 00:00:00 2001 From: Red Bear OS Date: Sun, 19 Jul 2026 18:38:03 +0900 Subject: [PATCH] usbhubd: trace SetPortReset result + wait_for_reset boundaries (diagnostic) Log SetPortFeature(PORT_RESET) result, wait_for_reset's first fetch, and its completion/timeout outcomes at info level to pinpoint where hub port-reset polling stalls in QEMU. --- drivers/usb/usbhubd/src/main.rs | 9 ++++++--- drivers/usb/usbhubd/src/port_ops.rs | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/usb/usbhubd/src/main.rs b/drivers/usb/usbhubd/src/main.rs index 01d15cbbd5..e3775027c9 100644 --- a/drivers/usb/usbhubd/src/main.rs +++ b/drivers/usb/usbhubd/src/main.rs @@ -578,9 +578,12 @@ fn main() { // then 50ms TRSTRCY recovery and C_PORT_RESET clear. if !snap.enabled { log::info!("reset port {port}"); - if let Err(e) = set_feature(&handle, port, usb::HubPortFeature::PortReset) { - log::warn!("usbhubd: SetPortReset failed for port {}: {}", port, e); - continue; + match set_feature(&handle, port, usb::HubPortFeature::PortReset) { + Ok(()) => log::info!("HUBFLOW {port}: PortReset set ok"), + Err(e) => { + log::warn!("usbhubd: SetPortReset failed for port {}: {}", port, e); + continue; + } } state.ensure_attached(false); if let Err(e) = port_ops::wait_for_reset( diff --git a/drivers/usb/usbhubd/src/port_ops.rs b/drivers/usb/usbhubd/src/port_ops.rs index 4197194a53..db761d26e1 100644 --- a/drivers/usb/usbhubd/src/port_ops.rs +++ b/drivers/usb/usbhubd/src/port_ops.rs @@ -183,18 +183,21 @@ pub fn wait_for_reset( let mut delay = HUB_SHORT_RESET_TIME_MS; let mut cur = fetch().map_err(WaitError::Io)?; + log::info!("HUBFLOW wait_for_reset: first fetch resetting={} connected={}", cur.resetting, cur.connected); loop { if !cur.resetting && cur.connected { sleep(RESET_RECOVERY_TIME_MS); if cur.reset_changed { clear_reset_change().map_err(WaitError::Io)?; } + log::info!("HUBFLOW wait_for_reset: complete after {}ms", total_ms); return Ok(cur); } if !cur.connected { return Err(WaitError::Disconnected); } if total_ms >= HUB_RESET_TIMEOUT_MS { + log::info!("HUBFLOW wait_for_reset: timeout, still resetting={}", cur.resetting); return Err(WaitError::Timeout); } sleep(delay);