* [patch] x86_64: fix earlyprintk=...,keep regression
@ 2006-11-28 8:14 Ingo Molnar
2006-11-28 18:52 ` Linus Torvalds
0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2006-11-28 8:14 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Linus Torvalds, Andi Kleen
Subject: [patch] x86_64: fix earlyprintk=...,keep regression
From: Ingo Molnar <mingo@elte.hu>
the following cleanup patch:
commit 2c8c0e6b8d7700a990da8d24eff767f9ca223b96
Author: Andi Kleen <ak@suse.de>
Date: Tue Sep 26 10:52:32 2006 +0200
[PATCH] Convert x86-64 to early param
Instead of hackish manual parsing
broke the earlyprintk=...,keep feature. This patch restores that
functionality. Tested on x86_64. Must-have for v2.6.19, no risk.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86_64/kernel/early_printk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux/arch/x86_64/kernel/early_printk.c
===================================================================
--- linux.orig/arch/x86_64/kernel/early_printk.c
+++ linux/arch/x86_64/kernel/early_printk.c
@@ -224,7 +224,7 @@ static int __init setup_early_printk(cha
return 0;
early_console_initialized = 1;
- if (!strcmp(buf,"keep"))
+ if (strstr(buf, "keep"))
keep_early = 1;
if (!strncmp(buf, "serial", 6)) {
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [patch] x86_64: fix earlyprintk=...,keep regression
2006-11-28 8:14 [patch] x86_64: fix earlyprintk=...,keep regression Ingo Molnar
@ 2006-11-28 18:52 ` Linus Torvalds
2006-11-28 18:56 ` Linus Torvalds
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Linus Torvalds @ 2006-11-28 18:52 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Andrew Morton, linux-kernel, Andi Kleen
On Tue, 28 Nov 2006, Ingo Molnar wrote:
>
> the following cleanup patch:
>
> commit 2c8c0e6b8d7700a990da8d24eff767f9ca223b96
> Author: Andi Kleen <ak@suse.de>
> Date: Tue Sep 26 10:52:32 2006 +0200
>
> [PATCH] Convert x86-64 to early param
>
> Instead of hackish manual parsing
>
> broke the earlyprintk=...,keep feature. This patch restores that
> functionality. Tested on x86_64. Must-have for v2.6.19, no risk.
Hmm.
> - if (!strcmp(buf,"keep"))
> + if (strstr(buf, "keep"))
> keep_early = 1;
>
> if (!strncmp(buf, "serial", 6)) {
This is pretty ugly. The whole reason for the bug in the first place was
that "keep" was tested differently from all the other cases, and now you
just perpetuate that.
All the other strings are tested with "!strncmp(..)", so I think this one
should too. No?
Something like the appended (where I made the patch a bit bigger by just
making it visually look the same too and adding the "} else if .." thing.
Or is there some reason you really _want_ "keep" to be different? If so,
it should probably be commented on.
Linus
---
diff --git a/arch/x86_64/kernel/early_printk.c b/arch/x86_64/kernel/early_printk.c
index e22ecd5..51e6912 100644
--- a/arch/x86_64/kernel/early_printk.c
+++ b/arch/x86_64/kernel/early_printk.c
@@ -224,10 +224,9 @@ static int __init setup_early_printk(char *buf)
return 0;
early_console_initialized = 1;
- if (!strcmp(buf,"keep"))
+ if (!strncmp(buf,"keep", 4)) {
keep_early = 1;
-
- if (!strncmp(buf, "serial", 6)) {
+ } else if (!strncmp(buf, "serial", 6)) {
early_serial_init(buf + 6);
early_console = &early_serial_console;
} else if (!strncmp(buf, "ttyS", 4)) {
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [patch] x86_64: fix earlyprintk=...,keep regression
2006-11-28 18:52 ` Linus Torvalds
@ 2006-11-28 18:56 ` Linus Torvalds
2006-11-28 18:57 ` Andi Kleen
2006-11-28 19:56 ` Ingo Molnar
2 siblings, 0 replies; 5+ messages in thread
From: Linus Torvalds @ 2006-11-28 18:56 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Andrew Morton, linux-kernel, Andi Kleen
On Tue, 28 Nov 2006, Linus Torvalds wrote:
>
> Or is there some reason you really _want_ "keep" to be different? If so,
> it should probably be commented on.
Hmm. Looking at the commit that broke, the "strstr()" was there
originally, so in that sense your patch is obviously the minimal and safe
one. So I'll apply it as-is after all, but I'd be even happier if somebody
cleaned this up a bit and sent a patch after I do 2.6.19 (which may well
be later today, I think the time has come).
Linus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] x86_64: fix earlyprintk=...,keep regression
2006-11-28 18:52 ` Linus Torvalds
2006-11-28 18:56 ` Linus Torvalds
@ 2006-11-28 18:57 ` Andi Kleen
2006-11-28 19:56 ` Ingo Molnar
2 siblings, 0 replies; 5+ messages in thread
From: Andi Kleen @ 2006-11-28 18:57 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Ingo Molnar, Andrew Morton, linux-kernel
>
> Or is there some reason you really _want_ "keep" to be different? If so,
> it should probably be commented on.
It's just that keep is the only option that can only be at the end, all
others can be followed by more, so it
made minor sense to use strcmp() to match the \0 too. But using strncmp
everywhere is fine too since the syntax checking on these things is always
quite weak and it probably doesn't make much difference either way.
I would have gone with Ingo's fix, but if you prefer strncmp..?
-Andi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] x86_64: fix earlyprintk=...,keep regression
2006-11-28 18:52 ` Linus Torvalds
2006-11-28 18:56 ` Linus Torvalds
2006-11-28 18:57 ` Andi Kleen
@ 2006-11-28 19:56 ` Ingo Molnar
2 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2006-11-28 19:56 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Andrew Morton, linux-kernel, Andi Kleen
* Linus Torvalds <torvalds@osdl.org> wrote:
> - if (!strcmp(buf,"keep"))
> + if (!strncmp(buf,"keep", 4)) {
> keep_early = 1;
> -
> - if (!strncmp(buf, "serial", 6)) {
> + } else if (!strncmp(buf, "serial", 6)) {
> early_serial_init(buf + 6);
> early_console = &early_serial_console;
nope, that doesnt work, because the function call is a one-time thing
via the early_console_initialized flag. Nor does this keep compatibility
with the 2.6.18 API, my existing boot-entries:
root (hd0,4)
kernel /boot/bzImage-x64 root=/dev/hda5 \
earlyprintk=serial,ttyS0,115200,keep console=ttyS0,115200 console=tty
stopped working.
I agree that the parameter parsing here is a bit hacky, but my patch
restores the original behavior, so i think that's the best option for
now.
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-11-28 19:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-28 8:14 [patch] x86_64: fix earlyprintk=...,keep regression Ingo Molnar
2006-11-28 18:52 ` Linus Torvalds
2006-11-28 18:56 ` Linus Torvalds
2006-11-28 18:57 ` Andi Kleen
2006-11-28 19:56 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox