Page MenuHomeFreeBSD

rpc.tlsservd: provide parallelism with help of pthread(3)
ClosedPublic

Authored by glebius on Mon, Jan 20, 9:14 PM.
Tags
None
Referenced Files
F109205420: D48570.diff
Sun, Feb 2, 1:16 AM
Unknown Object (File)
Fri, Jan 31, 6:17 PM
Unknown Object (File)
Fri, Jan 31, 2:08 AM
Unknown Object (File)
Mon, Jan 27, 2:40 PM
Unknown Object (File)
Sun, Jan 26, 7:41 PM
Unknown Object (File)
Sun, Jan 26, 7:41 PM
Unknown Object (File)
Sat, Jan 25, 8:39 AM
Unknown Object (File)
Thu, Jan 23, 5:30 PM
Subscribers

Details

Summary

At normal NFS server runtime there is not much RPC traffic from kernel to
rpc.tlsservd. But as Rick rmacklem@ explained, the notion of multiple
workers exists to handle a situation when a server reboots and it has
several hundred or thousands of TLS/TCP connections from clients. Once it
comes back up, all the clients make TCP connections and do TLS handshakes.

So cleanup the remnants of the workers, that left after the conversion of
RPC over netlink(4) transport and restore desired parallelism with help of
pthread(3).

We are processing the TLS handshakes in separate threads, one per
handshake. This is a minimal implementation: we aren't keeping a pool of
threads, neither pre-allocating them, nor limiting their count. This
should be sufficient to dynamically size thread count. This might be
redesigned later.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 61852
Build 58736: arc lint + arc unit

Event Timeline

Use pthread_detach() to avoid memory leak.

Limit number of concurrent threads for TLS handshakes. Reuse -N option
to override the default.

markj added inline comments.
usr.sbin/rpc.tlsservd/rpc.tlsservd.c
112
266

Why is this necessary?

268

pthread_join() to reclaim the thread?

376

Maybe set ctx = NULL here.

glebius added inline comments.
usr.sbin/rpc.tlsservd/rpc.tlsservd.c
266

The internal libc variable __isthreaded is 0 until you create your first thread. The new RPC svc_nl needs to see __isthreaded as 1 on initialization to allow future parallel calls into its send method.

Looks ok to me but I do not know pthreads.
Maybe markj@ can complete a review, since he
has already commented on the code?

Looks ok to me but I do not know pthreads.
Maybe markj@ can complete a review, since he
has already commented on the code?

If you don't mind, I'd like to push changes today. I will be online through the weekend and not disrupted by usual work & weekday stuff, so will be able to address any issues that may be discovered.

Looks ok to me but I do not know pthreads.
Maybe markj@ can complete a review, since he
has already commented on the code?

If you don't mind, I'd like to push changes today. I will be online through the weekend and not disrupted by usual work & weekday stuff, so will be able to address any issues that may be discovered.

I don't have a problem with this. Good luck with the pushes.

This revision was not accepted when it landed; it landed in state Needs Review.Sat, Feb 1, 9:04 AM
This revision was automatically updated to reflect the committed changes.