* Regression: Spurious "^A" in UML output
@ 2012-08-16 13:17 Geert Uytterhoeven
2012-08-16 13:50 ` Joe Perches
0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2012-08-16 13:17 UTC (permalink / raw)
To: uml-devel, linux-kbuild, Joe Perches; +Cc: linux-kernel
In v3.6-rc1 UML, I see spurious "^A" (ASCII 1, SOH) characters in some kernel
messages:
Calibrating delay loop... 4640.76 BogoMIPS (lpj=23203840)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 256
^AChecking that host ptys support output SIGIO...Yes
^AChecking that host ptys support SIGIO on close...No, enabling workaround
^AUsing 2.6 host AIO
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
Switching to clocksource itimer
This happens for all output using the "printk(UM_KERN_XXX ...)" idiom.
The "UM_KERN_XXX" defines are generated from the KERN_XXX defines in
arch/um/include/shared/common-offsets.h using:
DEFINE_STR(UM_KERN_EMERG, KERN_EMERG);
DEFINE_STR(UM_KERN_ALERT, KERN_ALERT);
DEFINE_STR(UM_KERN_CRIT, KERN_CRIT);
DEFINE_STR(UM_KERN_ERR, KERN_ERR);
DEFINE_STR(UM_KERN_WARNING, KERN_WARNING);
DEFINE_STR(UM_KERN_NOTICE, KERN_NOTICE);
DEFINE_STR(UM_KERN_INFO, KERN_INFO);
DEFINE_STR(UM_KERN_DEBUG, KERN_DEBUG);
DEFINE_STR(UM_KERN_CONT, KERN_CONT);
Before commit 04d2c8c83d0e3ac5f78aeede51babb3236200112 ("printk: convert
the format for KERN_<LEVEL> to a 2 byte pattern"), these were expanded in
include/generated/asm-offsets.h to:
#define UM_KERN_EMERG "<0>" /* KERN_EMERG */
#define UM_KERN_ALERT "<1>" /* KERN_ALERT */
#define UM_KERN_CRIT "<2>" /* KERN_CRIT */
#define UM_KERN_ERR "<3>" /* KERN_ERR */
#define UM_KERN_WARNING "<4>" /* KERN_WARNING */
#define UM_KERN_NOTICE "<5>" /* KERN_NOTICE */
#define UM_KERN_INFO "<6>" /* KERN_INFO */
#define UM_KERN_DEBUG "<7>" /* KERN_DEBUG */
#define UM_KERN_CONT "<c>" /* KERN_CONT */
In v3.6-rc1, they expand to:
#define UM_KERN_EMERG "\001" /* "0" KERN_EMERG */
#define UM_KERN_ALERT "\001" /* "1" KERN_ALERT */
#define UM_KERN_CRIT "\001" /* "2" KERN_CRIT */
#define UM_KERN_ERR "\001" /* "3" KERN_ERR */
#define UM_KERN_WARNING "\001" /* "4" KERN_WARNING */
#define UM_KERN_NOTICE "\001" /* "5" KERN_NOTICE */
#define UM_KERN_INFO "\001" /* "6" KERN_INFO */
#define UM_KERN_DEBUG "\001" /* "7" KERN_DEBUG */
#define UM_KERN_CONT "\001" /* "c" KERN_CONT */
I.e. only the SOH character is retained in the actual define, the remainder ends
up in the comment.
Apparently the combo of DEFINE_STR() in
arch/x86/um/shared/sysdep/kernel-offsets.h
and sed-y in Kbuild doesn't support string constants consisting of
multiple parts.
A quick fix is the (whitespace-damaged) patch below, but this would reduce
readability. And I'm afraid my sed-foo is not good enough to fix it better.
Any takers?
diff --git a/include/linux/kern_levels.h b/include/linux/kern_levels.h
index 866caaa..1c43b52 100644
--- a/include/linux/kern_levels.h
+++ b/include/linux/kern_levels.h
@@ -4,16 +4,16 @@
#define KERN_SOH "\001" /* ASCII Start Of Header */
#define KERN_SOH_ASCII '\001'
-#define KERN_EMERG KERN_SOH "0" /* system is unusable */
-#define KERN_ALERT KERN_SOH "1" /* action must be taken immediately */
-#define KERN_CRIT KERN_SOH "2" /* critical conditions */
-#define KERN_ERR KERN_SOH "3" /* error conditions */
-#define KERN_WARNING KERN_SOH "4" /* warning conditions */
-#define KERN_NOTICE KERN_SOH "5" /* normal but significant condition */
-#define KERN_INFO KERN_SOH "6" /* informational */
-#define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
+#define KERN_EMERG "\0010" /* system is unusable */
+#define KERN_ALERT "\0011" /* action must be taken immediately */
+#define KERN_CRIT "\0012" /* critical conditions */
+#define KERN_ERR "\0013" /* error conditions */
+#define KERN_WARNING "\0014" /* warning conditions */
+#define KERN_NOTICE "\0015" /* normal but significant condition */
+#define KERN_INFO "\0016" /* informational */
+#define KERN_DEBUG "\0017" /* debug-level messages */
-#define KERN_DEFAULT KERN_SOH "d" /* the default kernel loglevel */
+#define KERN_DEFAULT "\001d" /* the default kernel loglevel */
/*
* Annotation for a "continued" line of log printout (only done after a
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: Regression: Spurious "^A" in UML output
2012-08-16 13:17 Regression: Spurious "^A" in UML output Geert Uytterhoeven
@ 2012-08-16 13:50 ` Joe Perches
2012-08-16 14:31 ` Andreas Schwab
2012-08-16 15:03 ` Geert Uytterhoeven
0 siblings, 2 replies; 5+ messages in thread
From: Joe Perches @ 2012-08-16 13:50 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: uml-devel, linux-kbuild, linux-kernel
On Thu, 2012-08-16 at 15:17 +0200, Geert Uytterhoeven wrote:
> In v3.6-rc1 UML, I see spurious "^A" (ASCII 1, SOH) characters in some kernel
> messages:
>
> Calibrating delay loop... 4640.76 BogoMIPS (lpj=23203840)
> pid_max: default: 32768 minimum: 301
> Mount-cache hash table entries: 256
> ^AChecking that host ptys support output SIGIO...Yes
> ^AChecking that host ptys support SIGIO on close...No, enabling workaround
> ^AUsing 2.6 host AIO
> NET: Registered protocol family 16
> bio: create slab <bio-0> at 0
> Switching to clocksource itimer
>
> This happens for all output using the "printk(UM_KERN_XXX ...)" idiom.
Were these emitted with "KERN_<LEVEL>" string constants
before this change (not <[0-7]>", but the string text
KERN_INFO, KERN_WARNING, etc...)?
> The "UM_KERN_XXX" defines are generated from the KERN_XXX defines in
> arch/um/include/shared/common-offsets.h using:
>
> DEFINE_STR(UM_KERN_EMERG, KERN_EMERG);
[]
> I.e. only the SOH character is retained in the actual define, the remainder ends
> up in the comment.
>
> Apparently the combo of DEFINE_STR() in
> arch/x86/um/shared/sysdep/kernel-offsets.h
> and sed-y in Kbuild doesn't support string constants consisting of
> multiple parts.
>
> A quick fix is the (whitespace-damaged) patch below, but this would reduce
> readability. And I'm afraid my sed-foo is not good enough to fix it better.
> Any takers?
Perhaps it's better to change the um STR macro instead
$ git grep -w DEFINE_STR
arch/um/include/shared/common-offsets.h:DEFINE_STR(UM_KERN_EMERG, KERN_EMERG);
arch/um/include/shared/common-offsets.h:DEFINE_STR(UM_KERN_ALERT, KERN_ALERT);
arch/um/include/shared/common-offsets.h:DEFINE_STR(UM_KERN_CRIT, KERN_CRIT);
arch/um/include/shared/common-offsets.h:DEFINE_STR(UM_KERN_ERR, KERN_ERR);
arch/um/include/shared/common-offsets.h:DEFINE_STR(UM_KERN_WARNING, KERN_WARNING);
arch/um/include/shared/common-offsets.h:DEFINE_STR(UM_KERN_NOTICE, KERN_NOTICE);
arch/um/include/shared/common-offsets.h:DEFINE_STR(UM_KERN_INFO, KERN_INFO);
arch/um/include/shared/common-offsets.h:DEFINE_STR(UM_KERN_DEBUG, KERN_DEBUG);
arch/um/include/shared/common-offsets.h:DEFINE_STR(UM_KERN_CONT, KERN_CONT);
arch/x86/um/shared/sysdep/kernel-offsets.h:#define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " STR(val) " " #val: : )
$ git grep -w STR arch/x86/um/shared/
arch/x86/um/shared/sysdep/kernel-offsets.h:#define STR(x) #x
arch/x86/um/shared/sysdep/kernel-offsets.h:#define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " STR(val) " " #val: : )
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Regression: Spurious "^A" in UML output
2012-08-16 13:50 ` Joe Perches
@ 2012-08-16 14:31 ` Andreas Schwab
2012-08-16 15:03 ` Geert Uytterhoeven
1 sibling, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2012-08-16 14:31 UTC (permalink / raw)
To: Joe Perches; +Cc: Geert Uytterhoeven, uml-devel, linux-kbuild, linux-kernel
Joe Perches <joe@perches.com> writes:
> Perhaps it's better to change the um STR macro instead
The STR macro is only used to turn the expansion into a C string to be
parsed by the compiler. The real problem is that the expansion now
contains spaces, which makes the output ambigous.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Regression: Spurious "^A" in UML output
2012-08-16 13:50 ` Joe Perches
2012-08-16 14:31 ` Andreas Schwab
@ 2012-08-16 15:03 ` Geert Uytterhoeven
2012-08-16 18:15 ` Geert Uytterhoeven
1 sibling, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2012-08-16 15:03 UTC (permalink / raw)
To: Joe Perches; +Cc: uml-devel, linux-kbuild, linux-kernel
Hi Joe,
On Thu, Aug 16, 2012 at 3:50 PM, Joe Perches <joe@perches.com> wrote:
> On Thu, 2012-08-16 at 15:17 +0200, Geert Uytterhoeven wrote:
>> In v3.6-rc1 UML, I see spurious "^A" (ASCII 1, SOH) characters in some kernel
>> messages:
>>
>> Calibrating delay loop... 4640.76 BogoMIPS (lpj=23203840)
>> pid_max: default: 32768 minimum: 301
>> Mount-cache hash table entries: 256
>> ^AChecking that host ptys support output SIGIO...Yes
>> ^AChecking that host ptys support SIGIO on close...No, enabling workaround
>> ^AUsing 2.6 host AIO
>> NET: Registered protocol family 16
>> bio: create slab <bio-0> at 0
>> Switching to clocksource itimer
>>
>> This happens for all output using the "printk(UM_KERN_XXX ...)" idiom.
>
> Were these emitted with "KERN_<LEVEL>" string constants
> before this change (not <[0-7]>", but the string text
> KERN_INFO, KERN_WARNING, etc...)?
They were emitted with the "<x>" string constants.
This is used in the userspace part of UML, which runs as a userspace
application on the host. Hence it cannot include kernel header files
directly.
However, now include/linux/kern_levels.h is fairly self-container, perhaps
we should just include that file directly instead of, and get rid of all
DEFINE_STR() users.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Regression: Spurious "^A" in UML output
2012-08-16 15:03 ` Geert Uytterhoeven
@ 2012-08-16 18:15 ` Geert Uytterhoeven
0 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2012-08-16 18:15 UTC (permalink / raw)
To: Joe Perches; +Cc: uml-devel, linux-kbuild, linux-kernel
On Thu, Aug 16, 2012 at 5:03 PM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> However, now include/linux/kern_levels.h is fairly self-container, perhaps
> we should just include that file directly instead of, and get rid of all
> DEFINE_STR() users.
I sent out a patch to do that.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-08-16 18:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-16 13:17 Regression: Spurious "^A" in UML output Geert Uytterhoeven
2012-08-16 13:50 ` Joe Perches
2012-08-16 14:31 ` Andreas Schwab
2012-08-16 15:03 ` Geert Uytterhoeven
2012-08-16 18:15 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).