Re: TCP and NET_MPSAFE

Jason Thorpe <[email protected]> Sat, 2 May 2026 08:46:52 -0700
Newsgroups gmane.os.netbsd.devel.network
Message-ID <[email protected]>
Hey Kevin - sorry, I was sitting on this email thinking about it, and =
finally had some spare brain cycles to really pay it some proper =
attention.

> On Apr 19, 2026, at 5:17=E2=80=AFPM, Kevin Bowling =
<[email protected]> wrote:
>=20
>> 2) TCP becomes fast enough that I can starve out SOFTINT_CLOCK on a
>> single core iperf3 -R on the ER4 system (requires driver improvements
>> I will publish later), and it is likely possible on other hardware
>> sizes.  The effects of this can be somewhat dire, for instance TCP
>> timers stop working, or if you are running a watchdog it won't get
>> poked in time.  This needs either a rethink of softint priority, or
>> moving some of the work out of softint to something the scheduler can
>> rotate.

I definitely agree that a re-think of the software interrupt priorities =
are in order.  It seems to me that the logical ordering should be more =
like:

    clock > net =3D=3D serial > bio

And that where should be another =E2=80=9Cgeneral=E2=80=9D (because =
=E2=80=9Cclock=E2=80=9D has served as =E2=80=9Cgeneral=E2=80=9D =
historically) at the bottom below bio (would hate for some random thing =
to get in the way of a page-in completion), so:

    clock > net =3D=3D serial > bio > gen

My logic for equating =E2=80=9Cnet=E2=80=9D and =E2=80=9Cserial=E2=80=9D =
goes a little something like this: today=E2=80=99s high-throughput =
network interfaces have tight performance constraints that might bump =
them above the servicing of UARTs, but there are cases where UARTs (or, =
serial line devices generally) are part of the networking stack, and =
putting the below networking in the priority order seems like an icky =
inversion.

If a platform really wanted to use hardware support as the scheduling =
trigger and had 2 hardware levels to throw at it, I would say:

    clock > net =3D=3D serial >=3D bio >=3D gen

I.e. clock always on top, net and serial always equal, and an =
opportunistic (or software-only) prioritization below that.  But I=E2=80=99=
m willing to be convinced otherwise if there=E2=80=99s a good argument =
for a different ordering.

-- thorpej