Page MenuHomeFreeBSD

efirt: When present, attempt to use EFI runtime services to shutdown
ClosedPublic

Authored by cem on Dec 11 2018, 2:23 AM.
Tags
None
Referenced Files
F105769904: D18506.id51885.diff
Fri, Dec 20, 11:02 AM
Unknown Object (File)
Sun, Dec 15, 5:37 PM
Unknown Object (File)
Wed, Dec 11, 1:32 PM
Unknown Object (File)
Fri, Dec 6, 9:20 PM
Unknown Object (File)
Thu, Nov 21, 11:34 PM
Unknown Object (File)
Nov 19 2024, 1:35 AM
Unknown Object (File)
Nov 18 2024, 12:11 PM
Unknown Object (File)
Nov 13 2024, 12:56 PM
Subscribers
None

Details

Summary

Submitted by: byuu <byuu AT tutanota.com> (previous version)

Test Plan

Unlike byuu's original submission, I left efi_reset_system(void) alone for two
reasons:

  • Potential out of tree consumers (maybe Netflix?)
  • Laziness: Changing the signature requires updating efirt.9

I would be happy to switch efi_reset_system() to the enum-taking variety if
that seems better.

I made the efi_poweroff knob the default setting on EFIRT-enabled systems, but
do not feel strongly about it. We could make it off by default if you prefer.

We could similarly handle RB_REBOOT / whatever shutdown_final events with
"rt_reset" calls. Again, if you feel strongly about it, I can add that
support. I am considering adding the same functionality to the IPMI
shutdown_final event handler anyway -- we use a different IPMI reset mode than
the one in FreeBSD base tree at ISLN.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 21486
Build 20801: arc lint + arc unit

Event Timeline

Netflix doesn't use efi_system_reset() in our version of FreeBSD. Changing the signature is likely fine.

sys/dev/efidev/efirt.c
115

Small quibble.
s/shutdown/power off/
I think that we should use the most specific term here.

458

We (NFLX) don't do anything out of tree with this.

sys/sys/efi.h
45

as there's more than 2, maybe having explicit values would be good. Maybe they should have been explicit all the time.

cem planned changes to this revision.Dec 11 2018, 7:58 AM
cem marked 2 inline comments as done.

Netflix doesn't use efi_system_reset() in our version of FreeBSD. Changing the signature is likely fine.

Ok, works for me.

sys/dev/efidev/efirt.c
115

Will fix

sys/sys/efi.h
45

I'm happy to make them explicit if you'd prefer that. They are just 0, 1, 2.

cem marked 3 inline comments as done.
  • Use explicit terminology in sysctl text.
  • Change type of efi_reset_system(9), and document in efirt.9 (which needs cleanup, but that will be left for future work).
  • Explicitly define enum efi_reset values.

efirt is unloadable; be sure to unregister our eventhandler if the module is unloaded.

This revision is now accepted and ready to land.Dec 14 2018, 7:29 PM
This revision was automatically updated to reflect the committed changes.