All of lore.kernel.org
 help / color / mirror / Atom feed
* Does sysrq work over USB?
@ 2021-11-16 14:04 Marc SCHAEFER
  2021-11-16 21:29 ` Valentin Vidić
  0 siblings, 1 reply; 6+ messages in thread
From: Marc SCHAEFER @ 2021-11-16 14:04 UTC (permalink / raw)
  To: kernelnewbies

Hello,

I made the following setup work, that is I can send break and '?'
(to get the magic sysrq help) or 's' to do an Emergency sync, and the
kernel logs it:

 laptop                                        apu2
    USB serial port ------- null modem ------- ttyS0 internal 16550A

(an apu2 is an embedded amd64 computer [4])

As it works, of course MAGIC_SYSRQ is enabled, including for serial
ports, and the correct value is in the /proc pseudo-file.

It works with the getty enabled or disabled.

However, the following does not work to support magic sysrq, although
bidirectionnal communication also works with cu [5], with the correct
speed set:

 laptop                                        apu2
    USB serial port ------- null modem ------- USB serial port

First, reading documentation, I thought that this would not be possible with
USB and only with the internal serial port [1], but then, reading kernel
source, it looks it should work with my adapter:

   Oct 11 14:30:56 apu2-init7 kernel: [    9.915105] usb 2-2: pl2303 converter now attached to ttyUSB0

since the driver [2] contains code for magic sysrq, see line 993 for
sysrq mode and line 892 for break handling, with implementation in [3]
(lines 589-597).

I am running Debian buster kernel 4.19.0-18-amd64 on the apu2.

Should I abandon all hope to make it work with USB, or should it work?

Thank your for any pointers.

[1] https://www.kernel.org/doc/Documentation/admin-guide/sysrq.rst
    "On the serial console (PC style standard serial ports only)"

[2] https://github.com/jplozi/linux-4.19/blob/loadbalancing/drivers/usb/serial/pl2303.c

[3] https://github.com/jplozi/linux-4.19/blob/loadbalancing/drivers/usb/serial/generic.c

[4] https://pcengines.ch/apu2.htm

[5] https://linux.die.net/man/1/cu
    from the days before 2003 where I was doing UUCP
       cu -l ttyUSB0 -s 9600

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Does sysrq work over USB?
  2021-11-16 14:04 Does sysrq work over USB? Marc SCHAEFER
@ 2021-11-16 21:29 ` Valentin Vidić
  2021-11-21 15:47   ` Marc SCHAEFER
  0 siblings, 1 reply; 6+ messages in thread
From: Valentin Vidić @ 2021-11-16 21:29 UTC (permalink / raw)
  To: kernelnewbies

On Tue, Nov 16, 2021 at 03:04:56PM +0100, Marc SCHAEFER wrote:
> First, reading documentation, I thought that this would not be possible with
> USB and only with the internal serial port [1], but then, reading kernel
> source, it looks it should work with my adapter:
> 
>    Oct 11 14:30:56 apu2-init7 kernel: [    9.915105] usb 2-2: pl2303 converter now attached to ttyUSB0
> 
> since the driver [2] contains code for magic sysrq, see line 993 for
> sysrq mode and line 892 for break handling, with implementation in [3]
> (lines 589-597).
> 
> I am running Debian buster kernel 4.19.0-18-amd64 on the apu2.
> 
> Should I abandon all hope to make it work with USB, or should it work?
> 
> Thank your for any pointers.

Do you have console=ttyUSB0,... set? What does /proc/consoles say?

-- 
Valentin

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Does sysrq work over USB?
  2021-11-16 21:29 ` Valentin Vidić
@ 2021-11-21 15:47   ` Marc SCHAEFER
  2021-11-21 17:51     ` Valentin Vidić
  0 siblings, 1 reply; 6+ messages in thread
From: Marc SCHAEFER @ 2021-11-21 15:47 UTC (permalink / raw)
  To: kernelnewbies

On Tue, Nov 16, 2021 at 10:29:00PM +0100, Valentin Vidi?? wrote:
> Do you have console=ttyUSB0,... set? What does /proc/consoles say?

No, I did not.

Now, I have added on a test machine:

   console=ttyUSB0,9600 console=tty0

to /etc/default/grub and started upgrade-grub and rebooted.

I had and I still have:

   root@gluster-1:~# cat /proc/consoles 
   tty0                 -WU (EC p  )    4:1

However, the command line seems correct and multiple console= are
valid [1]:

   root@gluster-1:~# cat /proc/cmdline 
   BOOT_IMAGE=/vmlinuz-4.19.0-18-amd64 root=/dev/mapper/vg1-root ro console=ttyUSB0,9600 console=tty0 quiet raid0.default_layout=1

It does not seem to be work for some reason.

Let's try with one ttyUSB console specification only: does not
boot anymore. Does not print anything on ttyUSB0. Had to recover
using a grub kernel command line edition at boot time.

Any idea?

NB: the USB serial port works with cu bidirectionnally once the
system is booted, but %break has no effect.

[1] https://www.kernel.org/doc/html/latest/admin-guide/serial-console.html

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Does sysrq work over USB?
  2021-11-21 15:47   ` Marc SCHAEFER
@ 2021-11-21 17:51     ` Valentin Vidić
  2021-11-21 18:07       ` Valentin Vidić
  0 siblings, 1 reply; 6+ messages in thread
From: Valentin Vidić @ 2021-11-21 17:51 UTC (permalink / raw)
  To: kernelnewbies

On Sun, Nov 21, 2021 at 04:47:57PM +0100, Marc SCHAEFER wrote:
> On Tue, Nov 16, 2021 at 10:29:00PM +0100, Valentin Vidi?? wrote:
> > Do you have console=ttyUSB0,... set? What does /proc/consoles say?
> 
> No, I did not.
> 
> Now, I have added on a test machine:
> 
>    console=ttyUSB0,9600 console=tty0
> 
> to /etc/default/grub and started upgrade-grub and rebooted.
> 
> I had and I still have:
> 
>    root@gluster-1:~# cat /proc/consoles 
>    tty0                 -WU (EC p  )    4:1
> 
> However, the command line seems correct and multiple console= are
> valid [1]:
> 
>    root@gluster-1:~# cat /proc/cmdline 
>    BOOT_IMAGE=/vmlinuz-4.19.0-18-amd64 root=/dev/mapper/vg1-root ro console=ttyUSB0,9600 console=tty0 quiet raid0.default_layout=1

Seems like it was not picked up for some reason. You can try with this:

  console=tty0 console=ttyUSB0,9600n8

-- 
Valentin

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Does sysrq work over USB?
  2021-11-21 17:51     ` Valentin Vidić
@ 2021-11-21 18:07       ` Valentin Vidić
  2021-11-21 20:49         ` Marc SCHAEFER
  0 siblings, 1 reply; 6+ messages in thread
From: Valentin Vidić @ 2021-11-21 18:07 UTC (permalink / raw)
  To: kernelnewbies

On Sun, Nov 21, 2021 at 06:51:54PM +0100, Valentin Vidić wrote:
> Seems like it was not picked up for some reason. You can try with this:
> 
>   console=tty0 console=ttyUSB0,9600n8

I tried and it doesn't work for me either, but the problem is most
likely missing CONFIG_USB_SERIAL_CONSOLE=y option in the kernel build:

  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=868352

-- 
Valentin

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Does sysrq work over USB?
  2021-11-21 18:07       ` Valentin Vidić
@ 2021-11-21 20:49         ` Marc SCHAEFER
  0 siblings, 0 replies; 6+ messages in thread
From: Marc SCHAEFER @ 2021-11-21 20:49 UTC (permalink / raw)
  To: kernelnewbies

Hello,

On Sun, Nov 21, 2021 at 07:07:33PM +0100, Valentin Vidi?? wrote:
> I tried and it doesn't work for me either, but the problem is most
> likely missing CONFIG_USB_SERIAL_CONSOLE=y option in the kernel build:
> 
>   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=868352

Yes,

with a kernel recompiled with those options and grub configured,
I get:

CONFIG_USB=y
CONFIG_USB_SERIAL=y
CONFIG_USB_SERIAL_CONSOLE=y
CONFIG_U_SERIAL_CONSOLE=y

I get:

   root@gluster-1:~# cat /proc/consoles 
   tty0                 -WU (EC p  )    4:1
   ttyUSB0              -W- (E  p  )  188:0

and I can then do sysrq from USB:
   schaefer@acer-1:~$ cu -l ttyUSB0 -s 9600
   Connected.
   ~%break
   [ 1633.701624] sysrq: HELP : loglevel(0-9) reboot(b) crash(c)
   terminate-all-tasks(e) memory-full-oom-kill(f) kill-all-tasks(i)
   thaw-filesystems(j) sak(k) show-backtrace-all-active-cpus(l)
   show-memory-usage(m) nice-all-RT-tasks(n) poweroff(o) show-registers(p)
   show-all-timers(q) unraw(r) sync(s) show-task-states(t) unmount(u)
   force-fb(V) show-blocked-tasks(w) dump-ftrace-buffer(z) 
   
Thank you for your help: I have now a way to make it work.
   

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-21 20:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 14:04 Does sysrq work over USB? Marc SCHAEFER
2021-11-16 21:29 ` Valentin Vidić
2021-11-21 15:47   ` Marc SCHAEFER
2021-11-21 17:51     ` Valentin Vidić
2021-11-21 18:07       ` Valentin Vidić
2021-11-21 20:49         ` Marc SCHAEFER

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.