All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] v2.6.23-rc1 Sparc32 Serial Port Selection error
@ 2007-07-29  2:17 Mark Fortescue
  2007-07-29  5:53 ` David Miller
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Mark Fortescue @ 2007-07-29  2:17 UTC (permalink / raw)
  To: sparclinux

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2696 bytes --]

Hi David,

The serial console code selection code needs to select the ports the 
otherway around. The attached patch fixes the problem.

--- linux-test/arch/sparc/kernel/prom.c~	2007-07-28 21:02:31.000000000 +0100
+++ linux-test/arch/sparc/kernel/prom.c	2007-07-29 02:38:54.000000000 +0100
@@ -460,7 +460,7 @@
  		strcpy(of_console_path, dp->full_name);
  		if (!strcmp(type, "serial")) {
  			strcat(of_console_path,
-			       (skip ? ":b" : ":a"));
+			       (skip ? ":a" : ":b"));
  		}
  		break;


Appling this patch has allowd me to log the NULL pointer failure in 
sun4c_update_mmu_cache:

Sending DHCP requests ., OK
IP-Config: Got DHCP answer from 0.0.0.0, my address is 10.1.1.2
IP-Config: Complete:
       device=eth0, addr=10.1.1.2, mask=255.255.255.0, gw=10.1.1.32,
      host=10.1.1.2, domain=marknet, nis-domain=(none),
      bootserver=0.0.0.0, rootserver=10.1.1.4, rootpath=
Looking up port of RPC 100003/2 on 10.1.1.4
Looking up port of RPC 100005/1 on 10.1.1.4
VFS: Mounted root (nfs filesystem).
Freeing unused kernel memory: 132k freed
Unable to handle kernel NULL pointer dereference
tsk->{mm,active_mm}->context = ffffffff
tsk->{mm,active_mm}->pgd = f0005000
               \|/ ____ \|/
               "@'/ ,. \`@"
               /_| \__/ |_\
                  \__U_/
swapper(1): Oops [#1]
PSR: 00101fc5 PC: f002244c NPC: f0022450 Y: 1e000000    Not tainted
PC: <sun4c_update_mmu_cache+0x80/0x1bc>
%G: 00000040 f02cf95c  f02cf940 00000000  f02cf940 00000000  ff000000 00000030
%O: f02cec54 f0290660  00000040 f03012a0  00000048 f01277b8  ff0019e0 f00223fc
RPC: <sun4c_update_mmu_cache+0x30/0x1bc>
%L: 008010e6 f03012a0  f0060d34 f03012a0  00000010 000a00d2  ff000000 00000001
%I: f02c8d48 effc0000  c8f00389 00001000  00000048 f01277b8  ff001a48 f006145c
Caller[f006145c]: handle_mm_fault+0x66c/0x69c
Caller[f0061580]: get_user_pages+0xf4/0x1e8
Caller[f007903c]: get_arg_page+0x34/0x8c
Caller[f0079168]: copy_strings+0xd4/0x36c
Caller[f0079420]: copy_strings_kernel+0x20/0x30
Caller[f007a648]: do_execve+0xdc/0x1d0
Caller[f00146c4]: sparc_execve+0x40/0x78
Caller[f0011428]: syscall_is_too_hard+0x3c/0x40
Caller[f0081374]: dupfd+0xf0/0x114
Caller[f00100b4]: init_post+0x98/0xe8
Caller[f02aafb8]: __start_notes+0x6c8/0x708
Caller[f00141cc]: kernel_thread+0x3c/0x50
Caller[f01f3564]: rest_init+0x18/0x5c
Caller[f02ab2f8]: sun4m_init+0x1ac/0x328
Caller[f02aa790]: __bzero_end+0x1ec8/0x2028
Caller[0030509c]: 0x3050a4
Instruction DUMP: 80a0c002  22800008  c2010000 <c200e008> 80a04019 
3a800004  c2010000  10bffff8  88100003
Kernel panic - not syncing: Attempted to kill init!

Looks like the sun4c memory management system has got messed up again!!

Regards
 	Mark Fortescue.

[-- Attachment #2: Type: TEXT/PLAIN, Size: 374 bytes --]

--- linux-test/arch/sparc/kernel/prom.c~	2007-07-28 21:02:31.000000000 +0100
+++ linux-test/arch/sparc/kernel/prom.c	2007-07-29 02:38:54.000000000 +0100
@@ -460,7 +460,7 @@
 		strcpy(of_console_path, dp->full_name);
 		if (!strcmp(type, "serial")) {
 			strcat(of_console_path,
-			       (skip ? ":b" : ":a"));
+			       (skip ? ":a" : ":b"));
 		}
 		break;
 

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

* Re: [PATCH] v2.6.23-rc1 Sparc32 Serial Port Selection error
  2007-07-29  2:17 [PATCH] v2.6.23-rc1 Sparc32 Serial Port Selection error Mark Fortescue
@ 2007-07-29  5:53 ` David Miller
  2007-07-29  6:43 ` David Miller
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2007-07-29  5:53 UTC (permalink / raw)
  To: sparclinux

From: Mark Fortescue <mark@mtfhpc.demon.co.uk>
Date: Sun, 29 Jul 2007 03:17:39 +0100 (BST)

> Hi David,
> 
> The serial console code selection code needs to select the ports the 
> otherway around. The attached patch fixes the problem.
> 
> --- linux-test/arch/sparc/kernel/prom.c~	2007-07-28 21:02:31.000000000 +0100
> +++ linux-test/arch/sparc/kernel/prom.c	2007-07-29 02:38:54.000000000 +0100
> @@ -460,7 +460,7 @@
>   		strcpy(of_console_path, dp->full_name);
>   		if (!strcmp(type, "serial")) {
>   			strcat(of_console_path,
> -			       (skip ? ":b" : ":a"));
> +			       (skip ? ":a" : ":b"));
>   		}
>   		break;

Thanks for tracking this down, I'll have a look at it more
deeply and apply this.

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

* Re: [PATCH] v2.6.23-rc1 Sparc32 Serial Port Selection error
  2007-07-29  2:17 [PATCH] v2.6.23-rc1 Sparc32 Serial Port Selection error Mark Fortescue
  2007-07-29  5:53 ` David Miller
@ 2007-07-29  6:43 ` David Miller
  2007-07-29  7:55 ` Mark Fortescue
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2007-07-29  6:43 UTC (permalink / raw)
  To: sparclinux

From: Mark Fortescue <mark@mtfhpc.demon.co.uk>
Date: Sun, 29 Jul 2007 03:17:39 +0100 (BST)

> The serial console code selection code needs to select the ports the 
> otherway around. The attached patch fixes the problem.
> 
> --- linux-test/arch/sparc/kernel/prom.c~	2007-07-28 21:02:31.000000000 +0100
> +++ linux-test/arch/sparc/kernel/prom.c	2007-07-29 02:38:54.000000000 +0100
> @@ -460,7 +460,7 @@
>   		strcpy(of_console_path, dp->full_name);
>   		if (!strcmp(type, "serial")) {
>   			strcat(of_console_path,
> -			       (skip ? ":b" : ":a"));
> +			       (skip ? ":a" : ":b"));
>   		}
>   		break;

I don't understand this fix :-)

We set skip to "1" only if *romvec->pv_stdout is PROMDEV_TTYB,
therefore should definitely use ":b" when it is non-zero, which
is what the code is doing.

Perhaps the logic drivers/serial/sunzilog.c or
drivers/serial/suncore.c is what is reversed instead.


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

* Re: [PATCH] v2.6.23-rc1 Sparc32 Serial Port Selection error
  2007-07-29  2:17 [PATCH] v2.6.23-rc1 Sparc32 Serial Port Selection error Mark Fortescue
  2007-07-29  5:53 ` David Miller
  2007-07-29  6:43 ` David Miller
@ 2007-07-29  7:55 ` Mark Fortescue
  2007-07-29  8:00 ` David Miller
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Fortescue @ 2007-07-29  7:55 UTC (permalink / raw)
  To: sparclinux



On Sat, 28 Jul 2007, David Miller wrote:

> From: Mark Fortescue <mark@mtfhpc.demon.co.uk>
> Date: Sun, 29 Jul 2007 03:17:39 +0100 (BST)
>
>> The serial console code selection code needs to select the ports the
>> otherway around. The attached patch fixes the problem.
>>
>> --- linux-test/arch/sparc/kernel/prom.c~	2007-07-28 21:02:31.000000000 +0100
>> +++ linux-test/arch/sparc/kernel/prom.c	2007-07-29 02:38:54.000000000 +0100
>> @@ -460,7 +460,7 @@
>>   		strcpy(of_console_path, dp->full_name);
>>   		if (!strcmp(type, "serial")) {
>>   			strcat(of_console_path,
>> -			       (skip ? ":b" : ":a"));
>> +			       (skip ? ":a" : ":b"));
>>   		}
>>   		break;
>
> I don't understand this fix :-)
>
> We set skip to "1" only if *romvec->pv_stdout is PROMDEV_TTYB,
> therefore should definitely use ":b" when it is non-zero, which
> is what the code is doing.
>

Yes but then you do a !skip-- so 0 -> -1 and 1 -> 0


> Perhaps the logic drivers/serial/sunzilog.c or
> drivers/serial/suncore.c is what is reversed instead.
>
>

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

* Re: [PATCH] v2.6.23-rc1 Sparc32 Serial Port Selection error
  2007-07-29  2:17 [PATCH] v2.6.23-rc1 Sparc32 Serial Port Selection error Mark Fortescue
                   ` (2 preceding siblings ...)
  2007-07-29  7:55 ` Mark Fortescue
