2001-10-16 10:32:32

by P.Agenbag

[permalink] [raw]
Subject: P4 problems

Hi, I have P4 1,4 running on Garibaldi Intel board. Can compile and boot
the 2.4.7 kernel without problems (writing this message from the 2.4.7
kernel). However, when trying to boot the 2.4.10 or 2.4.12 kernel, it
hangs directly as booting starts. The same hard drive transferred to an
AMD athlon 1GHz boots up perfectly, even though the kernel is compiled
for Intel P4!

Please can someone help me, I need to get 2.4.10 or 2.4.12 running asap!

Thanks.



2001-10-16 11:42:15

by Keith Owens

[permalink] [raw]
Subject: Re: P4 problems

On Tue, 16 Oct 2001 12:22:19 +0200,
"P.Agenbag" <[email protected]> wrote:
>Hi, I have P4 1,4 running on Garibaldi Intel board. Can compile and boot
>the 2.4.7 kernel without problems (writing this message from the 2.4.7
>kernel). However, when trying to boot the 2.4.10 or 2.4.12 kernel, it
>hangs directly as booting starts. The same hard drive transferred to an
>AMD athlon 1GHz boots up perfectly, even though the kernel is compiled
>for Intel P4!

If nobody can point to a known bug, try this to localize the problem.

===========

If a kernel hangs early in the boot process (before the console has
been initialized) then printk is no use because you never see the
output. There is a technique for using the video display to indicate
boot progress so you can localize the problem. Reporting "my kernel
hangs during boot at line nnn in routine xyz" is a lot better than "my
kernel hangs during boot".

The idea is to write characters direct to the video screen during
booting using a macro called VIDEO_CHAR. This macro takes a character
position and a single character value to be displayed. Use different
positions on the screen for different levels of code and use different
characters in one position to indicate which stage that level is up to.
For example, with the patch below, the string EAC at hang indicates
parse_options(), checksetup().

The patch below is generic, except for the definition of VIDEO_CHAR
which is ix86 specific. If this patch ever becomes part of the main
kernel then VIDEO_CHAR needs to be moved to an arch specific header.
If any arch other than ix86 uses this technique, please mail
[email protected] with your definition of VIDEO_CHAR.

You can plant VIDEO_CHAR calls anywhere you like, up to the call to
mem_init(). After mem_init has done its work and memory has been
remapped, VIDEO_CHAR cannot write to video memory, it will oops.
However by then the console has been initialized so you can use printk.

Demonstration patch against 2.4.7. This only uses screen positions 0,
1, 2. If you want to drill down into lower level routines, just use
screen positions 3 onwards. To activate the debugging, add
#define DEBUG_VIDEO_CHAR
to the start of init/main.c. If the machine is hanging then a zero
delay is fine, if it is rebooting then you need a delay to note the
characters in the top left hand corner of the screen before it reboots.
#define VIDEO_CHAR_DELAY_COUNT 100000000
A value around your clock speed gives a delay of approx. 1 second.

Index: 7.9/init/main.c
--- 7.9/init/main.c Fri, 06 Jul 2001 09:49:24 +1000 kaos (linux-2.4/k/11_main.c 1.1.5.1.1.8.1.3 644)
+++ 7.9(w)/init/main.c Sun, 22 Jul 2001 23:27:38 +1000 kaos (linux-2.4/k/11_main.c 1.1.5.1.1.8.1.3 644)
@@ -80,6 +80,16 @@ extern int irda_device_init(void);
#error Sorry, your GCC is too old. It builds incorrect kernels.
#endif

+#ifdef DEBUG_VIDEO_CHAR
+#ifndef VIDEO_CHAR_DELAY_COUNT
+#define VIDEO_CHAR_DELAY_COUNT 0
+#endif
+/* ix86 specific */
+#define VIDEO_CHAR(c, v) { int i; *((volatile char *)(0xb8000 + 2*(c))) = (v); for (i = 0; i < VIDEO_CHAR_DELAY_COUNT; ++i) ; }
+#else
+#define VIDEO_CHAR(c, v)
+#endif
+
extern char _stext, _etext;
extern char *linux_banner;

