<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/kernel/reboot.c, branch v5.15.19</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.15.19</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.15.19'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2021-06-21T12:08:36Z</updated>
<entry>
<title>reboot: Add hardware protection power-off</title>
<updated>2021-06-21T12:08:36Z</updated>
<author>
<name>Matti Vaittinen</name>
<email>matti.vaittinen@fi.rohmeurope.com</email>
</author>
<published>2021-06-03T05:40:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=dfa19b11385d4cf8f0242fd93e2073e25183c331'/>
<id>urn:sha1:dfa19b11385d4cf8f0242fd93e2073e25183c331</id>
<content type='text'>
There can be few cases when we need to shut-down the system in order to
protect the hardware. Currently this is done at least by the thermal core
when temperature raises over certain limit.

Some PMICs can also generate interrupts for example for over-current or
over-voltage, voltage drops, short-circuit, ... etc. On some systems
these are a sign of hardware failure and only thing to do is try to
protect the rest of the hardware by shutting down the system.

Add shut-down logic which can be used by all subsystems instead of
implementing the shutdown in each subsystem. The logic is stolen from
thermal_core with difference of using atomic_t instead of a mutex in
order to allow calls directly from IRQ context and changing the WARN()
to pr_emerg() as discussed here:
https://lore.kernel.org/lkml/YJuPwAZroVZ%2Fw633@alley/
and here:
https://lore.kernel.org/linux-iommu/20210331093104.383705-4-geert+renesas@glider.be/

Signed-off-by: Matti Vaittinen &lt;matti.vaittinen@fi.rohmeurope.com&gt;
Acked-by: Daniel Lezcano &lt;daniel.lezcano@linaro.org&gt;
Link: https://lore.kernel.org/r/e83ec1ca9408f90c857ea9dcdc57b14d9037b03f.1622628333.git.matti.vaittinen@fi.rohmeurope.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>Revert "PM: ACPI: reboot: Use S5 for reboot"</title>
<updated>2021-03-18T15:58:02Z</updated>
<author>
<name>Josef Bacik</name>
<email>josef@toxicpanda.com</email>
</author>
<published>2021-03-17T02:17:48Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=9d3fcb28f9b9750b474811a2964ce022df56336e'/>
<id>urn:sha1:9d3fcb28f9b9750b474811a2964ce022df56336e</id>
<content type='text'>
This reverts commit d60cd06331a3566d3305b3c7b566e79edf4e2095.

This patch causes a panic when rebooting my Dell Poweredge r440.  I do
not have the full panic log as it's lost at that stage of the reboot and
I do not have a serial console.  Reverting this patch makes my system
able to reboot again.

Signed-off-by: Josef Bacik &lt;josef@toxicpanda.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>reboot: hide from sysfs not applicable settings</title>
<updated>2020-12-16T06:46:19Z</updated>
<author>
<name>Matteo Croce</name>
<email>mcroce@microsoft.com</email>
</author>
<published>2020-12-16T04:47:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=40247e55ba099067bf160332365ed78b5aeb62da'/>
<id>urn:sha1:40247e55ba099067bf160332365ed78b5aeb62da</id>
<content type='text'>
Not all the reboot settings from both the kernel command line or sysfs
interface are available to all platforms.

Filter out reboot_type and reboot_force which are x86 only, and also
remove reboot_cpu on kernels without SMP support.

This saves some space, and avoid confusing the user with settings which
will have no effect.

Link: https://lkml.kernel.org/r/20201130173717.198952-3-mcroce@linux.microsoft.com
Signed-off-by: Matteo Croce &lt;mcroce@microsoft.com&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>reboot: allow to override reboot type if quirks are found</title>
<updated>2020-12-16T06:46:19Z</updated>
<author>
<name>Matteo Croce</name>
<email>mcroce@microsoft.com</email>
</author>
<published>2020-12-16T04:47:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1a9d079f43e3215b81ec13d427950093b8f04c70'/>
<id>urn:sha1:1a9d079f43e3215b81ec13d427950093b8f04c70</id>
<content type='text'>
Patch series "reboot: sysfs improvements".

