Commit 9429ec96c2718c0d1e3317cf60a87a0405223814
Committed by
Richard Weinberger
1 parent
bbb35efcda
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
um: Preinclude include/linux/kern_levels.h
The userspace part of UML uses the asm-offsets.h generator mechanism to create definitions for UM_KERN_<LEVEL> that match the in-kernel KERN_<LEVEL> constant definitions. As of commit 04d2c8c83d0e3ac5f78aeede51babb3236200112 ("printk: convert the format for KERN_<LEVEL> to a 2 byte pattern"), KERN_<LEVEL> is no longer expanded to the literal '"<LEVEL>"', but to '"\001" "LEVEL"', i.e. it contains two parts. However, the combo of DEFINE_STR() in arch/x86/um/shared/sysdep/kernel-offsets.h and sed-y in Kbuild doesn't support string literals consisting of multiple parts. Hence for all UM_KERN_<LEVEL> definitions, only the SOH character is retained in the actual definition, while the remainder ends up in the comment. E.g. in include/generated/asm-offsets.h we get #define UM_KERN_INFO "\001" /* "6" KERN_INFO */ instead of #define UM_KERN_INFO "\001" "6" /* KERN_INFO */ This causes spurious '^A' output 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 To fix this: - Move the mapping from UM_KERN_<LEVEL> to KERN_<LEVEL> from arch/um/include/shared/common-offsets.h to arch/um/include/shared/user.h, which is preincluded for all userspace parts, - Preinclude include/linux/kern_levels.h for all userspace parts, to obtain the in-kernel KERN_<LEVEL> constant definitions. This doesn't violate the kernel/userspace separation, as include/linux/kern_levels.h is self-contained and doesn't expose any other kernel internals. - Remove the now unused STR() and DEFINE_STR() macros. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Richard Weinberger <richard@nod.at>
Showing 4 changed files with 12 additions and 14 deletions Side-by-side Diff
arch/um/include/shared/common-offsets.h
... | ... | @@ -7,16 +7,6 @@ |
7 | 7 | DEFINE(UM_KERN_PAGE_SHIFT, PAGE_SHIFT); |
8 | 8 | DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC); |
9 | 9 | |
10 | -DEFINE_STR(UM_KERN_EMERG, KERN_EMERG); | |
11 | -DEFINE_STR(UM_KERN_ALERT, KERN_ALERT); | |
12 | -DEFINE_STR(UM_KERN_CRIT, KERN_CRIT); | |
13 | -DEFINE_STR(UM_KERN_ERR, KERN_ERR); | |
14 | -DEFINE_STR(UM_KERN_WARNING, KERN_WARNING); | |
15 | -DEFINE_STR(UM_KERN_NOTICE, KERN_NOTICE); | |
16 | -DEFINE_STR(UM_KERN_INFO, KERN_INFO); | |
17 | -DEFINE_STR(UM_KERN_DEBUG, KERN_DEBUG); | |
18 | -DEFINE_STR(UM_KERN_CONT, KERN_CONT); | |
19 | - | |
20 | 10 | DEFINE(UM_ELF_CLASS, ELF_CLASS); |
21 | 11 | DEFINE(UM_ELFCLASS32, ELFCLASS32); |
22 | 12 | DEFINE(UM_ELFCLASS64, ELFCLASS64); |
arch/um/include/shared/user.h
... | ... | @@ -26,6 +26,17 @@ |
26 | 26 | extern void panic(const char *fmt, ...) |
27 | 27 | __attribute__ ((format (printf, 1, 2))); |
28 | 28 | |
29 | +/* Requires preincluding include/linux/kern_levels.h */ | |
30 | +#define UM_KERN_EMERG KERN_EMERG | |
31 | +#define UM_KERN_ALERT KERN_ALERT | |
32 | +#define UM_KERN_CRIT KERN_CRIT | |
33 | +#define UM_KERN_ERR KERN_ERR | |
34 | +#define UM_KERN_WARNING KERN_WARNING | |
35 | +#define UM_KERN_NOTICE KERN_NOTICE | |
36 | +#define UM_KERN_INFO KERN_INFO | |
37 | +#define UM_KERN_DEBUG KERN_DEBUG | |
38 | +#define UM_KERN_CONT KERN_CONT | |
39 | + | |
29 | 40 | #ifdef UML_CONFIG_PRINTK |
30 | 41 | extern int printk(const char *fmt, ...) |
31 | 42 | __attribute__ ((format (printf, 1, 2))); |
arch/um/scripts/Makefile.rules
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) |
9 | 9 | |
10 | 10 | $(USER_OBJS:.o=.%): \ |
11 | - c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include user.h $(CFLAGS_$(basetarget).o) | |
11 | + c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include $(srctree)/include/linux/kern_levels.h -include user.h $(CFLAGS_$(basetarget).o) | |
12 | 12 | |
13 | 13 | # These are like USER_OBJS but filter USER_CFLAGS through unprofile instead of |
14 | 14 | # using it directly. |
arch/x86/um/shared/sysdep/kernel-offsets.h
... | ... | @@ -7,9 +7,6 @@ |
7 | 7 | #define DEFINE(sym, val) \ |
8 | 8 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) |
9 | 9 | |
10 | -#define STR(x) #x | |
11 | -#define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " STR(val) " " #val: : ) | |
12 | - | |
13 | 10 | #define BLANK() asm volatile("\n->" : : ) |
14 | 11 | |
15 | 12 | #define OFFSET(sym, str, mem) \ |