Page MenuHomeFreeBSD

ktls: Avoid wakeups and locking for synchronous callbacks
ClosedPublic

Authored by markj on Jan 16 2021, 6:59 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jul 12, 4:18 PM
Unknown Object (File)
Thu, Jul 3, 12:36 AM
Unknown Object (File)
Fri, Jun 20, 6:28 PM
Unknown Object (File)
Wed, Jun 18, 8:22 PM
Unknown Object (File)
Tue, Jun 17, 3:39 PM
Unknown Object (File)
Jun 13 2025, 1:25 PM
Unknown Object (File)
Jun 13 2025, 9:19 AM
Unknown Object (File)
Jun 12 2025, 9:17 AM
Subscribers

Details

Summary

The KTLS crypto callback always locks the session to deliver a wakeup.
But if we're handling the operation synchronously this is wasted effort.
On an Ampere server this results in a large amount of sleepqueue lock
contention. Use CRYPTO_SESS_SYNC() to determine whether the operation
will be completed asynchronously or not, and select a callback
appropriately.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 36274
Build 33163: arc lint + arc unit

Event Timeline

markj added reviewers: jhb, gallatin.
jhb added inline comments.
sys/opencrypto/ktls_ocf.c
141

These two statements can be moved up out of the loop.

This revision is now accepted and ready to land.Jan 19 2021, 7:48 PM
sys/opencrypto/ktls_ocf.c
141

I had written it that way originally, but I noticed that we handle EAGAIN (i.e., the crypto driver changed) by looping, in which case we should re-evaluate the flag. Does that not make sense for some reason?

sys/opencrypto/ktls_ocf.c
141

Oh, humm, ok. I think long term I want crypto_dispatch() to return EINPROGRESS when it doesn't complete the request synchronously, but this is fine for now.