Skip to contentSkip to conversation

2.6.26-rcX VC console scrolling regression

DISCUSSION David Miller 4 participants 10 messages May 8, 2008 – May 10, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

This change:

commit c9e587abfdec2c2aaa55fab83bcb4972e2f84f9b

Author: Jan Engelhardt <[email protected]>
Date:   Tue Apr 29 00:59:46 2008 -0700

vt: fix background color on line feed

A command that causes a line feed while a background color is active, such as

perl -e 'print "x" x 60, "\e[44m", "x" x 40, "\e[0m\n"'
and
perl -e 'print "x" x 40, "\e[44m\n", "x" x 40, "\e[0m\n"'

causes the line that was started as a result of the line feed to be completely filled with the currently active background color instead of the default color.

When scrolling, part of the current screen is memcpy'd/memmove'd to the new region, and the new line(s) that will appear as a result are cleared using memset. However, the lines are cleared with vc->vc_video_erase_char, causing them to be colored with the currently active background color. This is different from X11 terminal emulators which always paint the new lines with the default background color (e.g. xterm -bg black).

The clear operation (\e[1J and \e[2J) also use vc_video_erase_char, so a new vc->vc_scrl_erase_char is introduced with contains the erase character used for scrolling, which is built from vc->vc_def_color instead of vc->vc_color.

Causes garbage characters to appear at the end of lines on my VCs when scrolling.

They look like lowercase 'c' characters with a '.' above them, and they are colored light blue. The rest of the console text is fine.

I think it might be because my VC gets put into a UTF8 mode or something like that via the init scripts? It seems to start happening right when the init scripts print "Setting up console font and keymap", which seems to come from /etc/init.d/console-setup which runs /bin/setupcon

This is with a stock Ubuntu 7.10 installation.

#1 lore raw
Quoted 44 lines · On Wed, 07 May 2008 21:46:37 -0700 (PDT) David Miller <[email protected]>…

This change:

commit c9e587abfdec2c2aaa55fab83bcb4972e2f84f9b

Author: Jan Engelhardt <[email protected]>
Date:   Tue Apr 29 00:59:46 2008 -0700

vt: fix background color on line feed

A command that causes a line feed while a background color is active, such as

perl -e 'print "x" x 60, "\e[44m", "x" x 40, "\e[0m\n"'
and
perl -e 'print "x" x 40, "\e[44m\n", "x" x 40, "\e[0m\n"'

causes the line that was started as a result of the line feed to be completely filled with the currently active background color instead of the default color.

When scrolling, part of the current screen is memcpy'd/memmove'd to the new region, and the new line(s) that will appear as a result are cleared using memset. However, the lines are cleared with vc->vc_video_erase_char, causing them to be colored with the currently active background color. This is different from X11 terminal emulators which always paint the new lines with the default background color (e.g. xterm -bg black).

The clear operation (\e[1J and \e[2J) also use vc_video_erase_char, so a new vc->vc_scrl_erase_char is introduced with contains the erase character used for scrolling, which is built from vc->vc_def_color instead of vc->vc_color.

Causes garbage characters to appear at the end of lines on my VCs when scrolling.

They look like lowercase 'c' characters with a '.' above them, and they are colored light blue. The rest of the console text is fine.

Quoted 6 lines

I think it might be because my VC gets put into a UTF8 mode or something like that via the init scripts? It seems to start happening right when the init scripts print "Setting up console font and keymap", which seems to come from /etc/init.d/console-setup which runs /bin/setupcon

This is with a stock Ubuntu 7.10 installation.

Thanks, Dave. I queued the revert but I'll hold off for 48-odd hours if that's OK - it might just be something silly.

If we continue in this way, patch-2.6.26 will consist solely of:

Makefile +1 -1
@@ -1,6 +1,6 @@
 VERSION = 2
 PATCHLEVEL = 6
-SUBLEVEL = 25
+SUBLEVEL = 26
 EXTRAVERSION =
 NAME = Funky Weasel is Jiggy wit it
 

:(

#3 lore raw
In reply to David Miller
Quoted 6 lines · David Miller

Causes garbage characters to appear at the end of lines on my VCs when scrolling.

They look like lowercase 'c' characters with a '.' above them, and they are colored light blue. The rest of the console text is fine.

i386 or sparc64?

In trying to reproduce it, Ubuntu already died on me (insert big rant here) and I have no idea how to fix that if I want to keep the stockness of the install:

-->>>--
sd 2:0:0:0: [sdb] Write Protect is off
sd 2:0:0:0: [sdb] Cache data unavailable
sd 2:0:0:0: [sdb] Assuming drive cache: write through
sdb: sdb1 sdb2 < sdb5 >
sd 2:0:0:0: [sdb] Attached SCSI disk
sd 2:0:0:0: Attached scsi generic sg2 type 0
Done.
Begin: Running /scripts/local-premount ...
Done.
mount: Mounting /dev/sdb1 on /root failed: No such device
Begin: Running /scripts/local-bottom ...
Done.
Done.
Begin: Running /scripts/init-bottom ...
mount: Mounting /root/dev on /dev/.static/dev failed: No such file or directory. Done.
mount: Mounting /sys on /root/sys failed: No such file or directory
mount: Mounting /proc on /root/proc failed: No such file or directory Target filesystem doesn't have /sbin/init

BusyBox v1.1.3 (Debian 1:1.1.3-5ubuntu7) Built-in shell (ash) Enter 'help' for a list of built-in commands.

(initramfs)
---<<<---

Quoted 2 lines

I think it might be because my VC gets put into a UTF8 mode or something like that via the init scripts?

opensuse also switches to utf8 (though noting that the kernel starts with utf8 by default since 2.6.24) and I have not noticed anything bad.

Are you using a serial console?

Quoted 6 lines

It seems to start happening right when
the init scripts print "Setting up console font and keymap", which seems to come from /etc/init.d/console-setup which runs /bin/setupcon

This is with a stock Ubuntu 7.10 installation.

#4 lore raw

From: Jan Engelhardt <[email protected]>
Date: Thu, 8 May 2008 11:13:37 +0200 (CEST)

Quoted 10 lines · David Miller
Quoted 6 lines

Causes garbage characters to appear at the end of lines on my VCs when scrolling.

They look like lowercase 'c' characters with a '.' above them, and they are colored light blue. The rest of the console text is fine.

i386 or sparc64?

sparc64.

Quoted 1 line

Are you using a serial console?

:-/ No, why would I report a VC console output bug if I were using a serial console?

#5 lore raw
In reply to David Miller
Quoted 4 lines · David Miller

Causes garbage characters to appear at the end of lines on my VCs when scrolling.

(Gotten past the initramfs now..)

Quoted 7 lines

They look like lowercase 'c' characters with a '.' above them, and they are colored light blue. The rest of the console text is fine. I think it might be because my VC gets put into a UTF8 mode or something like that via the init scripts? It seems to start happening right when the init scripts print "Setting up console font and keymap", which seems to come from /etc/init.d/console-setup which runs /bin/setupcon This is with a stock Ubuntu 7.10 installation.

I "reproduced" it this way on Ubuntu on i386 with fbcon (which you are likely to be using on sparc64), when switching from a 256 to 512-glyph font. So far, only Ubuntu seems to exhibit this problem, I am going to test Fedora for its fitness now.

# Right after boot...
showconsolefont
# Trigger
setfont Arabic-VGA16
showconsolefont

# Resolve bug with 'reset'

	reset
	while $not_scrolled; do
		showconsolefont
	done;

My guess is that you see the effects of incomplete font table/position switching, something along the lines a cat /dev/urandom would cause. Using the very same kernel and boot params (vga=791 or anything to switch it to fbcon), I cannot trigger the problem on opensuse.

#2 lore raw
In reply to Andrew Morton
Quoted 13 lines · Andrew Morton

If we continue in this way, patch-2.6.26 will consist solely of:

Makefile +1 -1
@@ -1,6 +1,6 @@
 VERSION = 2
 PATCHLEVEL = 6
-SUBLEVEL = 25
+SUBLEVEL = 26
 EXTRAVERSION =
 NAME = Funky Weasel is Jiggy wit it
 
Quoted 1 line

:(

Why the frowny face. That would be beautiful ;)

Linus

#6 lore raw
In reply to Jan Engelhardt

From: Jan Engelhardt <[email protected]>
Date: Thu, 8 May 2008 13:50:57 +0200 (CEST)

Quoted 4 lines

My guess is that you see the effects of incomplete font table/position switching, something along the lines a cat /dev/urandom would cause. Using the very same kernel and boot params (vga=791 or anything to switch it to fbcon), I cannot trigger the problem on opensuse.

Jan, there is code in drivers/video/console/fbcon.c:fbcon_do_set_font() which makes changes to vc->vc_video_erase_char, maybe that code needs to update the new vc->vc_scrl_erase_char you added?

It would be nice if you could audit the tree to see if any other cases have been missed like this as well.

#7 lore raw
Quoted 5 lines · David Miller
Quoted 4 lines

My guess is that you see the effects of incomplete font table/position switching, something along the lines a cat /dev/urandom would cause. Using the very same kernel and boot params (vga=791 or anything to switch it to fbcon), I cannot trigger the problem on opensuse.

Quoted 7 lines

Jan, there is code in drivers/video/console/fbcon.c:fbcon_do_set_font() which makes changes to vc->vc_video_erase_char, maybe that code needs to update the new vc->vc_scrl_erase_char you added?

It would be nice if you could audit the tree to see if any other cases have been missed like this as well.

Try this patch please.

---
 drivers/video/console/fbcon.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
drivers/video/console/fbcon.c +9 -1
index ca2a543..774f803 100644
@@ -2508,6 +2508,9 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
 			c = vc->vc_video_erase_char;
 			vc->vc_video_erase_char =
 			    ((c & 0xfe00) >> 1) | (c & 0xff);
+			c = vc->vc_def_color;
+			vc->vc_scrl_erase_char =
+			    ((c & 0xFE00) >> 1) | (c & 0xFF);
 			vc->vc_attr >>= 1;
 		}
 	} else if (!vc->vc_hi_font_mask && cnt == 512) {
@@ -2538,9 +2541,14 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
 			if (vc->vc_can_do_color) {
 				vc->vc_video_erase_char =
 				    ((c & 0xff00) << 1) | (c & 0xff);
+				c = vc->vc_def_color;
+				vc->vc_scrl_erase_char =
+				    ((c & 0xFF00) << 1) | (c & 0xFF);
 				vc->vc_attr <<= 1;
-			} else
+			} else {
 				vc->vc_video_erase_char = c & ~0x100;
+				vc->vc_scrl_erase_char = c & ~0x100;
+			}
 		}
 
 	}
Signature · 1 line
1.5.5.1
author Acked-by
#8 lore raw

From: Jan Engelhardt <[email protected]>
Date: Fri, 9 May 2008 21:24:20 +0200 (CEST)

Quoted 7 lines · David Miller
Quoted 5 lines
Quoted 4 lines

My guess is that you see the effects of incomplete font table/position switching, something along the lines a cat /dev/urandom would cause. Using the very same kernel and boot params (vga=791 or anything to switch it to fbcon), I cannot trigger the problem on opensuse.

Quoted 8 lines
Quoted 7 lines

Jan, there is code in drivers/video/console/fbcon.c:fbcon_do_set_font() which makes changes to vc->vc_video_erase_char, maybe that code needs to update the new vc->vc_scrl_erase_char you added?

It would be nice if you could audit the tree to see if any other cases have been missed like this as well.

Try this patch please.

That seems to fix the bug, thanks Jan.