Page MenuHomeFreeBSD

bhyve/tpm: create crb thread for sending tpm commands
ClosedPublic

Authored by corvink on Jun 7 2023, 12:05 PM.
Tags
None
Referenced Files
F125976225: D40458.id123409.diff
Wed, Aug 13, 8:56 PM
F125944926: D40458.id123479.diff
Wed, Aug 13, 2:01 PM
Unknown Object (File)
Sat, Aug 9, 5:57 PM
Unknown Object (File)
Sun, Aug 3, 4:13 AM
Unknown Object (File)
Sun, Aug 3, 1:36 AM
Unknown Object (File)
Sat, Aug 2, 8:57 PM
Unknown Object (File)
Tue, Jul 29, 6:04 AM
Unknown Object (File)
Tue, Jul 22, 7:16 AM
Subscribers

Details

Summary

Commands send to a tpm are very slow. They can take up to several
seconds for completion. For that reason, create a thread which issues
the commands to the tpm device.

Diff Detail

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

Event Timeline

usr.sbin/bhyve/tpm_intf_crb.c
214
296

The mutex and condvar don't get destroyed anywhere.

310

Why not just write pthread_set_name_np(crb->thread, "tpm_intf_crb");?

331

Don't you need to wake up the thread here?

  • destroy cond and mutex
  • wakeup thread on destroy
markj added inline comments.
usr.sbin/bhyve/tpm_intf_crb.c
292

warn/warnx/warc/err/errx/errc always append a newline.

292

pthread_* returns an error number upon failure, so you can get a better error message with warnc(error, "%s: failed to init mutex", __func__);. Same below.

This revision is now accepted and ready to land.Jun 19 2023, 7:36 PM