Skip to contentSkip to conversation

Documentation: sysrq: Rewrite /proc/sysrq-trigger usage

PATCH Superseded Bagas Sanjaya 3 participants 7 messages Oct 16, 2025 – Oct 23, 2025

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Documentation: sysrq: Rewrite /proc/sysrq-trigger usage

/proc/sysrq-trigger usage documentation (in "On all" section) states that it is not recommended to write extra characters to it to avoid undefined behavior, which is contradictive to previous sentence that such characters are ignored. Also, in order to actually process them (as a string), prepending it with underscore is required.

Rewrite the description.

---
Changes since v1 [1]:

- Rewrite the whole "On all" section (Jon, Randy)

[1]: https://lore.kernel.org/linux-doc/[email protected]/

 Documentation/admin-guide/sysrq.rst | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
Documentation/admin-guide/sysrq.rst +4 -7
index 9c7aa817adc72d..6157d93e03a1e2 100644
@@ -75,16 +75,13 @@ On other
 	submit a patch to be included in this section.
 
 On all
-	Write a single character to /proc/sysrq-trigger.
-	Only the first character is processed, the rest of the string is
-	ignored. However, it is not recommended to write any extra characters
-	as the behavior is undefined and might change in the future versions.
-	E.g.::
+	Write a single character to /proc/sysrq-trigger. E.g.::
 
 		echo t > /proc/sysrq-trigger
 
-	Alternatively, write multiple characters prepended by underscore.
-	This way, all characters will be processed. E.g.::
+	If a string (multiple characters) is written instead, only the
+	first character is processed unless the string is prepended by
+	an underscore, like::
 
 		echo _reisub > /proc/sysrq-trigger
 

base-commit: a1af37b935c73049c54cb1412cf0850212af420e

Signature · 1 line
An old man doll... just what I always wanted! - Clara
reviewer Reviewed-by on v2 1/1
#1 lore raw

Hi,

Quoted 25 lines · Bagas Sanjaya

/proc/sysrq-trigger usage documentation (in "On all" section) states that it is not recommended to write extra characters to it to avoid undefined behavior, which is contradictive to previous sentence that such characters are ignored. Also, in order to actually process them (as a string), prepending it with underscore is required.

Rewrite the description.

---
Changes since v1 [1]:

- Rewrite the whole "On all" section (Jon, Randy)

[1]: https://lore.kernel.org/linux-doc/[email protected]/

 Documentation/admin-guide/sysrq.rst | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
Documentation/admin-guide/sysrq.rst +0 -0
index 9c7aa817adc72d..6157d93e03a1e2 100644

Documentation/admin-guide/sysrq.rst On other · line 82

Quoted 8 lines
Documentation/admin-guide/sysrq.rst +0 -5
@@ -75,16 +75,13 @@ On other
 	submit a patch to be included in this section.
 
 On all
-	Write a single character to /proc/sysrq-trigger.
-	Only the first character is processed, the rest of the string is
-	ignored. However, it is not recommended to write any extra characters
-	as the behavior is undefined and might change in the future versions.
-	E.g.::

I didn't quite follow Tomas's objection to the patch. However, if we need to keep most of the paragraph above, I think that it should at least say something like:

In this mode, only the first character is processed; the rest of the string is silently ignored. To write multiple characters, see the alternative mode below.

At any rate, this patch LGTM.

Or there is yet another alternative wording below.

Quoted 13 lines
Documentation/admin-guide/sysrq.rst +4 -2
+	Write a single character to /proc/sysrq-trigger. E.g.::
 
 		echo t > /proc/sysrq-trigger
 
-	Alternatively, write multiple characters prepended by underscore.
-	This way, all characters will be processed. E.g.::
+	If a string (multiple characters) is written instead, only the
+	first character is processed unless the string is prepended by
+	an underscore, like::
 
 		echo _reisub > /proc/sysrq-trigger
 
Quoted 1 line

base-commit: a1af37b935c73049c54cb1412cf0e850212af420e

Alternative rewrite:

On all
To write a single character to /proc/sysrq-trigger::

echo command_key > /proc/sysrq-trigger

E.g::
echo t > /proc/sysrq-trigger

Only the first character is processed; any following characters are silently ignored.
However, it is not recommended to write any extra characters as the behavior is undefined and might change in the future versions.

Alternatively, to write multiple characters to /proc/sysrq-trigger, prepend then with an underscore.
This way, all characters will be processed. E.g.::

echo _reisub > /proc/sysrq-trigger

I am still OK with removing the 2 "However" lines. We don't typically document or provide warnings for how the code might be changed in the future. If someone modifies this code and the documentation needs to be updated, it should be updated at that time.

Signature · 1 line
~Randy
#2 lore raw
Quoted 7 lines

I am still OK with removing the 2 "However" lines. We don't typically document or provide warnings for how the code might be changed in the future. If someone modifies this code and the documentation needs to be updated, it should be updated at that time.

--
~Randy

Problem here is, that you cannot really modify the code without warning users in advance. This is the warning.

reviewer
#3 lore raw
Quoted 10 lines · Tomáš Mudruňka
Quoted 7 lines

I am still OK with removing the 2 "However" lines. We don't typically document or provide warnings for how the code might be changed in the future. If someone modifies this code and the documentation needs to be updated, it should be updated at that time.

--
~Randy

Problem here is, that you cannot really modify the code without warning users in advance. This is the warning.

All code in the kernel is subject to change in the future (anything that breaks userspace less so than other code).
I don't see thousands of warnings about such future changes.

Signature · 1 line
~Randy
#4 lore raw

In that case, can we use some short form? Something like "extra characters are ignored for now, which might change in future".

Thing is that i wanted to add handling of extra characters, but maintainer said it cannot be done because people might currently rely on characters being ignored as written in documentation.

reviewer
#5 lore raw
Quoted 6 lines · Tomáš Mudruňka

In that case, can we use some short form? Something like "extra characters are ignored for now, which might change in future".

Thing is that i wanted to add handling of extra characters, but maintainer said it cannot be done because people might currently rely on characters being ignored as written in documentation.

Sure, OK with me.
Thanks.

Signature · 1 line
~Randy
#6 lore raw
Quoted 11 lines · Randy Dunlap
Quoted 6 lines · Tomáš Mudruňka

In that case, can we use some short form? Something like "extra characters are ignored for now, which might change in future".

Thing is that i wanted to add handling of extra characters, but maintainer said it cannot be done because people might currently rely on characters being ignored as written in documentation.

Sure, OK with me.

No problem on my side.

Signature · 1 line
An old man doll... just what I always wanted! - Clara