Page MenuHomeFreeBSD

linuxkpi: Add orderly_poweroff
ClosedPublic

Authored by manu on Feb 15 2022, 11:11 AM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 2 2024, 12:12 AM
Unknown Object (File)
Sep 30 2024, 10:10 AM
Unknown Object (File)
Sep 27 2024, 9:06 AM
Unknown Object (File)
Sep 27 2024, 8:21 AM
Unknown Object (File)
Sep 26 2024, 4:06 PM
Unknown Object (File)
Sep 26 2024, 8:48 AM
Unknown Object (File)
Sep 25 2024, 5:50 PM
Unknown Object (File)
Sep 25 2024, 9:09 AM
Subscribers

Details

Summary

This simply poweroff the system.
Needed by drm-kmod v5.8

MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

manu requested review of this revision.Feb 15 2022, 11:11 AM
bz added inline comments.
sys/compat/linuxkpi/common/include/linux/reboot.h
27

I thought things got harmonized onto one "_".

40

Do you actually need anything but RB_POWEROFF for these two as shutdown_nice_task_fn will not look at the others if that is set. And if you run into kern_reboot RB_NOSYNC gets set (but unlikely you'd run into that from here given that requires no init running).

Remove RB_HALT (not needed).
Remove one _ in header guard.

manu marked 2 inline comments as done.Feb 16 2022, 8:51 AM
manu added inline comments.
sys/compat/linuxkpi/common/include/linux/reboot.h
40

RB_NOSYNC is needed in that case so we don't call bufshutdown

sys/compat/linuxkpi/common/include/linux/reboot.h
40

RB_NOSYNC is needed in that case so we don't call bufshutdown

{{{

340 /*
341  * Called by events that want to shut down.. e.g  <CTL><ALT><DEL> on a PC
342  */
343 void
344 shutdown_nice(int howto)
345 {
346
347         if (initproc != NULL && !SCHEDULER_STOPPED()) {
348                 shutdown_nice_task.ta_context = (void *)(uintptr_t)howto;
349                 taskqueue_enqueue(taskqueue_fast, &shutdown_nice_task);
350         } else {
351                 /*
352                  * No init(8) running, or scheduler would not allow it
353                  * to run, so simply reboot.
354                  */
355                 kern_reboot(howto | RB_NOSYNC);
356         }
357 }

}}}

The first runs shutdown_nice_task_fn which then calls kern_psignal() depending on howto but doesn't pass it on.
The latter does add RB_NOSYNC itself.

manu marked an inline comment as done.Feb 16 2022, 9:53 AM
manu added inline comments.
sys/compat/linuxkpi/common/include/linux/reboot.h
40

Ah yes indeed, I've missed that howto isn't passed on.
Will update and make this a single call to shutdown_nice then.

Remove RB_NOSYNC as it's not passed on.

This revision is now accepted and ready to land.Feb 16 2022, 12:02 PM
This revision was automatically updated to reflect the committed changes.