linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] s390/sclp_vt220: Fix console name to match device
@ 2020-05-19 18:16 Valentin Vidic
  2020-05-20  5:25 ` Christian Borntraeger
  2021-04-27 19:40 ` [PATCH v2] " Valentin Vidic
  0 siblings, 2 replies; 10+ messages in thread
From: Valentin Vidic @ 2020-05-19 18:16 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Christian Borntraeger
  Cc: linux-s390, linux-kernel, Valentin Vidic, stable

Console name reported in /proc/consoles:

  ttyS1                -W- (EC p  )    4:65

does not match device name:

  crw--w----    1 root     root        4,  65 May 17 12:18 /dev/ttysclp0

so debian-installer gets confused and fails to start.

Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr>
Cc: stable@vger.kernel.org
---
 drivers/s390/char/sclp_vt220.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c
index 3f9a6ef650fa..3c2ed6d01387 100644
--- a/drivers/s390/char/sclp_vt220.c
+++ b/drivers/s390/char/sclp_vt220.c
@@ -35,8 +35,8 @@
 #define SCLP_VT220_MINOR		65
 #define SCLP_VT220_DRIVER_NAME		"sclp_vt220"
 #define SCLP_VT220_DEVICE_NAME		"ttysclp"
-#define SCLP_VT220_CONSOLE_NAME		"ttyS"
-#define SCLP_VT220_CONSOLE_INDEX	1	/* console=ttyS1 */
+#define SCLP_VT220_CONSOLE_NAME		"ttysclp"
+#define SCLP_VT220_CONSOLE_INDEX	0	/* console=ttysclp0 */
 
 /* Representation of a single write request */
 struct sclp_vt220_request {
-- 
2.20.1


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

* Re: [PATCH] s390/sclp_vt220: Fix console name to match device
  2020-05-19 18:16 [PATCH] s390/sclp_vt220: Fix console name to match device Valentin Vidic
@ 2020-05-20  5:25 ` Christian Borntraeger
  2020-05-20  7:07   ` Valentin Vidić
  2021-04-27 19:40 ` [PATCH v2] " Valentin Vidic
  1 sibling, 1 reply; 10+ messages in thread
From: Christian Borntraeger @ 2020-05-20  5:25 UTC (permalink / raw)
  To: Valentin Vidic, Heiko Carstens, Vasily Gorbik
  Cc: linux-s390, linux-kernel, stable


On 19.05.20 20:16, Valentin Vidic wrote:
> Console name reported in /proc/consoles:
> 
>   ttyS1                -W- (EC p  )    4:65
> 
> does not match device name:
> 
>   crw--w----    1 root     root        4,  65 May 17 12:18 /dev/ttysclp0
> 
> so debian-installer gets confused and fails to start.
> 
> Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr>
> Cc: stable@vger.kernel.org

This is not as simple. ttyS1 is the the console name and ttysclp0 is the tty name.
This has mostly historic reasons and it obviously causes problems.
But there is  documentation out that that actually describes the use of 
console=ttyS1 console=ttyS0.
to have console output on both sclp consoles and there are probably scripts
using ttyS1.

I am wondering. The tty for ttyS0 is named sclp_line0. Does this work in LPAR?


> ---
>  drivers/s390/char/sclp_vt220.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c
> index 3f9a6ef650fa..3c2ed6d01387 100644
> --- a/drivers/s390/char/sclp_vt220.c
> +++ b/drivers/s390/char/sclp_vt220.c
> @@ -35,8 +35,8 @@
>  #define SCLP_VT220_MINOR		65
>  #define SCLP_VT220_DRIVER_NAME		"sclp_vt220"
>  #define SCLP_VT220_DEVICE_NAME		"ttysclp"
> -#define SCLP_VT220_CONSOLE_NAME		"ttyS"
> -#define SCLP_VT220_CONSOLE_INDEX	1	/* console=ttyS1 */
> +#define SCLP_VT220_CONSOLE_NAME		"ttysclp"
> +#define SCLP_VT220_CONSOLE_INDEX	0	/* console=ttysclp0 */
>  
>  /* Representation of a single write request */
>  struct sclp_vt220_request {
> 

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

* Re: [PATCH] s390/sclp_vt220: Fix console name to match device
  2020-05-20  5:25 ` Christian Borntraeger
@ 2020-05-20  7:07   ` Valentin Vidić
  2020-05-20  7:14     ` Christian Borntraeger
  0 siblings, 1 reply; 10+ messages in thread
From: Valentin Vidić @ 2020-05-20  7:07 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Heiko Carstens, Vasily Gorbik, linux-s390, linux-kernel, stable

On Wed, May 20, 2020 at 07:25:06AM +0200, Christian Borntraeger wrote:
> This is not as simple. ttyS1 is the the console name and ttysclp0 is the tty name.
> This has mostly historic reasons and it obviously causes problems.
> But there is  documentation out that that actually describes the use of 
> console=ttyS1 console=ttyS0.
> to have console output on both sclp consoles and there are probably scripts
> using ttyS1.
> 
> I am wondering. The tty for ttyS0 is named sclp_line0. Does this work in LPAR?

I ran into this problem with qemu-system-s390x, so not sure about LPAR.
Would changing the tty name also cause problems?

-- 
Valentin

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

* Re: [PATCH] s390/sclp_vt220: Fix console name to match device
  2020-05-20  7:07   ` Valentin Vidić
@ 2020-05-20  7:14     ` Christian Borntraeger
  2020-05-20  8:04       ` Valentin Vidić
  0 siblings, 1 reply; 10+ messages in thread
From: Christian Borntraeger @ 2020-05-20  7:14 UTC (permalink / raw)
  To: Valentin Vidić
  Cc: Heiko Carstens, Vasily Gorbik, linux-s390, linux-kernel, stable



On 20.05.20 09:07, Valentin Vidić wrote:
> On Wed, May 20, 2020 at 07:25:06AM +0200, Christian Borntraeger wrote:
>> This is not as simple. ttyS1 is the the console name and ttysclp0 is the tty name.
>> This has mostly historic reasons and it obviously causes problems.
>> But there is  documentation out that that actually describes the use of 
>> console=ttyS1 console=ttyS0.
>> to have console output on both sclp consoles and there are probably scripts
>> using ttyS1.
>>
>> I am wondering. The tty for ttyS0 is named sclp_line0. Does this work in LPAR?
> 
> I ran into this problem with qemu-system-s390x, so not sure about LPAR.
> Would changing the tty name also cause problems?

My point was more that a similar issue should happen when installing in LPAR. LPAR
uses the line mode style console which is ttyS0 for the console but sclp_line0 for the
tty. How does the debian installer handle this?

Regarding your patch I fear that this patch would break existing setups so we cannot
use it as is.

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

* Re: [PATCH] s390/sclp_vt220: Fix console name to match device
  2020-05-20  7:14     ` Christian Borntraeger
@ 2020-05-20  8:04       ` Valentin Vidić
  0 siblings, 0 replies; 10+ messages in thread
From: Valentin Vidić @ 2020-05-20  8:04 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Heiko Carstens, Vasily Gorbik, linux-s390, linux-kernel, stable

On Wed, May 20, 2020 at 09:14:23AM +0200, Christian Borntraeger wrote:
> My point was more that a similar issue should happen when installing in LPAR. LPAR
> uses the line mode style console which is ttyS0 for the console but sclp_line0 for the
> tty. How does the debian installer handle this?

I suppose it would fail the same way, but I have no way to verify.

> Regarding your patch I fear that this patch would break existing
> setups so we cannot use it as is.

Right, if some software/documentation depends on the name ttysclp0,
then I guess it is not possible to change any of the two names.

-- 
Valentin

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

* [PATCH v2] s390/sclp_vt220: Fix console name to match device
  2020-05-19 18:16 [PATCH] s390/sclp_vt220: Fix console name to match device Valentin Vidic
  2020-05-20  5:25 ` Christian Borntraeger
@ 2021-04-27 19:40 ` Valentin Vidic
  2021-04-28 12:39   ` Christian Borntraeger
  2021-04-28 13:38   ` Hendrik Brueckner
  1 sibling, 2 replies; 10+ messages in thread
From: Valentin Vidic @ 2021-04-27 19:40 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Heiko Carstens, Vasily Gorbik, linux-s390, linux-kernel,
	Philipp Kern, Benjamin Zimmermann, debian-s390,
	Peter Oberparleiter, Valentin Vidic

Console name reported in /proc/consoles:

  ttyS1                -W- (EC p  )    4:65

does not match the char device name:

  crw--w----    1 root     root        4,  65 May 17 12:18 /dev/ttysclp0

so debian-installer inside a QEMU s390x instance gets confused and fails
to start with the following error:

  steal-ctty: No such file or directory

Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr>
---
 v2: also update preferred console for VT220 case

 arch/s390/kernel/setup.c       | 2 +-
 drivers/s390/char/sclp_vt220.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 72134f9f6ff5..3ec6ca9c26c0 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -165,7 +165,7 @@ static void __init set_preferred_console(void)
 	else if (CONSOLE_IS_3270)
 		add_preferred_console("tty3270", 0, NULL);
 	else if (CONSOLE_IS_VT220)
-		add_preferred_console("ttyS", 1, NULL);
+		add_preferred_console("ttysclp", 0, NULL);
 	else if (CONSOLE_IS_HVC)
 		add_preferred_console("hvc", 0, NULL);
 }
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c
index 047f812d1a1c..71ed1bf15598 100644
--- a/drivers/s390/char/sclp_vt220.c
+++ b/drivers/s390/char/sclp_vt220.c
@@ -35,8 +35,8 @@
 #define SCLP_VT220_MINOR		65
 #define SCLP_VT220_DRIVER_NAME		"sclp_vt220"
 #define SCLP_VT220_DEVICE_NAME		"ttysclp"
-#define SCLP_VT220_CONSOLE_NAME		"ttyS"
-#define SCLP_VT220_CONSOLE_INDEX	1	/* console=ttyS1 */
+#define SCLP_VT220_CONSOLE_NAME		"ttysclp"
+#define SCLP_VT220_CONSOLE_INDEX	0	/* console=ttysclp0 */
 
 /* Representation of a single write request */
 struct sclp_vt220_request {
-- 
2.20.1


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

* Re: [PATCH v2] s390/sclp_vt220: Fix console name to match device
  2021-04-27 19:40 ` [PATCH v2] " Valentin Vidic
@ 2021-04-28 12:39   ` Christian Borntraeger
  2021-04-28 13:38   ` Hendrik Brueckner
  1 sibling, 0 replies; 10+ messages in thread
From: Christian Borntraeger @ 2021-04-28 12:39 UTC (permalink / raw)
  To: Valentin Vidic
  Cc: Heiko Carstens, Vasily Gorbik, linux-s390, linux-kernel,
	Philipp Kern, Benjamin Zimmermann, debian-s390,
	Peter Oberparleiter



On 27.04.21 21:40, Valentin Vidic wrote:
> Console name reported in /proc/consoles:
> 
>    ttyS1                -W- (EC p  )    4:65
> 
> does not match the char device name:
> 
>    crw--w----    1 root     root        4,  65 May 17 12:18 /dev/ttysclp0
> 
> so debian-installer inside a QEMU s390x instance gets confused and fails
> to start with the following error:
> 
>    steal-ctty: No such file or directory
> 
> Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr>

Ok, I will apply this internally for a while to give it some test coverage.
I also think that I found a potential statement for the documentation issue.

The tty will simply continue to work (as tty and console are not connected),
but for the console on LPAR you usually do things like
"console=ttyS0 console=ttyS1" to get console output on both (sclp line mode and
sclp full screen AKA ascii console).

When we now change the documentation to
"console=ttyS0 console=ttyS1 console=ttysclp0" the kernel will ignore the missing
console.


> ---
>   v2: also update preferred console for VT220 case
> 
>   arch/s390/kernel/setup.c       | 2 +-
>   drivers/s390/char/sclp_vt220.c | 4 ++--
>   2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
> index 72134f9f6ff5..3ec6ca9c26c0 100644
> --- a/arch/s390/kernel/setup.c
> +++ b/arch/s390/kernel/setup.c
> @@ -165,7 +165,7 @@ static void __init set_preferred_console(void)
>   	else if (CONSOLE_IS_3270)
>   		add_preferred_console("tty3270", 0, NULL);
>   	else if (CONSOLE_IS_VT220)
> -		add_preferred_console("ttyS", 1, NULL);
> +		add_preferred_console("ttysclp", 0, NULL);
>   	else if (CONSOLE_IS_HVC)
>   		add_preferred_console("hvc", 0, NULL);
>   }
> diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c
> index 047f812d1a1c..71ed1bf15598 100644
> --- a/drivers/s390/char/sclp_vt220.c
> +++ b/drivers/s390/char/sclp_vt220.c
> @@ -35,8 +35,8 @@
>   #define SCLP_VT220_MINOR		65
>   #define SCLP_VT220_DRIVER_NAME		"sclp_vt220"
>   #define SCLP_VT220_DEVICE_NAME		"ttysclp"
> -#define SCLP_VT220_CONSOLE_NAME		"ttyS"
> -#define SCLP_VT220_CONSOLE_INDEX	1	/* console=ttyS1 */
> +#define SCLP_VT220_CONSOLE_NAME		"ttysclp"
> +#define SCLP_VT220_CONSOLE_INDEX	0	/* console=ttysclp0 */
>   
>   /* Representation of a single write request */
>   struct sclp_vt220_request {
> 

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

* Re: [PATCH v2] s390/sclp_vt220: Fix console name to match device
  2021-04-27 19:40 ` [PATCH v2] " Valentin Vidic
  2021-04-28 12:39   ` Christian Borntraeger
@ 2021-04-28 13:38   ` Hendrik Brueckner
  2021-04-28 14:44     ` Christian Borntraeger
  2021-04-28 16:13     ` Valentin Vidić
  1 sibling, 2 replies; 10+ messages in thread
From: Hendrik Brueckner @ 2021-04-28 13:38 UTC (permalink / raw)
  To: Valentin Vidic
  Cc: Christian Borntraeger, Heiko Carstens, Vasily Gorbik, linux-s390,
	linux-kernel, Philipp Kern, Benjamin Zimmermann, debian-s390,
	Peter Oberparleiter

Hi Valentin,

I just had the chance to look into this console topic yesterday.

On Tue, Apr 27, 2021 at 09:40:10PM +0200, Valentin Vidic wrote:
> Console name reported in /proc/consoles:
> 
>   ttyS1                -W- (EC p  )    4:65

It is been a while ago when working on consoles. However, consoles are
typically devices without having a device node associated. There is special
handling for /dev/console wrt. to the preferred console in the tty layer.

A console device might be associated with a tty device but this is not a
requirement. For example, consider the net console that streams console
messages thru UDP and is not associated with a tty.

Because console and tty are different devices, names can also be different
which is, unfortunately, the case on s390.

Therefore my suggestion here is not derive the tty device from the name
of the console, but rather looking at the associated tty being reported
as major minor number in /proc/console.

> 
> does not match the char device name:
> 
>   crw--w----    1 root     root        4,  65 May 17 12:18 /dev/ttysclp0

In the example above, 4:65 excactly ends up in /dev/ttysclp0.

I am also in contact with Christian and thanks to him to try this out
internally.  At least, there are options to bring this forward and let's
figure out what the best solution will be.

Thanks and kind regards,
  Hendrik

-- 
Hendrik Brueckner
brueckner@linux.ibm.com           | IBM Deutschland Research & Development GmbH
                                  | Schoenaicher Str. 220, 71032 Boeblingen

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

* Re: [PATCH v2] s390/sclp_vt220: Fix console name to match device
  2021-04-28 13:38   ` Hendrik Brueckner
@ 2021-04-28 14:44     ` Christian Borntraeger
  2021-04-28 16:13     ` Valentin Vidić
  1 sibling, 0 replies; 10+ messages in thread
From: Christian Borntraeger @ 2021-04-28 14:44 UTC (permalink / raw)
  To: Hendrik Brueckner, Valentin Vidic
  Cc: Heiko Carstens, Vasily Gorbik, linux-s390, linux-kernel,
	Philipp Kern, Benjamin Zimmermann, debian-s390,
	Peter Oberparleiter



On 28.04.21 15:38, Hendrik Brueckner wrote:
> Hi Valentin,
> 
> I just had the chance to look into this console topic yesterday.
> 
> On Tue, Apr 27, 2021 at 09:40:10PM +0200, Valentin Vidic wrote:
>> Console name reported in /proc/consoles:
>>
>>    ttyS1                -W- (EC p  )    4:65
> 
> It is been a while ago when working on consoles. However, consoles are
> typically devices without having a device node associated. There is special
> handling for /dev/console wrt. to the preferred console in the tty layer.
> 
> A console device might be associated with a tty device but this is not a
> requirement. For example, consider the net console that streams console
> messages thru UDP and is not associated with a tty.
> 
> Because console and tty are different devices, names can also be different
> which is, unfortunately, the case on s390.

another example is the ttyS0 console which is called sclp_line0 as a tty.
Doesnt the debian installer thus also fails when running in an LPAR?

It might still be a good idea to actually change the console name for the
ascii console as you patch does.

> Therefore my suggestion here is not derive the tty device from the name
> of the console, but rather looking at the associated tty being reported
> as major minor number in /proc/console.

So yes we should definitely try to fix the installer program as well. All other
distros seem to handle this case fine.

> 
>>
>> does not match the char device name:
>>
>>    crw--w----    1 root     root        4,  65 May 17 12:18 /dev/ttysclp0
> 
> In the example above, 4:65 excactly ends up in /dev/ttysclp0.
> 
> I am also in contact with Christian and thanks to him to try this out
> internally.  At least, there are options to bring this forward and let's
> figure out what the best solution will be.
> 
> Thanks and kind regards,
>    Hendrik
> 
h

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

* Re: [PATCH v2] s390/sclp_vt220: Fix console name to match device
  2021-04-28 13:38   ` Hendrik Brueckner
  2021-04-28 14:44     ` Christian Borntraeger
@ 2021-04-28 16:13     ` Valentin Vidić
  1 sibling, 0 replies; 10+ messages in thread
From: Valentin Vidić @ 2021-04-28 16:13 UTC (permalink / raw)
  To: Hendrik Brueckner
  Cc: Christian Borntraeger, Heiko Carstens, Vasily Gorbik, linux-s390,
	linux-kernel, Philipp Kern, Benjamin Zimmermann, debian-s390,
	Peter Oberparleiter

On Wed, Apr 28, 2021 at 03:38:36PM +0200, Hendrik Brueckner wrote:
> It is been a while ago when working on consoles. However, consoles are
> typically devices without having a device node associated. There is special
> handling for /dev/console wrt. to the preferred console in the tty layer.
> 
> A console device might be associated with a tty device but this is not a
> requirement. For example, consider the net console that streams console
> messages thru UDP and is not associated with a tty.
> 
> Because console and tty are different devices, names can also be different
> which is, unfortunately, the case on s390.
> 
> Therefore my suggestion here is not derive the tty device from the name
> of the console, but rather looking at the associated tty being reported
> as major minor number in /proc/console.

Yes, I see what you mean. Loading netconsole produces a line in
/proc/consoles without the major:minor numbers:

  tty0                 -WU (EC p  )    4:7
  netcon0              -W- (E  p  )

On the other hand /proc/consoles documentation seems to suggest these
are character device names:
https://www.kernel.org/doc/html/latest/filesystems/proc.html#proc-consoles

Since sclp_vt220 seems to be the only know exception we are trying
to solve in that direction now.

If this does not work out, the alternative is as you suggested to take
the major:minor numbers and read the char device name from the symlink:

lrwxrwxrwx 1 root root 0 Apr 28 17:00 /sys/dev/char/4:7 -> ../../devices/virtual/tty/tty7

-- 
Valentin

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

end of thread, other threads:[~2021-04-28 16:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-19 18:16 [PATCH] s390/sclp_vt220: Fix console name to match device Valentin Vidic
2020-05-20  5:25 ` Christian Borntraeger
2020-05-20  7:07   ` Valentin Vidić
2020-05-20  7:14     ` Christian Borntraeger
2020-05-20  8:04       ` Valentin Vidić
2021-04-27 19:40 ` [PATCH v2] " Valentin Vidic
2021-04-28 12:39   ` Christian Borntraeger
2021-04-28 13:38   ` Hendrik Brueckner
2021-04-28 14:44     ` Christian Borntraeger
2021-04-28 16:13     ` Valentin Vidić

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).