Some improvements to the sysfs reboot interface: hide not working settings
and support machines with known reboot quirks.

This patch (of 2):

On some machines a quirk can force a specific reboot type.  Quirks are
found during a DMI scan, the list of machines which need special reboot
handling is defined in reboot_dmi_table.

The kernel command line reboot= option overrides this via a global
variable `reboot_default`, so that the reboot type requested in the
command line is really performed.

This was not true when setting the reboot type via the new sysfs
interface.  Fix this by setting reboot_default upon the first change, like
reboot_setup() does for the command line.

Link: https://lkml.kernel.org/r/20201130173717.198952-1-mcroce@linux.microsoft.com
Link: https://lkml.kernel.org/r/20201130173717.198952-2-mcroce@linux.microsoft.com
Signed-off-by: Matteo Croce &lt;mcroce@microsoft.com&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>reboot: remove cf9_safe from allowed types and rename cf9_force</title>
<updated>2020-12-16T06:46:19Z</updated>
<author>
<name>Matteo Croce</name>
<email>mcroce@microsoft.com</email>
</author>
<published>2020-12-16T04:47:00Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0c5c0179e2cddb0d1c52ba1487f9f9e77714c8af'/>
<id>urn:sha1:0c5c0179e2cddb0d1c52ba1487f9f9e77714c8af</id>
<content type='text'>
BOOT_CF9_SAFE_STR is an internal value used only by the x86 code and it's
not possible to set it from userspace.

Remove it, and rename 'cf9_force' to 'pci', so to make it coherent with
the kernel command line reboot= option.

Tested with this script:

	cd /sys/kernel/reboot/

	for i in cold warm hard soft gpio; do
		echo $i &gt;mode
		read j &lt;mode
		[ $i = $j ] || echo "mode $i != $j"
	done

	for i in bios acpi kbd triple efi pci; do
		echo $i &gt;type
		read j &lt;type
		[ $i = $j ] || echo "type $i != $j"
	done

	for i in $(seq 0 $(nproc --ignore=1)); do
		echo $i &gt;cpu
		read j &lt;cpu
		[ $i = $j ] || echo "cpu $i != $j"
	done

	for i in 0 1; do
		echo $i &gt;force
		read j &lt;force
		[ $i = $j ] || echo "force $i != $j"
	done

Link: https://lkml.kernel.org/r/20201113015900.543923-1-mcroce@linux.microsoft.com
Fixes: eab8da48579d ("reboot: allow to specify reboot mode via sysfs")
Signed-off-by: Matteo Croce &lt;mcroce@microsoft.com&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Guenter Roeck &lt;linux@roeck-us.net&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Mike Rapoport &lt;rppt@kernel.org&gt;
Cc: Nathan Chancellor &lt;natechancellor@gmail.com&gt;
Cc: Pavel Tatashin &lt;pasha.tatashin@soleen.com&gt;
Cc: Petr Mladek &lt;pmladek@suse.com&gt;
Cc: Tyler Hicks &lt;tyhicks@linux.microsoft.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>reboot: allow to specify reboot mode via sysfs</title>
<updated>2020-12-16T06:46:19Z</updated>
<author>
<name>Matteo Croce</name>
<email>mcroce@microsoft.com</email>
</author>
<published>2020-12-16T04:46:57Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=2c622ed0eaa38b68d7440bedb8c6cdd138b5a860'/>
<id>urn:sha1:2c622ed0eaa38b68d7440bedb8c6cdd138b5a860</id>
<content type='text'>
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 &lt;sysfs&gt;/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 &gt;cpu
	# echo yes &gt;force
	# echo soft &gt;mode
	# echo bios &gt;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.

[natechancellor@gmail.com: fix variable assignments in type_store]
  Link: https://lkml.kernel.org/r/20201112035023.974748-1-natechancellor@gmail.com
  Link: https://github.com/ClangBuiltLinux/linux/issues/1197

Link: https://lkml.kernel.org/r/20201110202746.9690-1-mcroce@linux.microsoft.com
Signed-off-by: Matteo Croce &lt;mcroce@microsoft.com&gt;
Signed-off-by: Nathan Chancellor &lt;natechancellor@gmail.com&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Cc: Mike Rapoport &lt;rppt@kernel.org&gt;
Cc: Guenter Roeck &lt;linux@roeck-us.net&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Pavel Tatashin &lt;pasha.tatashin@soleen.com&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Tyler Hicks &lt;tyhicks@linux.microsoft.com&gt;
Cc: Nathan Chancellor &lt;natechancellor@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>reboot: refactor and comment the cpu selection code</title>
<updated>2020-12-16T06:46:19Z</updated>
<author>
<name>Matteo Croce</name>
<email>mcroce@microsoft.com</email>
</author>
<published>2020-12-16T04:46:53Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f9a90501faac55ddbea93c1f73497857f1997227'/>
<id>urn:sha1:f9a90501faac55ddbea93c1f73497857f1997227</id>
<content type='text'>
Small improvements to the code, without changing the way it works:

 - use a local variable, to avoid a small time lapse where reboot_cpu
   can have an invalid value

 - comment the code which is not easy to understand at a glance

 - merge two identical code blocks into one

 - replace pointer arithmetics with equivalent array syntax

Link: https://lkml.kernel.org/r/20201103214025.116799-4-mcroce@linux.microsoft.com
Signed-off-by: Matteo Croce &lt;mcroce@microsoft.com&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Fabian Frederick &lt;fabf@skynet.be&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Guenter Roeck &lt;linux@roeck-us.net&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Mike Rapoport &lt;rppt@kernel.org&gt;
Cc: Pavel Tatashin &lt;pasha.tatashin@soleen.com&gt;
Cc: Petr Mladek &lt;pmladek@suse.com&gt;
Cc: Robin Holt &lt;robinmholt@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Merge branches 'pm-sleep', 'pm-acpi', 'pm-domains' and 'powercap'</title>
<updated>2020-12-15T14:26:14Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2020-12-15T14:26:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=42b4ca04cbfde952e7be132ffc7226890323bbe1'/>
<id>urn:sha1:42b4ca04cbfde952e7be132ffc7226890323bbe1</id>
<content type='text'>
* pm-sleep:
  PM: sleep: Add dev_wakeup_path() helper
  PM / suspend: fix kernel-doc markup
  PM: sleep: Print driver flags for all devices during suspend/resume

* pm-acpi:
  PM: ACPI: Refresh wakeup device power configuration every time
  PM: ACPI: PCI: Drop acpi_pm_set_bridge_wakeup()
  PM: ACPI: reboot: Use S5 for reboot

* pm-domains:
  PM: domains: create debugfs nodes when adding power domains
  PM: domains: replace -ENOTSUPP with -EOPNOTSUPP

* powercap:
  powercap: Adjust printing the constraint name with new line
  powercap: RAPL: Add AMD Fam19h RAPL support
  powercap: Add AMD Fam17h RAPL support
  powercap/intel_rapl_msr: Convert rapl_msr_priv into pointer
  x86/msr-index: sort AMD RAPL MSRs by address
</content>
</entry>
<entry>
<title>reboot: fix overflow parsing reboot cpu number</title>
<updated>2020-11-14T19:26:03Z</updated>
<author>
<name>Matteo Croce</name>
<email>mcroce@microsoft.com</email>
</author>
<published>2020-11-14T06:52:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=df5b0ab3e08a156701b537809914b339b0daa526'/>
<id>urn:sha1:df5b0ab3e08a156701b537809914b339b0daa526</id>
<content type='text'>
Limit the CPU number to num_possible_cpus(), because setting it to a
value lower than INT_MAX but higher than NR_CPUS produces the following
error on reboot and shutdown:

    BUG: unable to handle page fault for address: ffffffff90ab1bb0
    #PF: supervisor read access in kernel mode
    #PF: error_code(0x0000) - not-present page
    PGD 1c09067 P4D 1c09067 PUD 1c0a063 PMD 0
    Oops: 0000 [#1] SMP
    CPU: 1 PID: 1 Comm: systemd-shutdow Not tainted 5.9.0-rc8-kvm #110
    Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-2.fc32 04/01/2014
    RIP: 0010:migrate_to_reboot_cpu+0xe/0x60
    Code: ea ea 00 48 89 fa 48 c7 c7 30 57 f1 81 e9 fa ef ff ff 66 2e 0f 1f 84 00 00 00 00 00 53 8b 1d d5 ea ea 00 e8 14 33 fe ff 89 da &lt;48&gt; 0f a3 15 ea fc bd 00 48 89 d0 73 29 89 c2 c1 e8 06 65 48 8b 3c
    RSP: 0018:ffffc90000013e08 EFLAGS: 00010246
    RAX: ffff88801f0a0000 RBX: 0000000077359400 RCX: 0000000000000000
    RDX: 0000000077359400 RSI: 0000000000000002 RDI: ffffffff81c199e0
    RBP: ffffffff81c1e3c0 R08: ffff88801f41f000 R09: ffffffff81c1e348
    R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
    R13: 00007f32bedf8830 R14: 00000000fee1dead R15: 0000000000000000
    FS:  00007f32bedf8980(0000) GS:ffff88801f480000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: ffffffff90ab1bb0 CR3: 000000001d057000 CR4: 00000000000006a0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
      __do_sys_reboot.cold+0x34/0x5b
      do_syscall_64+0x2d/0x40

Fixes: 1b3a5d02ee07 ("reboot: move arch/x86 reboot= handling to generic kernel")
Signed-off-by: Matteo Croce &lt;mcroce@microsoft.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Fabian Frederick &lt;fabf@skynet.be&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Guenter Roeck &lt;linux@roeck-us.net&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Mike Rapoport &lt;rppt@kernel.org&gt;
Cc: Pavel Tatashin &lt;pasha.tatashin@soleen.com&gt;
Cc: Petr Mladek &lt;pmladek@suse.com&gt;
Cc: Robin Holt &lt;robinmholt@gmail.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Link: https://lkml.kernel.org/r/20201103214025.116799-3-mcroce@linux.microsoft.com
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "kernel/reboot.c: convert simple_strtoul to kstrtoint"</title>
<updated>2020-11-14T19:26:03Z</updated>
<author>
<name>Matteo Croce</name>
<email>mcroce@microsoft.com</email>
</author>
<published>2020-11-14T06:52:02Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8b92c4ff4423aa9900cf838d3294fcade4dbda35'/>
<id>urn:sha1:8b92c4ff4423aa9900cf838d3294fcade4dbda35</id>
<content type='text'>
Patch series "fix parsing of reboot= cmdline", v3.

The parsing of the reboot= cmdline has two major errors:

 - a missing bound check can crash the system on reboot

 - parsing of the cpu number only works if specified last

Fix both.

This patch (of 2):

This reverts commit 616feab753972b97.

kstrtoint() and simple_strtoul() have a subtle difference which makes
them non interchangeable: if a non digit character is found amid the
parsing, the former will return an error, while the latter will just
stop parsing, e.g.  simple_strtoul("123xyx") = 123.

The kernel cmdline reboot= argument allows to specify the CPU used for
rebooting, with the syntax `s####` among the other flags, e.g.
"reboot=warm,s31,force", so if this flag is not the last given, it's
silently ignored as well as the subsequent ones.

Fixes: 616feab75397 ("kernel/reboot.c: convert simple_strtoul to kstrtoint")
Signed-off-by: Matteo Croce &lt;mcroce@microsoft.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Guenter Roeck &lt;linux@roeck-us.net&gt;
Cc: Petr Mladek &lt;pmladek@suse.com&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Mike Rapoport &lt;rppt@kernel.org&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Pavel Tatashin &lt;pasha.tatashin@soleen.com&gt;
Cc: Robin Holt &lt;robinmholt@gmail.com&gt;
Cc: Fabian Frederick &lt;fabf@skynet.be&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Link: https://lkml.kernel.org/r/20201103214025.116799-2-mcroce@linux.microsoft.com
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
