Skip to contentSkip to conversation

reboot-allow-to-specify-reboot-mode-via-sysfs.patch removed from -mm tree

merged [email protected] 1 participant 1 message Dec 16, 2020

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: reboot: allow to specify reboot mode via sysfs
has been removed from the -mm tree. Its filename was
reboot-allow-to-specify-reboot-mode-via-sysfs.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Matteo Croce <[email protected]>
Subject: reboot: allow to specify reboot mode via sysfs

The kernel cmdline reboot= option offers some sort of control on how the reboot is issued.

We don't always know in advance what type of reboot to perform.

Sometimes a warm reboot is preferred to persist certain memory regions across the reboot. Others a cold one is needed to apply a future system update that makes a memory memory model change, like changing the base page size or resizing a persistent memory region.

Or simply we want to enable reboot_force because we noticed that something bad happened.

Add handles in sysfs to allow setting these reboot options, so they can be changed when the system is booted, other than at boot time.

The handlers are under <sysfs>/kernel/reboot, can be read to get the current configuration and written to alter it.

	# cd /sys/kernel/reboot/
	# grep . *
	cpu:0
	force:0
	mode:cold
	type:acpi
	# echo 2 >cpu
	# echo yes >force
	# echo soft >mode
	# echo bios >type
	# grep . *
	cpu:2
	force:1
	mode:soft
	type:bios

Before setting anything, check for CAP_SYS_BOOT capability, so it's possible to allow an unpriviledged process to change these settings simply by relaxing the handles permissions, without opening them to the world.

---

 Documentation/ABI/testing/sysfs-kernel-reboot |   32 ++
 kernel/reboot.c                               |  206 ++++++++++++++++
 2 files changed, 238 insertions(+)
Documentation/ABI/testing/sysfs-kernel-reboot new file +32 -0
@@ -0,0 +1,32 @@
+What:		/sys/kernel/reboot
+Date:		November 2020
+KernelVersion:	5.11
+Contact:	Matteo Croce <[email protected]>
+Description:	Interface to set the kernel reboot behavior, similarly to
+		what can be done via the reboot= cmdline option.
+		(see Documentation/admin-guide/kernel-parameters.txt)
+
+What:		/sys/kernel/reboot/mode
+Date:		November 2020
+KernelVersion:	5.11
+Contact:	Matteo Croce <[email protected]>
+Description:	Reboot mode. Valid values are: cold warm hard soft gpio
+
+What:		/sys/kernel/reboot/type
+Date:		November 2020
+KernelVersion:	5.11
+Contact:	Matteo Croce <[email protected]>
+Description:	Reboot type. Valid values are: bios acpi kbd triple efi pci
+
+What:		/sys/kernel/reboot/cpu
+Date:		November 2020
+KernelVersion:	5.11
+Contact:	Matteo Croce <[email protected]>
+Description:	CPU number to use to reboot.
+
+What:		/sys/kernel/reboot/force
+Date:		November 2020
+KernelVersion:	5.11
+Contact:	Matteo Croce <[email protected]>
+Description:	Don't wait for any other CPUs on reboot and
+		avoid anything that could hang.
kernel/reboot.c renamed from kernel/reboot.c~reboot-allow-to-specify-reboot-mode-via-sysfs +206 -0

209 lines not on this page · raw message

_

Patches currently in -mm which might be from [email protected] are