Skip to contentSkip to conversation

w1: add a scheduling point to the slave search

PATCH Applied Imre Kaloz 2 participants 2 messages Oct 13 – Nov 2 W1 dallas's 1-wire bus

lore
Share & tools
lore

Imre Kaloz

author
#0 lore raw

PATCH 1/1 w1: add a scheduling point to the slave search

sgi_w1 busy-waits through each time slot and has no triplet operation, so one 64-bit search pass holds the CPU for more than 20 ms. Without full preemption that delays every task woken meanwhile on a single CPU, enough to underrun an audio ring while the bus is searched.

Call cond_resched() once per triplet.

---
 drivers/w1/w1.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/w1/w1.c +3 -0
index c16946642789..6f6651e44c42 100644
@@ -1055,6 +1055,9 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
 				dev_dbg(&dev->dev, "Abort w1_search\n");
 				return;
 			}
+
+			/* Busy-waiting masters can hold the CPU for a whole pass */
+			cond_resched();
 		}
 		mutex_unlock(&dev->bus_mutex);
 

base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907

Signature · 1 line
2.47.3
maintainer Applied
#1 lore raw
Quoted 8 lines · Imre Kaloz

sgi_w1 busy-waits through each time slot and has no triplet operation, so one 64-bit search pass holds the CPU for more than 20 ms. Without full preemption that delays every task woken meanwhile on a single CPU, enough to underrun an audio ring while the bus is searched.

Call cond_resched() once per triplet.

[...]

Applied, thanks!

[1/1] w1: add a scheduling point to the slave search

      https://git.kernel.org/krzk/linux-w1/c/3ade61837e8e61420e37edb818abc9a6199fec6a

Best regards,

Signature · 1 line
Krzysztof Kozlowski <[email protected]>