mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Linux always started with 9600 8N1
       [not found] ` <20070526.154745.30164056.davem@davemloft.net>
@ 2007-05-27 16:44   ` Jan Engelhardt
  2007-05-27 17:09     ` Jan Engelhardt
  2007-05-27 21:16     ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Engelhardt @ 2007-05-27 16:44 UTC (permalink / raw)
  To: David Miller; +Cc: sparclinux, Linux Kernel Mailing List


On May 26 2007 15:47, David Miller wrote:
>> I have set the OBP to run at 115200, also set agetty on ttyS0 to do the 
>> same, and also added console=ttyS0,115200 to silo.conf (and also tried 
>> console=ttyS0,115200n8). But! Linux still gives me 9600 8N1. The ominous 
>> double screen blanking (why is that done anyway?) already takes place 
>> with 9600. I smell a bug. What do you think?
>
>The code in drivers/serial/suncore.c:sunserial_console_termios()
>should be parsing your OBP settings, add some tracing and see why it
>isn't working.
>
>Please track the bug down for us, thanks :-)

Just why did no one get a kernel oops? After all, the code tried to
write to constant memory.

This is the first patch of two. There is yet another section of Linux 
code that runs in 9600-only, and I need to figure out which.

---

The Linux kernel ignored the PROM's serial settings (115200,n,8,1 in
my case). This was because mode_prop remained "ttyX-mode" (expected:
"ttya-mode") due to the constness of string literals when used with 
"char *". Since there is no "ttyX-mode" property in the PROM, Linux
always used the default 9600.

Signed-off-by: Jan Engelhardt <jengelh@gmx.de>

---
 drivers/serial/suncore.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6.21.sparc64/drivers/serial/suncore.c
===================================================================
--- linux-2.6.21.sparc64.orig/drivers/serial/suncore.c
+++ linux-2.6.21.sparc64/drivers/serial/suncore.c
@@ -30,9 +30,9 @@ void
 sunserial_console_termios(struct console *con)
 {
 	char mode[16], buf[16], *s;
-	char *mode_prop = "ttyX-mode";
-	char *cd_prop = "ttyX-ignore-cd";
-	char *dtr_prop = "ttyX-rts-dtr-off";
+	char mode_prop[] = "ttyX-mode";
+	char cd_prop[]   = "ttyX-ignore-cd";
+	char dtr_prop[]  = "ttyX-rts-dtr-off";
 	char *ssp_console_modes_prop = "ssp-console-modes";
 	int baud, bits, stop, cflag;
 	char parity;
#<EOF>

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

* Re: [PATCH] Linux always started with 9600 8N1
  2007-05-27 16:44   ` [PATCH] Linux always started with 9600 8N1 Jan Engelhardt
@ 2007-05-27 17:09     ` Jan Engelhardt
  2007-05-27 21:16     ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: Jan Engelhardt @ 2007-05-27 17:09 UTC (permalink / raw)
  To: David Miller; +Cc: sparclinux, Linux Kernel Mailing List


On May 27 2007 18:44, Jan Engelhardt wrote:
>On May 26 2007 15:47, David Miller wrote:
>>> I have set the OBP to run at 115200, also set agetty on ttyS0 to do the 
>>> same, and also added console=ttyS0,115200 to silo.conf (and also tried 
>>> console=ttyS0,115200n8). But! Linux still gives me 9600 8N1. The ominous 
>>> double screen blanking (why is that done anyway?) already takes place 
>>> with 9600. I smell a bug. What do you think?
>>
>>The code in drivers/serial/suncore.c:sunserial_console_termios()
>>should be parsing your OBP settings, add some tracing and see why it
>>isn't working.
>>
>>Please track the bug down for us, thanks :-)
>
>Just why did no one get a kernel oops? After all, the code tried to
>write to constant memory.
>
>This is the first patch of two. There is yet another section of Linux 
>code that runs in 9600-only, and I need to figure out which.

Ok no second patch. The issue (double blanking at boot, which I presumed
also ran at 9600) was recently fixed too.


	Jan
-- 

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

* Re: [PATCH] Linux always started with 9600 8N1
  2007-05-27 16:44   ` [PATCH] Linux always started with 9600 8N1 Jan Engelhardt
  2007-05-27 17:09     ` Jan Engelhardt
@ 2007-05-27 21:16     ` David Miller
  2007-05-27 21:47       ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2007-05-27 21:16 UTC (permalink / raw)
  To: jengelh; +Cc: sparclinux, linux-kernel

From: Jan Engelhardt <jengelh@linux01.gwdg.de>
Date: Sun, 27 May 2007 18:44:18 +0200 (MEST)

> 
> On May 26 2007 15:47, David Miller wrote:
> >> I have set the OBP to run at 115200, also set agetty on ttyS0 to do the 
> >> same, and also added console=ttyS0,115200 to silo.conf (and also tried 
> >> console=ttyS0,115200n8). But! Linux still gives me 9600 8N1. The ominous 
> >> double screen blanking (why is that done anyway?) already takes place 
> >> with 9600. I smell a bug. What do you think?
> >
> >The code in drivers/serial/suncore.c:sunserial_console_termios()
> >should be parsing your OBP settings, add some tracing and see why it
> >isn't working.
> >
> >Please track the bug down for us, thanks :-)
> 
> Just why did no one get a kernel oops? After all, the code tried to
> write to constant memory.
> 
> This is the first patch of two. There is yet another section of Linux 
> code that runs in 9600-only, and I need to figure out which.

There should not be an OOPS, we don't map any section of the
kernel as read-only or execute-only or anything like that.

The kernel image is mapped with full read/write/execute permission.

So even writes to so-called 'read-only' sections of the kernel image
will work and therefore I don't understand what the bug could be other
than the compiler "optimizing" away the write to the constant string
in which case the compiler should have warned about it.

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

* Re: [PATCH] Linux always started with 9600 8N1
  2007-05-27 21:16     ` David Miller
@ 2007-05-27 21:47       ` David Miller
  2007-05-29 20:10         ` Jan Engelhardt
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2007-05-27 21:47 UTC (permalink / raw)
  To: jengelh; +Cc: sparclinux, linux-kernel

From: David Miller <davem@davemloft.net>
Date: Sun, 27 May 2007 14:16:22 -0700 (PDT)

> So even writes to so-called 'read-only' sections of the kernel image
> will work and therefore I don't understand what the bug could be other
> than the compiler "optimizing" away the write to the constant string
> in which case the compiler should have warned about it.

I just stared at the drivers/serial/suncore.s assembler a little
bit and this is indeed what appears to be happening, the compiler
is optimizing the stores away completely yet not doing so much
as emitting a warning, how rude :-)

Perhaps there is some warning option that isn't enabled which
would have caught this...

Thanks a lot for your patch, I'll apply it.

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

* Re: [PATCH] Linux always started with 9600 8N1
  2007-05-27 21:47       ` David Miller
@ 2007-05-29 20:10         ` Jan Engelhardt
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Engelhardt @ 2007-05-29 20:10 UTC (permalink / raw)
  To: David Miller; +Cc: sparclinux, linux-kernel


On May 27 2007 14:47, David Miller wrote:
>
>> So even writes to so-called 'read-only' sections of the kernel image
>> will work and therefore I don't understand what the bug could be other
>> than the compiler "optimizing" away the write to the constant string
>> in which case the compiler should have warned about it.
>
>I just stared at the drivers/serial/suncore.s assembler a little
>bit and this is indeed what appears to be happening, the compiler
>is optimizing the stores away completely yet not doing so much
>as emitting a warning, how rude :-)

I do not think it can throw a meaningful warning. After all, whether
dereferencing and writing to a char* actually touches

(a) rw memory
(b) ro memory
(c) rw memory which we'd like to be ro ;-)

is not known to the compiler. Of course, one may add more complicated
code to cover simple cases like the one in suncore.c, but that may
as well just gives us more can't-figure-out-correctly-on-my-own warnings
like "possible uninitialized value used" (int n; set_n(&n); use_n(n);) /
where adding more code to cover all detectable cases increases complexity
too much.


	Jan
-- 

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

end of thread, other threads:[~2007-05-29 20:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Pine.LNX.4.61.0705261649590.7344@yvahk01.tjqt.qr>
     [not found] ` <20070526.154745.30164056.davem@davemloft.net>
2007-05-27 16:44   ` [PATCH] Linux always started with 9600 8N1 Jan Engelhardt
2007-05-27 17:09     ` Jan Engelhardt
2007-05-27 21:16     ` David Miller
2007-05-27 21:47       ` David Miller
2007-05-29 20:10         ` Jan Engelhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®