@@ -421,12 +431,14 @@ static void __init parse_options(char *l
char *next,*quote;
int args, envs;

+ VIDEO_CHAR(1, 'A');
if (!*line)
return;
args = 0;
envs = 1; /* TERM is set to 'linux' by default */
next = line;
while ((line = next) != NULL) {
+ VIDEO_CHAR(2, 'A');
quote = strchr(line,'"');
next = strchr(line, ' ');
while (next != NULL && quote != NULL && quote < next) {
@@ -439,9 +451,11 @@ static void __init parse_options(char *l
next = strchr(next+1, ' ');
}
}
+ VIDEO_CHAR(2, 'B');
if (next != NULL)
*next++ = 0;
if (!strncmp(line,"init=",5)) {
+ VIDEO_CHAR(3, 'A');
line += 5;
execute_command = line;
/* In case LILO is going to boot us with default command line,
@@ -452,8 +466,10 @@ static void __init parse_options(char *l
args = 0;
continue;
}
+ VIDEO_CHAR(2, 'C');
if (checksetup(line))
continue;
+ VIDEO_CHAR(2, 'D');

/*
* Then check if it's an environment variable or
@@ -469,9 +485,12 @@ static void __init parse_options(char *l
if (*line)
argv_init[++args] = line;
}
+ VIDEO_CHAR(2, 'E');
}
+ VIDEO_CHAR(1, 'B');
argv_init[args+1] = NULL;
envp_init[envs+1] = NULL;
+ VIDEO_CHAR(1, 'C');
}


@@ -530,16 +549,27 @@ asmlinkage void __init start_kernel(void
* Interrupts are still disabled. Do necessary setups, then
* enable them
*/
+ VIDEO_CHAR(0, 'A');
lock_kernel();
+ VIDEO_CHAR(0, 'B');
printk(linux_banner);
+ VIDEO_CHAR(0, 'C');
setup_arch(&command_line);
+ VIDEO_CHAR(0, 'D');
printk("Kernel command line: %s\n", saved_command_line);
+ VIDEO_CHAR(0, 'E');
parse_options(command_line);
+ VIDEO_CHAR(0, 'F');
trap_init();
+ VIDEO_CHAR(0, 'G');
init_IRQ();
+ VIDEO_CHAR(0, 'H');
sched_init();
+ VIDEO_CHAR(0, 'I');
softirq_init();
+ VIDEO_CHAR(0, 'J');
time_init();
+ VIDEO_CHAR(0, 'K');

/*
* HACK ALERT! This is early. We're enabling the console before
@@ -547,8 +577,10 @@ asmlinkage void __init start_kernel(void
* this. But we do want output early, in case something goes wrong.
*/
console_init();
+ VIDEO_CHAR(0, 'L');
#ifdef CONFIG_MODULES
init_modules();
+ VIDEO_CHAR(0, 'M');
#endif
if (prof_shift) {
unsigned int size;
@@ -559,10 +591,14 @@ asmlinkage void __init start_kernel(void
size = prof_len * sizeof(unsigned int) + PAGE_SIZE-1;
prof_buffer = (unsigned int *) alloc_bootmem(size);
}
+ VIDEO_CHAR(0, 'N');

kmem_cache_init();
+ VIDEO_CHAR(0, 'O');
sti();
+ VIDEO_CHAR(0, 'P');
calibrate_delay();
+ VIDEO_CHAR(0, 'Q');
#ifdef CONFIG_BLK_DEV_INITRD
if (initrd_start && !initrd_below_start_ok &&
initrd_start < min_low_pfn << PAGE_SHIFT) {
@@ -570,6 +606,7 @@ asmlinkage void __init start_kernel(void
"disabling it.\n",initrd_start,min_low_pfn << PAGE_SHIFT);
initrd_start = 0;
}
+ VIDEO_CHAR(0, 'R');
#endif
mem_init();
kmem_cache_sizes_init();

2001-10-16 12:12:20

by Paul Komkoff

[permalink] [raw]
Subject: Re: P4 problems

-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Replying to Keith Owens:
> If nobody can point to a known bug, try this to localize the problem.

I think this is a well-known bug. In apic init, we got cpu frequency xxxx.yy
mhz, then bus frequency 0.000
then we hang

:)

( don't know solution - just get rid of these p4 ... for now. maybe later )
- --
Paul P 'Stingray' Komkoff 'Greatest' Jr // (icq)23200764 // (irc)Spacebar
PPKJ1-RIPE // (smtp)[email protected] // (http)stingr.net // (pgp)0xA4B4ECA4
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAjvMJBUACgkQyMW8naS07KTMMwCff6bu3OsFNhvRpHWzl2enIQMN
issAn2qa71tBd86PVd47yEmY7YgS8zHa
=GJZ4
-----END PGP SIGNATURE-----

2001-10-16 13:14:44

by Ravindra Jaju

[permalink] [raw]
Subject: Re: P4 problems

On Tue, Oct 16, 2001 at 04:12:09PM +0400, Paul P Komkoff Jr wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
>
> Replying to Keith Owens:
> > If nobody can point to a known bug, try this to localize the problem.
>
> I think this is a well-known bug. In apic init, we got cpu frequency xxxx.yy
> mhz, then bus frequency 0.000
> then we hang
>
> :)
>
> ( don't know solution - just get rid of these p4 ... for now. maybe later )

I thought this was some bug in some chipset I use, and enabled
* chipset bugfix/support
options in my .config

****
[*] CMD640 chipset bugfix/support
[*] CMD640 enhanced support
[*] RZ1000 chipset bugfix/support
[*] Generic PCI IDE chipset support
[*] Sharing PCI IDE interrupts support
[*] Generic PCI bus-master DMA support
****

And I could boot.

I'm no expert, so if this information helps, good.

--
jaju

2001-10-16 18:52:53

by Martin J. Bligh

[permalink] [raw]
Subject: Re: P4 problems

> The idea is to write characters direct to the video screen during
> booting using a macro called VIDEO_CHAR. This macro takes a character
> position and a single character value to be displayed. Use different
> positions on the screen for different levels of code and use different
> characters in one position to indicate which stage that level is up to.
> For example, with the patch below, the string EAC at hang indicates
> parse_options(), checksetup().

I have a slightly more complex verson of this which does a whole printk,
and you can embed values, strings, etc. Same fundamental idea - ram
stuff directly into the video buffer. It's not pretty or portable, but then again,
it's for early debug only, so deal with it ;-) We really ought to make
everything before console_init use early_printk, which would be #defined
to printk by default, and this on x86. Maybe. One day. Maybe ;-)

Disclaimer: I tried this on 2.4.12 the other day, and didn't get it working
in the 2 minutes I spent before guessing what the problem was. But it
worked beautifully on 2.4.0-test8, which was last time I used it. Should
work fine though .... it's pretty simple. It's not a patch style, it's a .c
file that I just #include whereever I'm working (because I'm an evil
dirty hacker). Feel free to make it prettier if anyone feels so inclined.

Bits of code shamelessly stolen from the bootstrap stuff.

/* Martin J. Bligh <[email protected]> */
/* Bits of code shamelessly stolen from the bootstrap stuff. */


#define VIDMEMBUF 0xB800


int orig_x = 0;
int orig_y = 0;
int vidport = 0x3d4;


void early_scroll(void)
{
int i, cols = 80, lines = 25;
unsigned char *vidmem = phys_to_virt(VIDMEMBUF);


memcpy ( vidmem, vidmem + cols * 2, ( lines - 1 ) * cols * 2 );
for ( i = ( lines - 1 ) * cols * 2; i < lines * cols * 2; i += 2 )
vidmem[i] = ' ';
}


void clearvidmem(void)
{
int x, y, pos = 0;
unsigned char *vidmem = phys_to_virt(VIDMEMBUF);


for (x = 0; x < 80; x++) {
for (y = 0; y < 25; y++) {
vidmem [ ( x + 80 * y ) * 2 ] = ' ';
}
}
orig_x = 0;
orig_y = 0;


/* Update cursor position */
outb_p(14, vidport);
outb_p(0xff & (pos >> 9), vidport+1);
outb_p(15, vidport);
outb_p(0xff & (pos >> 1), vidport+1);
}


void pokevidmem(int x, int y, char c)
{
unsigned char *vidmem = phys_to_virt(VIDMEMBUF);


vidmem [ ( x + 80 * y ) * 2 ] = c;
}


void spin_on_me(int howlong)
{
int i, j;


for (i=0; i<howlong; ++i)
for (j=0; j<10000; ++j) /* spin 1 sec */
udelay(100);
}


void early_puts(const char *s)
{
int x,y,pos, cols = 80, lines = 25;
char c;


x = orig_x;
y = orig_y;


while ( ( c = *s++ ) != '\0' ) {
if ( c == '\n' ) {
x = 0;
if ( ++y >= lines ) {
early_scroll();
y--;
}
} else {
pokevidmem (x, y, c);
if ( ++x >= cols ) {
x = 0;
if ( ++y >= lines ) {
early_scroll();
y--;
}
}
}
}


orig_x = x;
orig_y = y;


pos = (x + cols * y) * 2; /* Update cursor position */
outb_p(14, vidport);
outb_p(0xff & (pos >> 9), vidport+1);
outb_p(15, vidport);
outb_p(0xff & (pos >> 1), vidport+1);
}


void early_printk(const char *fmt, ...)
{
va_list args;
int i;
char buf[1024];


va_start(args, fmt);
i = vsprintf(buf, fmt, args); /* hopefully i < sizeof(buf)-4 */
va_end(args);
early_puts(buf);
printk(buf);
}