From 2ab4726cc2808f1c9e8acac5120ae7be6a090ebb Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 4 May 2020 18:35:12 -0600 Subject: send: cond_resched() when processing tx ringbuffers Users with pathological hardware reported CPU stalls on CONFIG_ PREEMPT_VOLUNTARY=y, because the ringbuffers would stay full, meaning these workers would never terminate. That turned out not to be okay on systems without forced preemption. This commit adds a cond_resched() to the bottom of each loop iteration, so that these workers don't hog the core. We don't do this on encryption/decryption because the compat module here uses simd_relax, which already includes a call to schedule in preempt_enable. Signed-off-by: Jason A. Donenfeld --- src/send.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/send.c b/src/send.c index 9290bb9..e6e89ad 100644 --- a/src/send.c +++ b/src/send.c @@ -284,6 +284,8 @@ void wg_packet_tx_worker(struct work_struct *work) wg_noise_keypair_put(keypair, false); wg_peer_put(peer); + if (need_resched()) + cond_resched(); } } -- cgit v1.2.3-59-g8ed1b