Skip to contentSkip to conversation

conf: machine: k3: remove extra ttyS* definitions

PATCH In review [email protected] 2 participants 6 messages May 24, 2023 – May 30, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 conf: machine: k3: remove extra ttyS* definitions

From: Randolph Sapp <[email protected]>

Adding serial consoles to this variable makes systemd attempt to start a Getty instance on them. Getty has no retry limit and no retry timout. I'm sure you can guess where this is going.

This fixes the endless start / stop Getty on ttyS0/ttyS3 messages that will flood the log until it's full.

In the case of Jailhouse demos, the getty systemd service should be invoked upon demo start and stopped upon end of the demo. It should not be listed as a system serial interface since it will not be present during normal device operation.

Before anyone asks, SERIAL_CONSOLES_CHECK only works on the sysVinit script so it's not worth discussing as a solution here.

---
 meta-ti-bsp/conf/machine/include/am62xx.inc | 3 ---
 meta-ti-bsp/conf/machine/include/k3.inc     | 2 +-
 2 files changed, 1 insertion(+), 4 deletions(-)
meta-ti-bsp/conf/machine/include/am62xx.inc +0 -3
index c98da5f5..1274d3b5 100644
@@ -25,6 +25,3 @@ TFA_BOARD = "lite"
 TFA_K3_SYSTEM_SUSPEND = "1"
 
 OPTEEMACHINE = "k3-am62x"
-
-# Normally AM62 boards use ttyS2, but our Jailhouse inmate may use ttyS3, so try both
-SERIAL_CONSOLES = "115200;ttyS2 115200;ttyS3"
meta-ti-bsp/conf/machine/include/k3.inc +1 -1
index c6b55239..97c6da94 100644
@@ -55,5 +55,5 @@ WKS_FILE ?= "${@bb.utils.contains("MACHINE_FEATURES", "efi", "sdimage-2part-efi.
 do_image_wic[depends] += "virtual/bootloader:do_deploy"
 do_image_complete[mcdepends] += "mc::k3r5:ti-sci-fw:do_deploy"
 
-SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS2"
+SERIAL_CONSOLES = "115200;ttyS2"
 SERIAL_CONSOLES_CHECK = "${SERIAL_CONSOLES}"
Signature · 1 line
2.40.1
#1 lore raw
Quoted 9 lines · On 5/24/23 3:03 PM, [email protected] wrote:

From: Randolph Sapp <[email protected]>

Adding serial consoles to this variable makes systemd attempt to start a Getty instance on them. Getty has no retry limit and no retry timout. I'm sure you can guess where this is going.

This fixes the endless start / stop Getty on ttyS0/ttyS3 messages that will flood the log until it's full.

Quoted 8 lines

In the case of Jailhouse demos, the getty systemd service should be invoked upon demo start and stopped upon end of the demo. It should not be listed as a system serial interface since it will not be present during normal device operation.

Before anyone asks, SERIAL_CONSOLES_CHECK only works on the sysVinit script so it's not worth discussing as a solution here.

Sounds like the better solution then is to fix systemd to timeout on SERIAL_CONSOLES_CHECK. We are not the only board with multiple possible terminals in OE right now. Making systemd match sysv here is something worth doing.

Not tested but a bbappends that changes the service reset might do:

meta/recipes-core/systemd/systemd-serialgetty/[email protected] +1 -1
@@ -32,7 +32,7 @@ Before=rescue.service
 Environment="TERM=@TERM@"
 ExecStart=-/sbin/agetty -8 -L %I @BAUDRATE@ $TERM
 Type=idle
-Restart=always
+Restart=on-success
 UtmpIdentifier=%I
 TTYPath=/dev/%I
 TTYReset=yes

Andrew

Quoted 28 lines
---
  meta-ti-bsp/conf/machine/include/am62xx.inc | 3 ---
  meta-ti-bsp/conf/machine/include/k3.inc     | 2 +-
  2 files changed, 1 insertion(+), 4 deletions(-)
meta-ti-bsp/conf/machine/include/am62xx.inc +0 -3
index c98da5f5..1274d3b5 100644
@@ -25,6 +25,3 @@ TFA_BOARD = "lite"
  TFA_K3_SYSTEM_SUSPEND = "1"
 
  OPTEEMACHINE = "k3-am62x"
-
-# Normally AM62 boards use ttyS2, but our Jailhouse inmate may use ttyS3, so try both
-SERIAL_CONSOLES = "115200;ttyS2 115200;ttyS3"
meta-ti-bsp/conf/machine/include/k3.inc +1 -1
index c6b55239..97c6da94 100644
@@ -55,5 +55,5 @@ WKS_FILE ?= "${@bb.utils.contains("MACHINE_FEATURES", "efi", "sdimage-2part-efi.
  do_image_wic[depends] += "virtual/bootloader:do_deploy"
  do_image_complete[mcdepends] += "mc::k3r5:ti-sci-fw:do_deploy"
 
-SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS2"
+SERIAL_CONSOLES = "115200;ttyS2"
  SERIAL_CONSOLES_CHECK = "${SERIAL_CONSOLES}"
#2 lore raw
Quoted 15 lines · Andrew Davis
Quoted 14 lines · On 5/24/23 3:03 PM, [email protected] wrote:

From: Randolph Sapp <[email protected]>

Adding serial consoles to this variable makes systemd attempt to start a Getty instance on them. Getty has no retry limit and no retry timout. I'm sure you can guess where this is going.

This fixes the endless start / stop Getty on ttyS0/ttyS3 messages that will flood the log until it's full.

In the case of Jailhouse demos, the getty systemd service should be invoked upon demo start and stopped upon end of the demo. It should not be listed as a system serial interface since it will not be present during normal device operation.

Quoted 9 lines
Quoted 3 lines

Before anyone asks, SERIAL_CONSOLES_CHECK only works on the sysVinit script so it's not worth discussing as a solution here.

Sounds like the better solution then is to fix systemd to timeout on SERIAL_CONSOLES_CHECK. We are not the only board with multiple possible terminals in OE right now. Making systemd match sysv here is something worth doing.

No, if a user logs out the serial-getty instance is restarted. If the console isn't present when the service first starts then the service should be restarted until it is. It's functioning as intended, do not edit that service.

Quoted 44 lines

Not tested but a bbappends that changes the service reset might do:

meta/recipes-core/systemd/systemd-serialgetty/[email protected] +1 -1
@@ -32,7 +32,7 @@ Before=rescue.service
  Environment="TERM=@TERM@"
  ExecStart=-/sbin/agetty -8 -L %I @BAUDRATE@ $TERM
  Type=idle
-Restart=always
+Restart=on-success
  UtmpIdentifier=%I
  TTYPath=/dev/%I
  TTYReset=yes

Andrew

Quoted 28 lines

---
  meta-ti-bsp/conf/machine/include/am62xx.inc | 3 --- meta-ti-bsp/conf/machine/include/k3.inc     | 2 +-

  2 files changed, 1 insertion(+), 4 deletions(-)
meta-ti-bsp/conf/machine/include/am62xx.inc +0 -0
index c98da5f5..1274d3b5 100644
@@ -25,6 +25,3 @@ TFA_BOARD = "lite"

  TFA_K3_SYSTEM_SUSPEND = "1"
  OPTEEMACHINE = "k3-am62x"

meta-ti-bsp/conf/machine/include/am62xx.inc +0 -2
-
-# Normally AM62 boards use ttyS2, but our Jailhouse inmate may use 

ttyS3, so try both

meta-ti-bsp/conf/machine/include/am62xx.inc +0 -1
-SERIAL_CONSOLES = "115200;ttyS2 115200;ttyS3"
meta-ti-bsp/conf/machine/include/k3.inc +0 -0
index c6b55239..97c6da94 100644
@@ -55,5 +55,5 @@ WKS_FILE ?= 

"${@bb.utils.contains("MACHINE_FEATURES", "efi", "sdimage-2part-efi. do_image_wic[depends] += "virtual/bootloader:do_deploy" do_image_complete[mcdepends] += "mc::k3r5:ti-sci-fw:do_deploy"

meta-ti-bsp/conf/machine/include/k3.inc +1 -1
-SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS2"
+SERIAL_CONSOLES = "115200;ttyS2"

  SERIAL_CONSOLES_CHECK = "${SERIAL_CONSOLES}"

#3 lore raw
Quoted 20 lines · Randolph Sapp
Quoted 19 lines · Andrew Davis
Quoted 17 lines · On 5/24/23 3:03 PM, [email protected] wrote:

From: Randolph Sapp <[email protected]>

Adding serial consoles to this variable makes systemd attempt to start a Getty instance on them. Getty has no retry limit and no retry timout. I'm sure you can guess where this is going.

This fixes the endless start / stop Getty on ttyS0/ttyS3 messages that will flood the log until it's full.

In the case of Jailhouse demos, the getty systemd service should be invoked upon demo start and stopped upon end of the demo. It should not be listed as a system serial interface since it will not be present during normal device operation.

Before anyone asks, SERIAL_CONSOLES_CHECK only works on the sysVinit script so it's not worth discussing as a solution here.

Quoted 8 lines
Quoted 5 lines

Sounds like the better solution then is to fix systemd to timeout on SERIAL_CONSOLES_CHECK. We are not the only board with multiple possible terminals in OE right now. Making systemd match sysv here is something worth doing.

No, if a user logs out the serial-getty instance is restarted. If the console isn't present when the service first starts then the service should be restarted until it is. It's functioning as intended, do not edit that service.

If a user logs out it will return 0 and will be restarted "on-success". If the console is not present the service *should* fail as it was told to start on a non-existent console.

If you want to handle the case of a late attaching tty device, you can have the service try again on attach, that functionality is part of systemd/udev already.

The current behavior in this service does not match sysv nor what SERIAL_CONSOLES_CHECK is meant for, and so should be fixed.

Andrew

Quoted 43 lines
Quoted 42 lines

Not tested but a bbappends that changes the service reset might do:

meta/recipes-core/systemd/systemd-serialgetty/[email protected] +0 -0
@@ -32,7 +32,7 @@ Before=rescue.service

  Environment="TERM=@TERM@" ExecStart=-/sbin/agetty -8 -L %I @BAUDRATE@ $TERM Type=idle

meta/recipes-core/systemd/systemd-serialgetty/[email protected] +1 -1
-Restart=always
+Restart=on-success

  UtmpIdentifier=%I
  TTYPath=/dev/%I
  TTYReset=yes

Andrew

Quoted 26 lines

---
  meta-ti-bsp/conf/machine/include/am62xx.inc | 3 --- meta-ti-bsp/conf/machine/include/k3.inc     | 2 +-

  2 files changed, 1 insertion(+), 4 deletions(-)
meta-ti-bsp/conf/machine/include/am62xx.inc +0 -0
index c98da5f5..1274d3b5 100644
@@ -25,6 +25,3 @@ TFA_BOARD = "lite"

  TFA_K3_SYSTEM_SUSPEND = "1"
  OPTEEMACHINE = "k3-am62x"

meta-ti-bsp/conf/machine/include/am62xx.inc +0 -3
-
-# Normally AM62 boards use ttyS2, but our Jailhouse inmate may use ttyS3, so try both
-SERIAL_CONSOLES = "115200;ttyS2 115200;ttyS3"
meta-ti-bsp/conf/machine/include/k3.inc +0 -0
index c6b55239..97c6da94 100644
@@ -55,5 +55,5 @@ WKS_FILE ?= "${@bb.utils.contains("MACHINE_FEATURES", "efi", "sdimage-2part-efi.

  do_image_wic[depends] += "virtual/bootloader:do_deploy" do_image_complete[mcdepends] += "mc::k3r5:ti-sci-fw:do_deploy"

meta-ti-bsp/conf/machine/include/k3.inc +1 -1
-SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS2"
+SERIAL_CONSOLES = "115200;ttyS2"

  SERIAL_CONSOLES_CHECK = "${SERIAL_CONSOLES}"

#4 lore raw
Quoted 34 lines · Andrew Davis
Quoted 20 lines · Randolph Sapp
Quoted 19 lines · Andrew Davis
Quoted 17 lines · On 5/24/23 3:03 PM, [email protected] wrote:

From: Randolph Sapp <[email protected]>

Adding serial consoles to this variable makes systemd attempt to start a Getty instance on them. Getty has no retry limit and no retry timout. I'm sure you can guess where this is going.

