diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-16 14:51:08 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-16 14:51:08 -0400 |
| commit | 271ecc5253e2b317d729d366560789cd7f93836c (patch) | |
| tree | d3a60bc4dfa8245ff934f357f2367db76b59e7cf /scripts | |
| parent | aa6865d836418eb2ba888a4cb1318a28e9aa2e0c (diff) | |
| parent | 63c06227a22b098a3849c5c99e836aea161ca0d7 (diff) | |
Merge branch 'akpm' (patches from Andrew)
Merge first patch-bomb from Andrew Morton:
- some misc things
- ofs2 updates
- about half of MM
- checkpatch updates
- autofs4 update
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (120 commits)
autofs4: fix string.h include in auto_dev-ioctl.h
autofs4: use pr_xxx() macros directly for logging
autofs4: change log print macros to not insert newline
autofs4: make autofs log prints consistent
autofs4: fix some white space errors
autofs4: fix invalid ioctl return in autofs4_root_ioctl_unlocked()
autofs4: fix coding style line length in autofs4_wait()
autofs4: fix coding style problem in autofs4_get_set_timeout()
autofs4: coding style fixes
autofs: show pipe inode in mount options
kallsyms: add support for relative offsets in kallsyms address table
kallsyms: don't overload absolute symbol type for percpu symbols
x86: kallsyms: disable absolute percpu symbols on !SMP
checkpatch: fix another left brace warning
checkpatch: improve UNSPECIFIED_INT test for bare signed/unsigned uses
checkpatch: warn on bare unsigned or signed declarations without int
checkpatch: exclude asm volatile from complex macro check
mm: memcontrol: drop unnecessary lru locking from mem_cgroup_migrate()
mm: migrate: consolidate mem_cgroup_migrate() calls
mm/compaction: speed up pageblock_pfn_to_page() when zone is contiguous
...
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/checkpatch.pl | 29 | ||||
| -rw-r--r-- | scripts/kallsyms.c | 93 | ||||
| -rwxr-xr-x | scripts/link-vmlinux.sh | 6 | ||||
| -rwxr-xr-x | scripts/namespace.pl | 2 |
4 files changed, 116 insertions, 14 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 874132b26d23..d574d13ba963 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
| @@ -3240,6 +3240,30 @@ sub process { | |||
| 3240 | #ignore lines not being added | 3240 | #ignore lines not being added |
| 3241 | next if ($line =~ /^[^\+]/); | 3241 | next if ($line =~ /^[^\+]/); |
| 3242 | 3242 | ||
| 3243 | # check for declarations of signed or unsigned without int | ||
| 3244 | while ($line =~ m{($Declare)\s*(?!char\b|short\b|int\b|long\b)\s*($Ident)?\s*[=,;\[\)\(]}g) { | ||
| 3245 | my $type = $1; | ||
| 3246 | my $var = $2; | ||
| 3247 | $var = "" if (!defined $var); | ||
| 3248 | if ($type =~ /^(?:(?:$Storage|$Inline|$Attribute)\s+)*((?:un)?signed)((?:\s*\*)*)\s*$/) { | ||
| 3249 | my $sign = $1; | ||
| 3250 | my $pointer = $2; | ||
| 3251 | |||
| 3252 | $pointer = "" if (!defined $pointer); | ||
| 3253 | |||
| 3254 | if (WARN("UNSPECIFIED_INT", | ||
| 3255 | "Prefer '" . trim($sign) . " int" . rtrim($pointer) . "' to bare use of '$sign" . rtrim($pointer) . "'\n" . $herecurr) && | ||
| 3256 | $fix) { | ||
| 3257 | my $decl = trim($sign) . " int "; | ||
| 3258 | my $comp_pointer = $pointer; | ||
| 3259 | $comp_pointer =~ s/\s//g; | ||
| 3260 | $decl .= $comp_pointer; | ||
| 3261 | $decl = rtrim($decl) if ($var eq ""); | ||
| 3262 | $fixed[$fixlinenr] =~ s@\b$sign\s*\Q$pointer\E\s*$var\b@$decl$var@; | ||
| 3263 | } | ||
| 3264 | } | ||
| 3265 | } | ||
| 3266 | |||
| 3243 | # TEST: allow direct testing of the type matcher. | 3267 | # TEST: allow direct testing of the type matcher. |
| 3244 | if ($dbg_type) { | 3268 | if ($dbg_type) { |
| 3245 | if ($line =~ /^.\s*$Declare\s*$/) { | 3269 | if ($line =~ /^.\s*$Declare\s*$/) { |
| @@ -4109,7 +4133,7 @@ sub process { | |||
| 4109 | ## } | 4133 | ## } |
| 4110 | 4134 | ||
| 4111 | #need space before brace following if, while, etc | 4135 | #need space before brace following if, while, etc |
| 4112 | if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) || | 4136 | if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) || |
| 4113 | $line =~ /do\{/) { | 4137 | $line =~ /do\{/) { |
| 4114 | if (ERROR("SPACING", | 4138 | if (ERROR("SPACING", |
| 4115 | "space required before the open brace '{'\n" . $herecurr) && | 4139 | "space required before the open brace '{'\n" . $herecurr) && |
| @@ -4561,6 +4585,9 @@ sub process { | |||
| 4561 | { | 4585 | { |
| 4562 | } | 4586 | } |
| 4563 | 4587 | ||
| 4588 | # Make asm volatile uses seem like a generic function | ||
| 4589 | $dstat =~ s/\b_*asm_*\s+_*volatile_*\b/asm_volatile/g; | ||
| 4590 | |||
| 4564 | my $exceptions = qr{ | 4591 | my $exceptions = qr{ |
| 4565 | $Declare| | 4592 | $Declare| |
| 4566 | module_param_named| | 4593 | module_param_named| |
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 8fa81e84e295..638b143ee60f 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
| 23 | #include <string.h> | 23 | #include <string.h> |
| 24 | #include <ctype.h> | 24 | #include <ctype.h> |
| 25 | #include <limits.h> | ||
| 25 | 26 | ||
| 26 | #ifndef ARRAY_SIZE | 27 | #ifndef ARRAY_SIZE |
| 27 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) | 28 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) |
| @@ -34,6 +35,7 @@ struct sym_entry { | |||
| 34 | unsigned int len; | 35 | unsigned int len; |
| 35 | unsigned int start_pos; | 36 | unsigned int start_pos; |
| 36 | unsigned char *sym; | 37 | unsigned char *sym; |
| 38 | unsigned int percpu_absolute; | ||
| 37 | }; | 39 | }; |
| 38 | 40 | ||
| 39 | struct addr_range { | 41 | struct addr_range { |
| @@ -42,6 +44,7 @@ struct addr_range { | |||
| 42 | }; | 44 | }; |
| 43 | 45 | ||
| 44 | static unsigned long long _text; | 46 | static unsigned long long _text; |
| 47 | static unsigned long long relative_base; | ||
| 45 | static struct addr_range text_ranges[] = { | 48 | static struct addr_range text_ranges[] = { |
| 46 | { "_stext", "_etext" }, | 49 | { "_stext", "_etext" }, |
| 47 | { "_sinittext", "_einittext" }, | 50 | { "_sinittext", "_einittext" }, |
| @@ -61,6 +64,7 @@ static int all_symbols = 0; | |||
| 61 | static int absolute_percpu = 0; | 64 | static int absolute_percpu = 0; |
| 62 | static char symbol_prefix_char = '\0'; | 65 | static char symbol_prefix_char = '\0'; |
| 63 | static unsigned long long kernel_start_addr = 0; | 66 | static unsigned long long kernel_start_addr = 0; |
| 67 | static int base_relative = 0; | ||
| 64 | 68 | ||
| 65 | int token_profit[0x10000]; | 69 | int token_profit[0x10000]; |
| 66 | 70 | ||
| @@ -74,7 +78,7 @@ static void usage(void) | |||
| 74 | fprintf(stderr, "Usage: kallsyms [--all-symbols] " | 78 | fprintf(stderr, "Usage: kallsyms [--all-symbols] " |
| 75 | "[--symbol-prefix=<prefix char>] " | 79 | "[--symbol-prefix=<prefix char>] " |
| 76 | "[--page-offset=<CONFIG_PAGE_OFFSET>] " | 80 | "[--page-offset=<CONFIG_PAGE_OFFSET>] " |
| 77 | "< in.map > out.S\n"); | 81 | "[--base-relative] < in.map > out.S\n"); |
| 78 | exit(1); | 82 | exit(1); |
| 79 | } | 83 | } |
| 80 | 84 | ||
| @@ -171,6 +175,8 @@ static int read_symbol(FILE *in, struct sym_entry *s) | |||
| 171 | strcpy((char *)s->sym + 1, str); | 175 | strcpy((char *)s->sym + 1, str); |
| 172 | s->sym[0] = stype; | 176 | s->sym[0] = stype; |
| 173 | 177 | ||
| 178 | s->percpu_absolute = 0; | ||
| 179 | |||
| 174 | /* Record if we've found __per_cpu_start/end. */ | 180 | /* Record if we've found __per_cpu_start/end. */ |
| 175 | check_symbol_range(sym, s->addr, &percpu_range, 1); | 181 | check_symbol_range(sym, s->addr, &percpu_range, 1); |
| 176 | 182 | ||
| @@ -202,6 +208,8 @@ static int symbol_valid(struct sym_entry *s) | |||
| 202 | */ | 208 | */ |
| 203 | static char *special_symbols[] = { | 209 | static char *special_symbols[] = { |
| 204 | "kallsyms_addresses", | 210 | "kallsyms_addresses", |
| 211 | "kallsyms_offsets", | ||
| 212 | "kallsyms_relative_base", | ||
| 205 | "kallsyms_num_syms", | 213 | "kallsyms_num_syms", |
| 206 | "kallsyms_names", | 214 | "kallsyms_names", |
| 207 | "kallsyms_markers", | 215 | "kallsyms_markers", |
| @@ -325,7 +333,7 @@ static int expand_symbol(unsigned char *data, int len, char *result) | |||
| 325 | 333 | ||
| 326 | static int symbol_absolute(struct sym_entry *s) | 334 | static int symbol_absolute(struct sym_entry *s) |
| 327 | { | 335 | { |
| 328 | return toupper(s->sym[0]) == 'A'; | 336 | return s->percpu_absolute; |
| 329 | } | 337 | } |
| 330 | 338 | ||
| 331 | static void write_src(void) | 339 | static void write_src(void) |
| @@ -346,16 +354,48 @@ static void write_src(void) | |||
| 346 | 354 | ||
| 347 | printf("\t.section .rodata, \"a\"\n"); | 355 | printf("\t.section .rodata, \"a\"\n"); |
| 348 | 356 | ||
| 349 | /* Provide proper symbols relocatability by their '_text' | 357 | /* Provide proper symbols relocatability by their relativeness |
| 350 | * relativeness. The symbol names cannot be used to construct | 358 | * to a fixed anchor point in the runtime image, either '_text' |
| 351 | * normal symbol references as the list of symbols contains | 359 | * for absolute address tables, in which case the linker will |
| 352 | * symbols that are declared static and are private to their | 360 | * emit the final addresses at build time. Otherwise, use the |
| 353 | * .o files. This prevents .tmp_kallsyms.o or any other | 361 | * offset relative to the lowest value encountered of all relative |
| 354 | * object from referencing them. | 362 | * symbols, and emit non-relocatable fixed offsets that will be fixed |
| 363 | * up at runtime. | ||
| 364 | * | ||
| 365 | * The symbol names cannot be used to construct normal symbol | ||
| 366 | * references as the list of symbols contains symbols that are | ||
| 367 | * declared static and are private to their .o files. This prevents | ||
| 368 | * .tmp_kallsyms.o or any other object from referencing them. | ||
| 355 | */ | 369 | */ |
| 356 | output_label("kallsyms_addresses"); | 370 | if (!base_relative) |
| 371 | output_label("kallsyms_addresses"); | ||
| 372 | else | ||
| 373 | output_label("kallsyms_offsets"); | ||
| 374 | |||
| 357 | for (i = 0; i < table_cnt; i++) { | 375 | for (i = 0; i < table_cnt; i++) { |
| 358 | if (!symbol_absolute(&table[i])) { | 376 | if (base_relative) { |
| 377 | long long offset; | ||
| 378 | int overflow; | ||
| 379 | |||
| 380 | if (!absolute_percpu) { | ||
| 381 | offset = table[i].addr - relative_base; | ||
| 382 | overflow = (offset < 0 || offset > UINT_MAX); | ||
| 383 | } else if (symbol_absolute(&table[i])) { | ||
| 384 | offset = table[i].addr; | ||
| 385 | overflow = (offset < 0 || offset > INT_MAX); | ||
| 386 | } else { | ||
| 387 | offset = relative_base - table[i].addr - 1; | ||
| 388 | overflow = (offset < INT_MIN || offset >= 0); | ||
| 389 | } | ||
| 390 | if (overflow) { | ||
| 391 | fprintf(stderr, "kallsyms failure: " | ||
| 392 | "%s symbol value %#llx out of range in relative mode\n", | ||
| 393 | symbol_absolute(&table[i]) ? "absolute" : "relative", | ||
| 394 | table[i].addr); | ||
| 395 | exit(EXIT_FAILURE); | ||
| 396 | } | ||
| 397 | printf("\t.long\t%#x\n", (int)offset); | ||
| 398 | } else if (!symbol_absolute(&table[i])) { | ||
| 359 | if (_text <= table[i].addr) | 399 | if (_text <= table[i].addr) |
| 360 | printf("\tPTR\t_text + %#llx\n", | 400 | printf("\tPTR\t_text + %#llx\n", |
| 361 | table[i].addr - _text); | 401 | table[i].addr - _text); |
| @@ -368,6 +408,12 @@ static void write_src(void) | |||
| 368 | } | 408 | } |
| 369 | printf("\n"); | 409 | printf("\n"); |
| 370 | 410 | ||
| 411 | if (base_relative) { | ||
| 412 | output_label("kallsyms_relative_base"); | ||
| 413 | printf("\tPTR\t_text - %#llx\n", _text - relative_base); | ||
| 414 | printf("\n"); | ||
| 415 | } | ||
| 416 | |||
| 371 | output_label("kallsyms_num_syms"); | 417 | output_label("kallsyms_num_syms"); |
| 372 | printf("\tPTR\t%d\n", table_cnt); | 418 | printf("\tPTR\t%d\n", table_cnt); |
| 373 | printf("\n"); | 419 | printf("\n"); |
| @@ -681,8 +727,27 @@ static void make_percpus_absolute(void) | |||
| 681 | unsigned int i; | 727 | unsigned int i; |
| 682 | 728 | ||
| 683 | for (i = 0; i < table_cnt; i++) | 729 | for (i = 0; i < table_cnt; i++) |
| 684 | if (symbol_in_range(&table[i], &percpu_range, 1)) | 730 | if (symbol_in_range(&table[i], &percpu_range, 1)) { |
| 731 | /* | ||
| 732 | * Keep the 'A' override for percpu symbols to | ||
| 733 | * ensure consistent behavior compared to older | ||
| 734 | * versions of this tool. | ||
| 735 | */ | ||
| 685 | table[i].sym[0] = 'A'; | 736 | table[i].sym[0] = 'A'; |
| 737 | table[i].percpu_absolute = 1; | ||
| 738 | } | ||
| 739 | } | ||
| 740 | |||
| 741 | /* find the minimum non-absolute symbol address */ | ||
| 742 | static void record_relative_base(void) | ||
| 743 | { | ||
| 744 | unsigned int i; | ||
| 745 | |||
| 746 | relative_base = -1ULL; | ||
| 747 | for (i = 0; i < table_cnt; i++) | ||
| 748 | if (!symbol_absolute(&table[i]) && | ||
| 749 | table[i].addr < relative_base) | ||
| 750 | relative_base = table[i].addr; | ||
| 686 | } | 751 | } |
| 687 | 752 | ||
| 688 | int main(int argc, char **argv) | 753 | int main(int argc, char **argv) |
| @@ -703,7 +768,9 @@ int main(int argc, char **argv) | |||
| 703 | } else if (strncmp(argv[i], "--page-offset=", 14) == 0) { | 768 | } else if (strncmp(argv[i], "--page-offset=", 14) == 0) { |
| 704 | const char *p = &argv[i][14]; | 769 | const char *p = &argv[i][14]; |
| 705 | kernel_start_addr = strtoull(p, NULL, 16); | 770 | kernel_start_addr = strtoull(p, NULL, 16); |
| 706 | } else | 771 | } else if (strcmp(argv[i], "--base-relative") == 0) |
| 772 | base_relative = 1; | ||
| 773 | else | ||
| 707 | usage(); | 774 | usage(); |
| 708 | } | 775 | } |
| 709 | } else if (argc != 1) | 776 | } else if (argc != 1) |
| @@ -712,6 +779,8 @@ int main(int argc, char **argv) | |||
| 712 | read_map(stdin); | 779 | read_map(stdin); |
| 713 | if (absolute_percpu) | 780 | if (absolute_percpu) |
| 714 | make_percpus_absolute(); | 781 | make_percpus_absolute(); |
| 782 | if (base_relative) | ||
| 783 | record_relative_base(); | ||
| 715 | sort_symbols(); | 784 | sort_symbols(); |
| 716 | optimize_token_table(); | 785 | optimize_token_table(); |
| 717 | write_src(); | 786 | write_src(); |
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index ba6c34ea5429..453ede9d2f3d 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh | |||
| @@ -86,10 +86,14 @@ kallsyms() | |||
| 86 | kallsymopt="${kallsymopt} --page-offset=$CONFIG_PAGE_OFFSET" | 86 | kallsymopt="${kallsymopt} --page-offset=$CONFIG_PAGE_OFFSET" |
| 87 | fi | 87 | fi |
| 88 | 88 | ||
| 89 | if [ -n "${CONFIG_X86_64}" ]; then | 89 | if [ -n "${CONFIG_KALLSYMS_ABSOLUTE_PERCPU}" ]; then |
| 90 | kallsymopt="${kallsymopt} --absolute-percpu" | 90 | kallsymopt="${kallsymopt} --absolute-percpu" |
| 91 | fi | 91 | fi |
| 92 | 92 | ||
| 93 | if [ -n "${CONFIG_KALLSYMS_BASE_RELATIVE}" ]; then | ||
| 94 | kallsymopt="${kallsymopt} --base-relative" | ||
| 95 | fi | ||
| 96 | |||
| 93 | local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ | 97 | local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ |
| 94 | ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}" | 98 | ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}" |
| 95 | 99 | ||
diff --git a/scripts/namespace.pl b/scripts/namespace.pl index a71be6b7cdec..9f3c9d47a4a5 100755 --- a/scripts/namespace.pl +++ b/scripts/namespace.pl | |||
| @@ -117,6 +117,8 @@ my %nameexception = ( | |||
| 117 | 'kallsyms_names' => 1, | 117 | 'kallsyms_names' => 1, |
| 118 | 'kallsyms_num_syms' => 1, | 118 | 'kallsyms_num_syms' => 1, |
| 119 | 'kallsyms_addresses'=> 1, | 119 | 'kallsyms_addresses'=> 1, |
| 120 | 'kallsyms_offsets' => 1, | ||
| 121 | 'kallsyms_relative_base'=> 1, | ||
| 120 | '__this_module' => 1, | 122 | '__this_module' => 1, |
| 121 | '_etext' => 1, | 123 | '_etext' => 1, |
| 122 | '_edata' => 1, | 124 | '_edata' => 1, |