@ 2007-07-29  8:00 ` David Miller
  2007-07-29  8:42 ` Mark Fortescue
  2007-07-29  9:09 ` David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2007-07-29  8:00 UTC (permalink / raw)
  To: sparclinux

From: Mark Fortescue <mark@mtfhpc.demon.co.uk>
Date: Sun, 29 Jul 2007 08:55:25 +0100 (BST)

> Yes but then you do a !skip-- so 0 -> -1 and 1 -> 0

Indeed.  This is coded in a very non-intuitive manner.  The code
selecting the string wants to use the original value of "skip", not
the one modified by the node traversal loop.

Perhaps the following version of the fix is a little clearer.
What do you think?

diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c
index e3a5376..39fbd3c 100644
--- a/arch/sparc/kernel/prom.c
+++ b/arch/sparc/kernel/prom.c
@@ -415,7 +415,7 @@ static void __init of_console_init(void)
 	unsigned long flags;
 	const char *type;
 	phandle node;
-	int skip, fd;
+	int skip, tmp, fd;
 
 	of_console_path = prom_early_alloc(256);
 
@@ -442,8 +442,9 @@ static void __init of_console_init(void)
 			prom_halt();
 		}
 
+		tmp = skip;
 		for_each_node_by_type(dp, type) {
-			if (!skip--)
+			if (!tmp--)
 				break;
 		}
 		if (!dp) {

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

* Re: [PATCH] v2.6.23-rc1 Sparc32 Serial Port Selection error
  2007-07-29  2:17 [PATCH] v2.6.23-rc1 Sparc32 Serial Port Selection error Mark Fortescue
                   ` (3 preceding siblings ...)
  2007-07-29  8:00 ` David Miller
@ 2007-07-29  8:42 ` Mark Fortescue
  2007-07-29  9:09 ` David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Fortescue @ 2007-07-29  8:42 UTC (permalink / raw)
  To: sparclinux



On Sun, 29 Jul 2007, David Miller wrote:

> From: Mark Fortescue <mark@mtfhpc.demon.co.uk>
> Date: Sun, 29 Jul 2007 08:55:25 +0100 (BST)
>
>> Yes but then you do a !skip-- so 0 -> -1 and 1 -> 0
>
> Indeed.  This is coded in a very non-intuitive manner.  The code
> selecting the string wants to use the original value of "skip", not
> the one modified by the node traversal loop.
>
> Perhaps the following version of the fix is a little clearer.
> What do you think?
>

This also has the advantage that if any sparc32 systems have more than the 
usual two serial console ports, they can be added in relativly easilly. I 
think SBUS serial card I currently have in my SS1 can provide another four 
serial ports for use as console ports, if I put it in the SS2 and write a 
linux driver for it (I have the NetBSD driver source but have not got 
around to porting it yet). The SS1 Prom has an issue with the FCode so the 
extar ports are not available.

> diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c
> index e3a5376..39fbd3c 100644
> --- a/arch/sparc/kernel/prom.c
> +++ b/arch/sparc/kernel/prom.c
> @@ -415,7 +415,7 @@ static void __init of_console_init(void)
> 	unsigned long flags;
> 	const char *type;
> 	phandle node;
> -	int skip, fd;
> +	int skip, tmp, fd;
>
> 	of_console_path = prom_early_alloc(256);
>
> @@ -442,8 +442,9 @@ static void __init of_console_init(void)
> 			prom_halt();
> 		}
>
> +		tmp = skip;
> 		for_each_node_by_type(dp, type) {
> -			if (!skip--)
> +			if (!tmp--)
> 				break;
> 		}
> 		if (!dp) {
>

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

* Re: [PATCH] v2.6.23-rc1 Sparc32 Serial Port Selection error
  2007-07-29  2:17 [PATCH] v2.6.23-rc1 Sparc32 Serial Port Selection error Mark Fortescue
                   ` (4 preceding siblings ...)
  2007-07-29  8:42 ` Mark Fortescue
@ 2007-07-29  9:09 ` David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2007-07-29  9:09 UTC (permalink / raw)
  To: sparclinux

From: Mark Fortescue <mark@mtfhpc.demon.co.uk>
Date: Sun, 29 Jul 2007 09:42:00 +0100 (BST)

> 
> 
> On Sun, 29 Jul 2007, David Miller wrote:
> 
> > From: Mark Fortescue <mark@mtfhpc.demon.co.uk>
> > Date: Sun, 29 Jul 2007 08:55:25 +0100 (BST)
> >
> >> Yes but then you do a !skip-- so 0 -> -1 and 1 -> 0
> >
> > Indeed.  This is coded in a very non-intuitive manner.  The code
> > selecting the string wants to use the original value of "skip", not
> > the one modified by the node traversal loop.
> >
> > Perhaps the following version of the fix is a little clearer.
> > What do you think?
> >
> 
> This also has the advantage that if any sparc32 systems have more than the 
> usual two serial console ports, they can be added in relativly easilly. I 
> think SBUS serial card I currently have in my SS1 can provide another four 
> serial ports for use as console ports, if I put it in the SS2 and write a 
> linux driver for it (I have the NetBSD driver source but have not got 
> around to porting it yet). The SS1 Prom has an issue with the FCode so the 
> extar ports are not available.

Great, I'll put this version of the patch in then.

I also remember seeing several problems with older OBP implementations
in the older sun4c's.  For example, they couldn't handle qe network
cards because they couldn't handle device hierarchies of SBUS devices
sitting underneath a SBUS device.

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

end of thread, other threads:[~2007-07-29  9:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-29  2:17 [PATCH] v2.6.23-rc1 Sparc32 Serial Port Selection error Mark Fortescue
2007-07-29  5:53 ` David Miller
2007-07-29  6:43 ` David Miller
2007-07-29  7:55 ` Mark Fortescue
2007-07-29  8:00 ` David Miller
2007-07-29  8:42 ` Mark Fortescue
2007-07-29  9:09 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.