Skip to content

softnpu: Don't hold pipeline mutex across a blocking operation - #1201

Closed
sion42x wants to merge 1 commit into
masterfrom
softnpu-perf-main
Closed

softnpu: Don't hold pipeline mutex across a blocking operation#1201
sion42x wants to merge 1 commit into
masterfrom
softnpu-perf-main

Conversation

@sion42x

@sion42x sion42x commented Aug 27, 2026

Copy link
Copy Markdown

Each softnpu port has an ingress that held a lock through multiple stages, and since sending is a syscall the lock holder was descheduled inside the critical section on every forwarded packet. This resulted in every waiting port thread to go to sleep and every packet handoff to go through a scheduler wakeup, which in turn results in a 6.6k pps rate on the whole switch.

On a voxel test, the emulated fabric topped out at 6.2k pps with a cross-sled TCP throughput of 100-340KB/s (loopback is 118MB/s on the same endpoint).

This change scopes the lock to process_packet and forwards it after it drops on both external and guest paths, and the management handler stops holding the lock while writing replies over UART. Single flow throughput go from 0.1-0.34 -> 5 MB/s, and retransmits droped from 346% -> 29% of transmitted bytes. Per flow ordering remains unchanged.

On the external ingress path, the lock will only cover `process_packet`.
A syscall inside the critical section descheduled the holder and every
packet has wait during scheduler wakeup.
@sion42x
sion42x requested a review from zeeshanlakhani August 27, 2026 01:54
@sion42x

sion42x commented Aug 27, 2026

Copy link
Copy Markdown
Author

@zeeshanlakhani I'd appreciate your take on this. The change in performance was dramatic. While I agree with the TODO that we shouldn't be using a mutex at all, this is a good half measure whilst I work on a possible solution there.

@sion42x

sion42x commented Aug 28, 2026

Copy link
Copy Markdown
Author

Closed for now with the changes made by Ry for #1204

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant