* [PATCH 1/2] s390/sclp: deactivate sclp after all its users
2024-10-14 5:50 [PATCH 0/2] s390: two bugfixes (for kunit) Thomas Weißschuh
@ 2024-10-14 5:50 ` Thomas Weißschuh
2024-10-14 5:50 ` [PATCH 2/2] s390/sclp_vt220: convert newlines to CRLF instead of LFCR Thomas Weißschuh
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2024-10-14 5:50 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
Christian Borntraeger, Sven Schnelle, Guilherme G. Piccoli
Cc: linux-s390, linux-kernel, Thomas Weißschuh, stable
On reboot the SCLP interface is deactivated through a reboot notifier.
This happens before other components using SCLP have the chance to run
their own reboot notifiers.
Two of those components are the SCLP console and tty drivers which try
to flush the last outstanding messages.
At that point the SCLP interface is already unusable and the messages
are discarded.
Execute sclp_deactivate() as late as possible to avoid this issue.
Fixes: 4ae46db99cd8 ("s390/consoles: improve panic notifiers reliability")
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
drivers/s390/char/sclp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/s390/char/sclp.c b/drivers/s390/char/sclp.c
index f3621adbd5debc59d2b71fc1be2790e0cbd31f76..fbffd451031fdb526d9b802da50df7f3eba5c48e 100644
--- a/drivers/s390/char/sclp.c
+++ b/drivers/s390/char/sclp.c
@@ -1195,7 +1195,8 @@ sclp_reboot_event(struct notifier_block *this, unsigned long event, void *ptr)
}
static struct notifier_block sclp_reboot_notifier = {
- .notifier_call = sclp_reboot_event
+ .notifier_call = sclp_reboot_event,
+ .priority = INT_MIN,
};
static ssize_t con_pages_show(struct device_driver *dev, char *buf)
--
2.47.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/2] s390/sclp_vt220: convert newlines to CRLF instead of LFCR
2024-10-14 5:50 [PATCH 0/2] s390: two bugfixes (for kunit) Thomas Weißschuh
2024-10-14 5:50 ` [PATCH 1/2] s390/sclp: deactivate sclp after all its users Thomas Weißschuh
@ 2024-10-14 5:50 ` Thomas Weißschuh
2024-10-14 8:54 ` [PATCH 0/2] s390: two bugfixes (for kunit) Sven Schnelle
2024-10-14 9:02 ` Heiko Carstens
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2024-10-14 5:50 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
Christian Borntraeger, Sven Schnelle, Guilherme G. Piccoli
Cc: linux-s390, linux-kernel, Thomas Weißschuh, stable
According to the VT220 specification the possible character combinations
sent on RETURN are only CR or CRLF [0].
The Return key sends either a CR character (0/13) or a CR
character (0/13) and an LF character (0/10), depending on the
set/reset state of line feed/new line mode (LNM).
The sclip/vt220 driver however uses LFCR. This can confuse tools, for
example the kunit runner.
Link: https://vt100.net/docs/vt220-rm/chapter3.html#S3.2
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
I'm not entirely sure that SCLP is meant to follow the VT220 standard
here. The only other reference observation I found is the QEMU code and
they are doing "what Linux does".
It would also be possible to hack around this in the kunit runner.
---
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 218ae604f737ff9e20764ebce857ce427e4a7c44..33b9c968dbcba6584015d70a8500f9f5f70227db 100644
--- a/drivers/s390/char/sclp_vt220.c
+++ b/drivers/s390/char/sclp_vt220.c
@@ -319,7 +319,7 @@ sclp_vt220_add_msg(struct sclp_vt220_request *request,
buffer = (void *) ((addr_t) sccb + sccb->header.length);
if (convertlf) {
- /* Perform Linefeed conversion (0x0a -> 0x0a 0x0d)*/
+ /* Perform Linefeed conversion (0x0a -> 0x0d 0x0a)*/
for (from=0, to=0;
(from < count) && (to < sclp_vt220_space_left(request));
from++) {
@@ -328,8 +328,8 @@ sclp_vt220_add_msg(struct sclp_vt220_request *request,
/* Perform conversion */
if (c == 0x0a) {
if (to + 1 < sclp_vt220_space_left(request)) {
- ((unsigned char *) buffer)[to++] = c;
((unsigned char *) buffer)[to++] = 0x0d;
+ ((unsigned char *) buffer)[to++] = c;
} else
break;
--
2.47.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/2] s390: two bugfixes (for kunit)
2024-10-14 5:50 [PATCH 0/2] s390: two bugfixes (for kunit) Thomas Weißschuh
2024-10-14 5:50 ` [PATCH 1/2] s390/sclp: deactivate sclp after all its users Thomas Weißschuh
2024-10-14 5:50 ` [PATCH 2/2] s390/sclp_vt220: convert newlines to CRLF instead of LFCR Thomas Weißschuh
@ 2024-10-14 8:54 ` Sven Schnelle
2024-10-14 9:02 ` Heiko Carstens
3 siblings, 0 replies; 5+ messages in thread
From: Sven Schnelle @ 2024-10-14 8:54 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
Christian Borntraeger, Guilherme G. Piccoli, linux-s390,
linux-kernel, stable
Thomas Weißschuh <thomas.weissschuh@linutronix.de> writes:
> When trying to use kunit for s390 with
> ./tools/testing/kunit/kunit.py run --arch=s390 --kunitconfig drivers/base/test --cross_compile=$CROSS_COMPILE
> I ran into some bugs.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
> Thomas Weißschuh (2):
> s390/sclp: deactivate sclp after all its users
> s390/sclp_vt220: convert newlines to CRLF instead of LFCR
>
> drivers/s390/char/sclp.c | 3 ++-
> drivers/s390/char/sclp_vt220.c | 4 ++--
> 2 files changed, 4 insertions(+), 3 deletions(-)
> ---
> base-commit: 6485cf5ea253d40d507cd71253c9568c5470cd27
> change-id: 20241014-s390-kunit-47cbc26a99e6
Looks good to me. For both patches:
Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
Thanks!
Sven
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] s390: two bugfixes (for kunit)
2024-10-14 5:50 [PATCH 0/2] s390: two bugfixes (for kunit) Thomas Weißschuh
` (2 preceding siblings ...)
2024-10-14 8:54 ` [PATCH 0/2] s390: two bugfixes (for kunit) Sven Schnelle
@ 2024-10-14 9:02 ` Heiko Carstens
3 siblings, 0 replies; 5+ messages in thread
From: Heiko Carstens @ 2024-10-14 9:02 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
Sven Schnelle, Guilherme G. Piccoli, linux-s390, linux-kernel,
stable
On Mon, Oct 14, 2024 at 07:50:05AM +0200, Thomas Weißschuh wrote:
> When trying to use kunit for s390 with
> ./tools/testing/kunit/kunit.py run --arch=s390 --kunitconfig drivers/base/test --cross_compile=$CROSS_COMPILE
> I ran into some bugs.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
> Thomas Weißschuh (2):
> s390/sclp: deactivate sclp after all its users
> s390/sclp_vt220: convert newlines to CRLF instead of LFCR
>
> drivers/s390/char/sclp.c | 3 ++-
> drivers/s390/char/sclp_vt220.c | 4 ++--
> 2 files changed, 4 insertions(+), 3 deletions(-)
Applied, thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread