2006-02-25 00:09:58

by Chuck Ebbert

[permalink] [raw]
Subject: [patch] x86: clean up early_printk output

early_printk() starts output on the second screen line and doesn't
clear the rest of the line when it hits a newline char. When there
is already a BIOS message there, it becomes hard to read. Change
this so it starts on the first line and clears to EOL upon hitting
newline.

Signed-off-by: Chuck Ebbert <[email protected]>

--- 2.6.16-rc4-64.orig/arch/x86_64/kernel/early_printk.c
+++ 2.6.16-rc4-64/arch/x86_64/kernel/early_printk.c
@@ -21,7 +21,15 @@
#define MAX_XPOS max_xpos

static int max_ypos = 25, max_xpos = 80;
-static int current_ypos = 1, current_xpos = 0;
+static int current_ypos, current_xpos; /* 0,0 */
+
+static noinline void clear_to_eol(int xpos, int ypos)
+{
+ int i;
+
+ for (i = xpos; i < MAX_XPOS; i++)
+ writew(0x720, VGABASE + 2*(MAX_XPOS*ypos + i));
+}

static void early_vga_write(struct console *con, const char *str, unsigned n)
{
@@ -37,11 +45,11 @@ static void early_vga_write(struct conso
VGABASE + 2*(MAX_XPOS*j + i));
}
}
- for (i = 0; i < MAX_XPOS; i++)
- writew(0x720, VGABASE + 2*(MAX_XPOS*j + i));
+ clear_to_eol(0, j);
current_ypos = MAX_YPOS-1;
}
if (c == '\n') {
+ clear_to_eol(current_xpos, current_ypos);
current_xpos = 0;
current_ypos++;
} else if (c != '\r') {
--
Chuck
"Equations are the Devil's sentences." --Stephen Colbert


2006-02-25 02:08:41

by Andrew Morton

[permalink] [raw]
Subject: Re: [patch] x86: clean up early_printk output

Chuck Ebbert <[email protected]> wrote:
>
> early_printk() starts output on the second screen line and doesn't
> clear the rest of the line when it hits a newline char. When there
> is already a BIOS message there, it becomes hard to read. Change
> this so it starts on the first line and clears to EOL upon hitting
> newline.

This conflicts in intent with Stas's patch:

ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.16-rc4/2.6.16-rc4-mm2/broken-out/x86-early-printk-handling-fixes.patch

that patch solves the same problem, and I think in a slightly better way:
at least there's a chance that some of those (potentially useful)
bootloader messages are still visible when the kernel goes tits up.

Of course, the best fix would be to start the kernel messages at the next
line after the bootloader, but I guess that info would be hard to locate.

2006-02-25 04:41:13

by Andi Kleen

[permalink] [raw]
Subject: Re: [patch] x86: clean up early_printk output

On Saturday 25 February 2006 01:07, Chuck Ebbert wrote:
> early_printk() starts output on the second screen line and doesn't
> clear the rest of the line when it hits a newline char. When there
> is already a BIOS message there, it becomes hard to read. Change
> this so it starts on the first line and clears to EOL upon hitting
> newline.

early_printk is designed to do absolutely minimal work to get the
message out. Your patch adds too much potential disturbance
imho.

-Andi

2006-02-25 06:29:34

by Chuck Ebbert

[permalink] [raw]
Subject: Re: [patch] x86: clean up early_printk output

In-Reply-To: <[email protected]>

On Sat, 25 Feb 2006 at 05:29:10 +0100, Andi Kleen wrote:

> early_printk is designed to do absolutely minimal work to get the
> message out. Your patch adds too much potential disturbance
> imho.

You're kidding... right?

early_printk copies the entire screen up, line-by-line, in order to do
scrolling, then blanks the bottom line using the exact code I used to
clear to EOL. How can that be OK if my fix isn't?

--
Chuck
"Equations are the Devil's sentences." --Stephen Colbert