<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/tty/sysrq.c, branch v5.10.257</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v5.10.257</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v5.10.257'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2023-11-28T16:54:56+00:00</updated>
<entry>
<title>tty/sysrq: replace smp_processor_id() with get_cpu()</title>
<updated>2023-11-28T16:54:56+00:00</updated>
<author>
<name>Muhammad Usama Anjum</name>
<email>usama.anjum@collabora.com</email>
</author>
<published>2023-10-09T16:20:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a158a74e701bd5e10b443d588342e484f356518a'/>
<id>urn:sha1:a158a74e701bd5e10b443d588342e484f356518a</id>
<content type='text'>
commit dd976a97d15b47656991e185a94ef42a0fa5cfd4 upstream.

The smp_processor_id() shouldn't be called from preemptible code.
Instead use get_cpu() and put_cpu() which disables preemption in
addition to getting the processor id. Enable preemption back after
calling schedule_work() to make sure that the work gets scheduled on all
cores other than the current core. We want to avoid a scenario where
current core's stack trace is printed multiple times and one core's
stack trace isn't printed because of scheduling of current task.

This fixes the following bug:

[  119.143590] sysrq: Show backtrace of all active CPUs
[  119.143902] BUG: using smp_processor_id() in preemptible [00000000] code: bash/873
[  119.144586] caller is debug_smp_processor_id+0x20/0x30
[  119.144827] CPU: 6 PID: 873 Comm: bash Not tainted 5.10.124-dirty #3
[  119.144861] Hardware name: QEMU QEMU Virtual Machine, BIOS 2023.05-1 07/22/2023
[  119.145053] Call trace:
[  119.145093]  dump_backtrace+0x0/0x1a0
[  119.145122]  show_stack+0x18/0x70
[  119.145141]  dump_stack+0xc4/0x11c
[  119.145159]  check_preemption_disabled+0x100/0x110
[  119.145175]  debug_smp_processor_id+0x20/0x30
[  119.145195]  sysrq_handle_showallcpus+0x20/0xc0
[  119.145211]  __handle_sysrq+0x8c/0x1a0
[  119.145227]  write_sysrq_trigger+0x94/0x12c
[  119.145247]  proc_reg_write+0xa8/0xe4
[  119.145266]  vfs_write+0xec/0x280
[  119.145282]  ksys_write+0x6c/0x100
[  119.145298]  __arm64_sys_write+0x20/0x30
[  119.145315]  el0_svc_common.constprop.0+0x78/0x1e4
[  119.145332]  do_el0_svc+0x24/0x8c
[  119.145348]  el0_svc+0x10/0x20
[  119.145364]  el0_sync_handler+0x134/0x140
[  119.145381]  el0_sync+0x180/0x1c0

Cc: jirislaby@kernel.org
Cc: stable@vger.kernel.org
Fixes: 47cab6a722d4 ("debug lockups: Improve lockup detection, fix generic arch fallback")
Signed-off-by: Muhammad Usama Anjum &lt;usama.anjum@collabora.com&gt;
Link: https://lore.kernel.org/r/20231009162021.3607632-1-usama.anjum@collabora.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>sysrq: do not omit current cpu when showing backtrace of all active CPUs</title>
<updated>2022-06-14T16:32:42+00:00</updated>
<author>
<name>Changbin Du</name>
<email>changbin.du@gmail.com</email>
</author>
<published>2022-01-17T15:43:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=468fe959eab35f3cc50016f34f21116f0cc3aec3'/>
<id>urn:sha1:468fe959eab35f3cc50016f34f21116f0cc3aec3</id>
<content type='text'>
[ Upstream commit 5390e7f46b9d5546d45a83e6463bc656678b1d0e ]

The backtrace of current CPU also should be printed as it is active. This
change add stack trace for current CPU and print a hint for idle CPU for
the generic workqueue based printing. (x86 already does this)

Now it looks like below:
[  279.401567] sysrq: Show backtrace of all active CPUs
[  279.407234] sysrq: CPU5:
[  279.407505] Call Trace:
[  279.408789] [&lt;ffffffff8000606c&gt;] dump_backtrace+0x2c/0x3a
[  279.411698] [&lt;ffffffff800060ac&gt;] show_stack+0x32/0x3e
[  279.411809] [&lt;ffffffff80542258&gt;] sysrq_handle_showallcpus+0x4c/0xc6
[  279.411929] [&lt;ffffffff80542f16&gt;] __handle_sysrq+0x106/0x26c
[  279.412034] [&lt;ffffffff805436a8&gt;] write_sysrq_trigger+0x64/0x74
[  279.412139] [&lt;ffffffff8029cd48&gt;] proc_reg_write+0x8e/0xe2
[  279.412252] [&lt;ffffffff8021a8f8&gt;] vfs_write+0x90/0x2be
[  279.412362] [&lt;ffffffff8021acd2&gt;] ksys_write+0xa6/0xce
[  279.412467] [&lt;ffffffff8021ad24&gt;] sys_write+0x2a/0x38
[  279.412689] [&lt;ffffffff80003ff8&gt;] ret_from_syscall+0x0/0x2
[  279.417173] sysrq: CPU6: backtrace skipped as idling
[  279.417185] sysrq: CPU4: backtrace skipped as idling
[  279.417187] sysrq: CPU0: backtrace skipped as idling
[  279.417181] sysrq: CPU7: backtrace skipped as idling
[  279.417190] sysrq: CPU1: backtrace skipped as idling
[  279.417193] sysrq: CPU3: backtrace skipped as idling
[  279.417219] sysrq: CPU2:
[  279.419179] Call Trace:
[  279.419440] [&lt;ffffffff8000606c&gt;] dump_backtrace+0x2c/0x3a
[  279.419782] [&lt;ffffffff800060ac&gt;] show_stack+0x32/0x3e
[  279.420015] [&lt;ffffffff80542b30&gt;] showacpu+0x5c/0x96
[  279.420317] [&lt;ffffffff800ba71c&gt;] flush_smp_call_function_queue+0xd6/0x218
[  279.420569] [&lt;ffffffff800bb438&gt;] generic_smp_call_function_single_interrupt+0x14/0x1c
[  279.420798] [&lt;ffffffff800079ae&gt;] handle_IPI+0xaa/0x13a
[  279.421024] [&lt;ffffffff804dcb92&gt;] riscv_intc_irq+0x56/0x70
[  279.421274] [&lt;ffffffff80a05b70&gt;] generic_handle_arch_irq+0x6a/0xfa
[  279.421518] [&lt;ffffffff80004006&gt;] ret_from_exception+0x0/0x10
[  279.421750] [&lt;ffffffff80096492&gt;] rcu_idle_enter+0x16/0x1e

Signed-off-by: Changbin Du &lt;changbin.du@gmail.com&gt;
Link: https://lore.kernel.org/r/20220117154300.2808-1-changbin.du@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>tty/sysrq: Extend the sysrq_key_table to cover capital letters</title>
<updated>2020-10-02T12:56:06+00:00</updated>
<author>
<name>Andrzej Pietrasiewicz</name>
<email>andrzej.p@collabora.com</email>
</author>
<published>2020-08-18T11:28:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a27eb0cb4b2104461de1a1284059b3ac875e45b5'/>
<id>urn:sha1:a27eb0cb4b2104461de1a1284059b3ac875e45b5</id>
<content type='text'>
All slots in sysrq_key_table[] are either used, reserved or at least
commented with their intended use. This patch adds capital letter versions
available, which means adding 26 more entries.

For already existing SysRq operations the user presses Alt-SysRq-&lt;key&gt;, and
for the newly added ones Alt-Shift-SysRq-&lt;key&gt;.

Signed-off-by: Andrzej Pietrasiewicz &lt;andrzej.p@collabora.com&gt;
Acked-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: https://lore.kernel.org/r/20200818112825.6445-2-andrzej.p@collabora.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty/sysrq: emergency_thaw_all does not depend on CONFIG_BLOCK</title>
<updated>2020-06-24T15:16:02+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-06-20T07:16:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b818f09e46f9f6a66471f81bf83094ff0a477d0c'/>
<id>urn:sha1:b818f09e46f9f6a66471f81bf83094ff0a477d0c</id>
<content type='text'>
We can also thaw non-block file systems.  Remove the CONFIG_BLOCK in
sysrq.c after making the prototype available unconditionally.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>kernel: rename show_stack_loglvl() =&gt; show_stack()</title>
<updated>2020-06-09T16:39:13+00:00</updated>
<author>
<name>Dmitry Safonov</name>
<email>dima@arista.com</email>
</author>
<published>2020-06-09T04:32:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9cb8f069deeed708bf19486d5893e297dc467ae0'/>
<id>urn:sha1:9cb8f069deeed708bf19486d5893e297dc467ae0</id>
<content type='text'>
Now the last users of show_stack() got converted to use an explicit log
level, show_stack_loglvl() can drop it's redundant suffix and become once
again well known show_stack().

Signed-off-by: Dmitry Safonov &lt;dima@arista.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Link: http://lkml.kernel.org/r/20200418201944.482088-51-dima@arista.com
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>sysrq: use show_stack_loglvl()</title>
<updated>2020-06-09T16:39:12+00:00</updated>
<author>
<name>Dmitry Safonov</name>
<email>dima@arista.com</email>
</author>
<published>2020-06-09T04:32:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ab34b46d1a74e98996e67a7da7e5d683ecfd9f57'/>
<id>urn:sha1:ab34b46d1a74e98996e67a7da7e5d683ecfd9f57</id>
<content type='text'>
Show the stack trace on a CPU with the same log level as "CPU%d" header.

Signed-off-by: Dmitry Safonov &lt;dima@arista.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Jiri Slaby &lt;jslaby@suse.com&gt;
Link: http://lkml.kernel.org/r/20200418201944.482088-45-dima@arista.com
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>tty/sysrq: constify the the sysrq_key_op(s)</title>
<updated>2020-05-15T12:53:19+00:00</updated>
<author>
<name>Emil Velikov</name>
<email>emil.l.velikov@gmail.com</email>
</author>
<published>2020-05-13T21:43:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7fffe31d3eaa2f08bdfde2403adcaa8029f9bea4'/>
<id>urn:sha1:7fffe31d3eaa2f08bdfde2403adcaa8029f9bea4</id>
<content type='text'>
All the users threat them as immutable - annotate them as such.

Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Jiri Slaby &lt;jslaby@suse.com&gt;
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Emil Velikov &lt;emil.l.velikov@gmail.com&gt;
Link: https://lore.kernel.org/r/20200513214351.2138580-3-emil.l.velikov@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty/sysrq: constify the sysrq API</title>
<updated>2020-05-15T12:53:19+00:00</updated>
<author>
<name>Emil Velikov</name>
<email>emil.l.velikov@gmail.com</email>
</author>
<published>2020-05-13T21:43:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=23cbedf812ff7c7751582928e32d953d84c1c821'/>
<id>urn:sha1:23cbedf812ff7c7751582928e32d953d84c1c821</id>
<content type='text'>
The user is not supposed to thinker with the underlying sysrq_key_op.
Make that explicit by adding a handful of const notations.

Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Jiri Slaby &lt;jslaby@suse.com&gt;
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Emil Velikov &lt;emil.l.velikov@gmail.com&gt;
Link: https://lore.kernel.org/r/20200513214351.2138580-2-emil.l.velikov@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty/sysrq: alpha: export and use __sysrq_get_key_op()</title>
<updated>2020-05-15T12:53:18+00:00</updated>
<author>
<name>Emil Velikov</name>
<email>emil.l.velikov@gmail.com</email>
</author>
<published>2020-05-13T21:43:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0f1c9688a194d22bb81953bd85bd18b0115fd17f'/>
<id>urn:sha1:0f1c9688a194d22bb81953bd85bd18b0115fd17f</id>
<content type='text'>
Export a pointer to the sysrq_get_key_op(). This way we can cleanly
unregister it, instead of the current solutions of modifuing it inplace.

Since __sysrq_get_key_op() is no longer used externally, let's make it
a static function.

This patch will allow us to limit access to each and every sysrq op and
constify the sysrq handling.

Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Jiri Slaby &lt;jslaby@suse.com&gt;
Cc: linux-kernel@vger.kernel.org
Cc: Richard Henderson &lt;rth@twiddle.net&gt;
Cc: Ivan Kokshaysky &lt;ink@jurassic.park.msu.ru&gt;
Cc: Matt Turner &lt;mattst88@gmail.com&gt;
Cc: linux-alpha@vger.kernel.org
Signed-off-by: Emil Velikov &lt;emil.l.velikov@gmail.com&gt;
Link: https://lore.kernel.org/r/20200513214351.2138580-1-emil.l.velikov@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty/sysrq: Export sysrq_mask(), sysrq_toggle_support()</title>
<updated>2020-04-20T17:37:42+00:00</updated>
<author>
<name>Dmitry Safonov</name>
<email>dima@arista.com</email>
</author>
<published>2020-04-20T17:23:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=66bb1c9518e623235cbaa7832c919eb4fe586cae'/>
<id>urn:sha1:66bb1c9518e623235cbaa7832c919eb4fe586cae</id>
<content type='text'>
Build fix for serial_core being module:
  ERROR: modpost: "sysrq_toggle_support" [drivers/tty/serial/serial_core.ko] undefined!
  ERROR: modpost: "sysrq_mask" [drivers/tty/serial/serial_core.ko] undefined!

Fixes: eaee41727e6d ("sysctl/sysrq: Remove __sysrq_enabled copy")
Cc: Jiri Slaby &lt;jslaby@suse.com&gt;
Reported-by: "kernelci.org bot" &lt;bot@kernelci.org&gt;
Reported-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Signed-off-by: Dmitry Safonov &lt;dima@arista.com&gt;
Link: https://lore.kernel.org/r/20200420172317.599611-1-dima@arista.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