This fixes the endless start / stop Getty on ttyS0/ttyS3 messages that will flood the log until it's full.

In the case of Jailhouse demos, the getty systemd service should be invoked upon demo start and stopped upon end of the demo. It should not be listed as a system serial interface since it will not be present during normal device operation.

Before anyone asks, SERIAL_CONSOLES_CHECK only works on the sysVinit script so it's not worth discussing as a solution here.

Quoted 8 lines
Quoted 5 lines

Sounds like the better solution then is to fix systemd to timeout on SERIAL_CONSOLES_CHECK. We are not the only board with multiple possible terminals in OE right now. Making systemd match sysv here is something worth doing.

No, if a user logs out the serial-getty instance is restarted. If the console isn't present when the service first starts then the service should be restarted until it is. It's functioning as intended, do not edit that service.

If a user logs out it will return 0 and will be restarted "on-success". If the console is not present the service *should* fail as it was told to start on a non-existent console.

Quoted 8 lines

If you want to handle the case of a late attaching tty device, you can have the service try again on attach, that functionality is part of systemd/udev already.

The current behavior in this service does not match sysv nor what SERIAL_CONSOLES_CHECK is meant for, and so should be fixed.

Andrew

In that case the better thing would be for yocto to not explicitly set any serial interfaces and instead rely on the built in systemd-getty-generator. Go argue it with upstream. I'm sure they had to override things for a reason... Whether or not that's still a valid reason it yet to be seen.

Quoted 48 lines
Quoted 48 lines
Quoted 47 lines

Not tested but a bbappends that changes the service reset might do:

---
a/meta/recipes-core/systemd/systemd-serialgetty/[email protected]
+++
b/meta/recipes-core/systemd/systemd-serialgetty/[email protected]

(quoted diff) +0 -0
@@ -32,7 +32,7 @@ Before=rescue.service

  Environment="TERM=@TERM@" ExecStart=-/sbin/agetty -8 -L %I @BAUDRATE@ $TERM Type=idle

meta/recipes-core/systemd/systemd-serialgetty/[email protected] +1 -1
-Restart=always
+Restart=on-success

  UtmpIdentifier=%I
  TTYPath=/dev/%I
  TTYReset=yes

Andrew

Quoted 28 lines

---
  meta-ti-bsp/conf/machine/include/am62xx.inc | 3 --- meta-ti-bsp/conf/machine/include/k3.inc     | 2 +-

  2 files changed, 1 insertion(+), 4 deletions(-)
meta-ti-bsp/conf/machine/include/am62xx.inc +0 -0
index c98da5f5..1274d3b5 100644
@@ -25,6 +25,3 @@ TFA_BOARD = "lite"

  TFA_K3_SYSTEM_SUSPEND = "1"
  OPTEEMACHINE = "k3-am62x"

meta-ti-bsp/conf/machine/include/am62xx.inc +0 -2
-
-# Normally AM62 boards use ttyS2, but our Jailhouse inmate may use 

ttyS3, so try both

meta-ti-bsp/conf/machine/include/am62xx.inc +0 -1
-SERIAL_CONSOLES = "115200;ttyS2 115200;ttyS3"
meta-ti-bsp/conf/machine/include/k3.inc +0 -0
index c6b55239..97c6da94 100644
@@ -55,5 +55,5 @@ WKS_FILE ?= 

"${@bb.utils.contains("MACHINE_FEATURES", "efi", "sdimage-2part-efi. do_image_wic[depends] += "virtual/bootloader:do_deploy" do_image_complete[mcdepends] += "mc::k3r5:ti-sci-fw:do_deploy"

meta-ti-bsp/conf/machine/include/k3.inc +1 -1
-SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS2"
+SERIAL_CONSOLES = "115200;ttyS2"

  SERIAL_CONSOLES_CHECK = "${SERIAL_CONSOLES}"

#5 lore raw
Quoted 39 lines · Randolph Sapp
Quoted 38 lines · Andrew Davis
Quoted 20 lines · Randolph Sapp
Quoted 19 lines · Andrew Davis
Quoted 17 lines · On 5/24/23 3:03 PM, [email protected] wrote:

From: Randolph Sapp <[email protected]>

Adding serial consoles to this variable makes systemd attempt to start a Getty instance on them. Getty has no retry limit and no retry timout. I'm sure you can guess where this is going.

This fixes the endless start / stop Getty on ttyS0/ttyS3 messages that will flood the log until it's full.

In the case of Jailhouse demos, the getty systemd service should be invoked upon demo start and stopped upon end of the demo. It should not be listed as a system serial interface since it will not be present during normal device operation.

Before anyone asks, SERIAL_CONSOLES_CHECK only works on the sysVinit script so it's not worth discussing as a solution here.

Quoted 8 lines
Quoted 5 lines

Sounds like the better solution then is to fix systemd to timeout on SERIAL_CONSOLES_CHECK. We are not the only board with multiple possible terminals in OE right now. Making systemd match sysv here is something worth doing.

No, if a user logs out the serial-getty instance is restarted. If the console isn't present when the service first starts then the service should be restarted until it is. It's functioning as intended, do not edit that service.

If a user logs out it will return 0 and will be restarted "on-success". If the console is not present the service *should* fail as it was told to start on a non-existent console.

If you want to handle the case of a late attaching tty device, you can have the service try again on attach, that functionality is part of systemd/udev already.

Quoted 7 lines
Quoted 4 lines

The current behavior in this service does not match sysv nor what SERIAL_CONSOLES_CHECK is meant for, and so should be fixed.

Andrew

In that case the better thing would be for yocto to not explicitly set any serial interfaces and instead rely on the built in systemd-getty-generator. Go argue it with upstream. I'm sure they had to override things for a reason... Whether or not that's still a valid reason it yet to be seen.

Looks like someone already did, support for systemd-getty-generator is just a PACKAGECONFIG option away now[0]. Might be time to switch Arago over.

[0] https://github.com/openembedded/openembedded-core/commit/2a8d0df47c9d28f8ca7285861dee7a178273eae4

Andrew

Quoted 45 lines
Quoted 44 lines
Quoted 44 lines
Quoted 43 lines

Not tested but a bbappends that changes the service reset might do:

meta/recipes-core/systemd/systemd-serialgetty/[email protected] +0 -0
@@ -32,7 +32,7 @@ Before=rescue.service

  Environment="TERM=@TERM@" ExecStart=-/sbin/agetty -8 -L %I @BAUDRATE@ $TERM Type=idle

meta/recipes-core/systemd/systemd-serialgetty/[email protected] +1 -1
-Restart=always
+Restart=on-success

  UtmpIdentifier=%I
  TTYPath=/dev/%I
  TTYReset=yes

Andrew

Quoted 26 lines

---
  meta-ti-bsp/conf/machine/include/am62xx.inc | 3 --- meta-ti-bsp/conf/machine/include/k3.inc     | 2 +-

  2 files changed, 1 insertion(+), 4 deletions(-)
meta-ti-bsp/conf/machine/include/am62xx.inc +0 -0
index c98da5f5..1274d3b5 100644
@@ -25,6 +25,3 @@ TFA_BOARD = "lite"

  TFA_K3_SYSTEM_SUSPEND = "1"
  OPTEEMACHINE = "k3-am62x"

meta-ti-bsp/conf/machine/include/am62xx.inc +0 -3
-
-# Normally AM62 boards use ttyS2, but our Jailhouse inmate may use ttyS3, so try both
-SERIAL_CONSOLES = "115200;ttyS2 115200;ttyS3"
meta-ti-bsp/conf/machine/include/k3.inc +0 -0
index c6b55239..97c6da94 100644
@@ -55,5 +55,5 @@ WKS_FILE ?= "${@bb.utils.contains("MACHINE_FEATURES", "efi", "sdimage-2part-efi.

  do_image_wic[depends] += "virtual/bootloader:do_deploy" do_image_complete[mcdepends] += "mc::k3r5:ti-sci-fw:do_deploy"

meta-ti-bsp/conf/machine/include/k3.inc +1 -1
-SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS2"
+SERIAL_CONSOLES = "115200;ttyS2"

  SERIAL_CONSOLES_CHECK = "${SERIAL_CONSOLES}"