From d1692e9783f128341111493df7ec53439e8a0cf2 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Fri, 13 Mar 2026 00:22:22 -0700 Subject: [PATCH] Prevent busy-loop when tcmulib_processing_start fails When tcmulib_processing_start fails to read the UIO device, it logs an error but produces no commands. Without yielding, the event loop spins at 100% CPU, starving the master netlink loop and preventing new devices from being configured. Sleep 1ms when no commands are available to break the spin. Co-Authored-By: Claude Opus 4.6 --- src/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index f79eba79..8a37c19a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -293,10 +293,15 @@ class TCMUDevLoop { struct tcmulib_cmd *cmd; obd_dev *odev = (obd_dev *)tcmu_dev_get_private(dev); tcmulib_processing_start(dev); + bool got_cmd = false; while ((cmd = tcmulib_get_next_command(dev, 0)) != NULL) { + got_cmd = true; odev->inflight++; threadpool.thread_create(&handle, new handle_args{dev, cmd}); } + if (!got_cmd) { + photon::thread_usleep(1000); + } return 0; }