Commit 19bec32d7f26f263dba13f2797d9c3245de2020b
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
Merge branches 'x86-asm-for-linus', 'x86-cleanups-for-linus', 'x86-cpu-for-linus…
…', 'x86-debug-for-linus' and 'x86-microcode-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull initial trivial x86 stuff from Ingo Molnar. Various random cleanups and trivial fixes. * 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86-64: Eliminate dead ia32 syscall handlers * 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/pci-calgary_64.c: Remove obsoleted simple_strtoul() usage x86: Don't continue booting if we can't load the specified initrd x86: kernel/dumpstack.c simple_strtoul cleanup x86: kernel/check.c simple_strtoul cleanup debug: Add CONFIG_READABLE_ASM x86: spinlock.h: Remove REG_PTR_MODE * 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/cache_info: Fix setup of l2/l3 ids * 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86: Avoid double stack traces with show_regs() * 'x86-microcode-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86, microcode: microcode_core.c simple_strtoul cleanup
Showing 16 changed files Side-by-side Diff
- Makefile
- arch/x86/ia32/sys_ia32.c
- arch/x86/include/asm/kdebug.h
- arch/x86/include/asm/spinlock.h
- arch/x86/kernel/check.c
- arch/x86/kernel/cpu/intel_cacheinfo.c
- arch/x86/kernel/dumpstack.c
- arch/x86/kernel/dumpstack_32.c
- arch/x86/kernel/dumpstack_64.c
- arch/x86/kernel/kprobes.c
- arch/x86/kernel/microcode_core.c
- arch/x86/kernel/nmi.c
- arch/x86/kernel/pci-calgary_64.c
- arch/x86/kernel/process.c
- arch/x86/kernel/setup.c
- lib/Kconfig.debug
Makefile
... | ... | @@ -566,6 +566,16 @@ |
566 | 566 | KBUILD_CFLAGS += -O2 |
567 | 567 | endif |
568 | 568 | |
569 | +ifdef CONFIG_READABLE_ASM | |
570 | +# Disable optimizations that make assembler listings hard to read. | |
571 | +# reorder blocks reorders the control in the function | |
572 | +# ipa clone creates specialized cloned functions | |
573 | +# partial inlining inlines only parts of functions | |
574 | +KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \ | |
575 | + $(call cc-option,-fno-ipa-cp-clone,) \ | |
576 | + $(call cc-option,-fno-partial-inlining) | |
577 | +endif | |
578 | + | |
569 | 579 | include $(srctree)/arch/$(SRCARCH)/Makefile |
570 | 580 | |
571 | 581 | ifneq ($(CONFIG_FRAME_WARN),0) |
arch/x86/ia32/sys_ia32.c
... | ... | @@ -287,11 +287,6 @@ |
287 | 287 | return ret; |
288 | 288 | } |
289 | 289 | |
290 | -asmlinkage long sys32_alarm(unsigned int seconds) | |
291 | -{ | |
292 | - return alarm_setitimer(seconds); | |
293 | -} | |
294 | - | |
295 | 290 | asmlinkage long sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, |
296 | 291 | int options) |
297 | 292 | { |
... | ... | @@ -300,11 +295,6 @@ |
300 | 295 | |
301 | 296 | /* 32-bit timeval and related flotsam. */ |
302 | 297 | |
303 | -asmlinkage long sys32_sysfs(int option, u32 arg1, u32 arg2) | |
304 | -{ | |
305 | - return sys_sysfs(option, arg1, arg2); | |
306 | -} | |
307 | - | |
308 | 298 | asmlinkage long sys32_sched_rr_get_interval(compat_pid_t pid, |
309 | 299 | struct compat_timespec __user *interval) |
310 | 300 | { |
... | ... | @@ -374,19 +364,6 @@ |
374 | 364 | ((loff_t)AA(poshi) << 32) | AA(poslo)); |
375 | 365 | } |
376 | 366 | |
377 | - | |
378 | -asmlinkage long sys32_personality(unsigned long personality) | |
379 | -{ | |
380 | - int ret; | |
381 | - | |
382 | - if (personality(current->personality) == PER_LINUX32 && | |
383 | - personality == PER_LINUX) | |
384 | - personality = PER_LINUX32; | |
385 | - ret = sys_personality(personality); | |
386 | - if (ret == PER_LINUX32) | |
387 | - ret = PER_LINUX; | |
388 | - return ret; | |
389 | -} | |
390 | 367 | |
391 | 368 | asmlinkage long sys32_sendfile(int out_fd, int in_fd, |
392 | 369 | compat_off_t __user *offset, s32 count) |
arch/x86/include/asm/kdebug.h
... | ... | @@ -24,7 +24,6 @@ |
24 | 24 | extern void printk_address(unsigned long address, int reliable); |
25 | 25 | extern void die(const char *, struct pt_regs *,long); |
26 | 26 | extern int __must_check __die(const char *, struct pt_regs *, long); |
27 | -extern void show_registers(struct pt_regs *regs); | |
28 | 27 | extern void show_trace(struct task_struct *t, struct pt_regs *regs, |
29 | 28 | unsigned long *sp, unsigned long bp); |
30 | 29 | extern void __show_regs(struct pt_regs *regs, int all); |
arch/x86/include/asm/spinlock.h
arch/x86/kernel/check.c
... | ... | @@ -27,21 +27,29 @@ |
27 | 27 | |
28 | 28 | static __init int set_corruption_check(char *arg) |
29 | 29 | { |
30 | - char *end; | |
30 | + ssize_t ret; | |
31 | + unsigned long val; | |
31 | 32 | |
32 | - memory_corruption_check = simple_strtol(arg, &end, 10); | |
33 | + ret = kstrtoul(arg, 10, &val); | |
34 | + if (ret) | |
35 | + return ret; | |
33 | 36 | |
34 | - return (*end == 0) ? 0 : -EINVAL; | |
37 | + memory_corruption_check = val; | |
38 | + return 0; | |
35 | 39 | } |
36 | 40 | early_param("memory_corruption_check", set_corruption_check); |
37 | 41 | |
38 | 42 | static __init int set_corruption_check_period(char *arg) |
39 | 43 | { |
40 | - char *end; | |
44 | + ssize_t ret; | |
45 | + unsigned long val; | |
41 | 46 | |
42 | - corruption_check_period = simple_strtoul(arg, &end, 10); | |
47 | + ret = kstrtoul(arg, 10, &val); | |
48 | + if (ret) | |
49 | + return ret; | |
43 | 50 | |
44 | - return (*end == 0) ? 0 : -EINVAL; | |
51 | + corruption_check_period = val; | |
52 | + return 0; | |
45 | 53 | } |
46 | 54 | early_param("memory_corruption_check_period", set_corruption_check_period); |
47 | 55 |
arch/x86/kernel/cpu/intel_cacheinfo.c
... | ... | @@ -615,14 +615,14 @@ |
615 | 615 | new_l2 = this_leaf.size/1024; |
616 | 616 | num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing; |
617 | 617 | index_msb = get_count_order(num_threads_sharing); |
618 | - l2_id = c->apicid >> index_msb; | |
618 | + l2_id = c->apicid & ~((1 << index_msb) - 1); | |
619 | 619 | break; |
620 | 620 | case 3: |
621 | 621 | new_l3 = this_leaf.size/1024; |
622 | 622 | num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing; |
623 | 623 | index_msb = get_count_order( |
624 | 624 | num_threads_sharing); |
625 | - l3_id = c->apicid >> index_msb; | |
625 | + l3_id = c->apicid & ~((1 << index_msb) - 1); | |
626 | 626 | break; |
627 | 627 | default: |
628 | 628 | break; |
arch/x86/kernel/dumpstack.c
... | ... | @@ -271,7 +271,7 @@ |
271 | 271 | current->thread.trap_nr, SIGSEGV) == NOTIFY_STOP) |
272 | 272 | return 1; |
273 | 273 | |
274 | - show_registers(regs); | |
274 | + show_regs(regs); | |
275 | 275 | #ifdef CONFIG_X86_32 |
276 | 276 | if (user_mode_vm(regs)) { |
277 | 277 | sp = regs->sp; |
278 | 278 | |
279 | 279 | |
... | ... | @@ -311,16 +311,33 @@ |
311 | 311 | |
312 | 312 | static int __init kstack_setup(char *s) |
313 | 313 | { |
314 | + ssize_t ret; | |
315 | + unsigned long val; | |
316 | + | |
314 | 317 | if (!s) |
315 | 318 | return -EINVAL; |
316 | - kstack_depth_to_print = simple_strtoul(s, NULL, 0); | |
319 | + | |
320 | + ret = kstrtoul(s, 0, &val); | |
321 | + if (ret) | |
322 | + return ret; | |
323 | + kstack_depth_to_print = val; | |
317 | 324 | return 0; |
318 | 325 | } |
319 | 326 | early_param("kstack", kstack_setup); |
320 | 327 | |
321 | 328 | static int __init code_bytes_setup(char *s) |
322 | 329 | { |
323 | - code_bytes = simple_strtoul(s, NULL, 0); | |
330 | + ssize_t ret; | |
331 | + unsigned long val; | |
332 | + | |
333 | + if (!s) | |
334 | + return -EINVAL; | |
335 | + | |
336 | + ret = kstrtoul(s, 0, &val); | |
337 | + if (ret) | |
338 | + return ret; | |
339 | + | |
340 | + code_bytes = val; | |
324 | 341 | if (code_bytes > 8192) |
325 | 342 | code_bytes = 8192; |
326 | 343 |
arch/x86/kernel/dumpstack_32.c
arch/x86/kernel/dumpstack_64.c
arch/x86/kernel/kprobes.c
... | ... | @@ -1037,9 +1037,9 @@ |
1037 | 1037 | "current sp %p does not match saved sp %p\n", |
1038 | 1038 | stack_addr(regs), kcb->jprobe_saved_sp); |
1039 | 1039 | printk(KERN_ERR "Saved registers for jprobe %p\n", jp); |
1040 | - show_registers(saved_regs); | |
1040 | + show_regs(saved_regs); | |
1041 | 1041 | printk(KERN_ERR "Current registers\n"); |
1042 | - show_registers(regs); | |
1042 | + show_regs(regs); | |
1043 | 1043 | BUG(); |
1044 | 1044 | } |
1045 | 1045 | *regs = kcb->jprobe_saved_regs; |
arch/x86/kernel/microcode_core.c
... | ... | @@ -299,12 +299,11 @@ |
299 | 299 | { |
300 | 300 | unsigned long val; |
301 | 301 | int cpu = dev->id; |
302 | - int ret = 0; | |
303 | - char *end; | |
302 | + ssize_t ret = 0; | |
304 | 303 | |
305 | - val = simple_strtoul(buf, &end, 0); | |
306 | - if (end == buf) | |
307 | - return -EINVAL; | |
304 | + ret = kstrtoul(buf, 0, &val); | |
305 | + if (ret) | |
306 | + return ret; | |
308 | 307 | |
309 | 308 | if (val == 1) { |
310 | 309 | get_online_cpus(); |
arch/x86/kernel/nmi.c
arch/x86/kernel/pci-calgary_64.c
... | ... | @@ -1480,8 +1480,9 @@ |
1480 | 1480 | static int __init calgary_parse_options(char *p) |
1481 | 1481 | { |
1482 | 1482 | unsigned int bridge; |
1483 | + unsigned long val; | |
1483 | 1484 | size_t len; |
1484 | - char* endp; | |
1485 | + ssize_t ret; | |
1485 | 1486 | |
1486 | 1487 | while (*p) { |
1487 | 1488 | if (!strncmp(p, "64k", 3)) |
1488 | 1489 | |
... | ... | @@ -1512,10 +1513,11 @@ |
1512 | 1513 | ++p; |
1513 | 1514 | if (*p == '\0') |
1514 | 1515 | break; |
1515 | - bridge = simple_strtoul(p, &endp, 0); | |
1516 | - if (p == endp) | |
1516 | + ret = kstrtoul(p, 0, &val); | |
1517 | + if (ret) | |
1517 | 1518 | break; |
1518 | 1519 | |
1520 | + bridge = val; | |
1519 | 1521 | if (bridge < MAX_PHB_BUS_NUM) { |
1520 | 1522 | printk(KERN_INFO "Calgary: disabling " |
1521 | 1523 | "translation for PHB %#x\n", bridge); |
arch/x86/kernel/process.c
... | ... | @@ -113,12 +113,6 @@ |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | -void show_regs(struct pt_regs *regs) | |
117 | -{ | |
118 | - show_registers(regs); | |
119 | - show_trace(NULL, regs, (unsigned long *)kernel_stack_pointer(regs), 0); | |
120 | -} | |
121 | - | |
122 | 116 | void show_regs_common(void) |
123 | 117 | { |
124 | 118 | const char *vendor, *product, *board; |
arch/x86/kernel/setup.c
... | ... | @@ -393,10 +393,9 @@ |
393 | 393 | initrd_start = 0; |
394 | 394 | |
395 | 395 | if (ramdisk_size >= (end_of_lowmem>>1)) { |
396 | - memblock_free(ramdisk_image, ramdisk_end - ramdisk_image); | |
397 | - printk(KERN_ERR "initrd too large to handle, " | |
398 | - "disabling initrd\n"); | |
399 | - return; | |
396 | + panic("initrd too large to handle, " | |
397 | + "disabling initrd (%lld needed, %lld available)\n", | |
398 | + ramdisk_size, end_of_lowmem>>1); | |
400 | 399 | } |
401 | 400 | |
402 | 401 | printk(KERN_INFO "RAMDISK: %08llx - %08llx\n", ramdisk_image, |
lib/Kconfig.debug
... | ... | @@ -74,6 +74,15 @@ |
74 | 74 | that look like '.Lxxx') so they don't pollute the output of |
75 | 75 | get_wchan() and suchlike. |
76 | 76 | |
77 | +config READABLE_ASM | |
78 | + bool "Generate readable assembler code" | |
79 | + depends on DEBUG_KERNEL | |
80 | + help | |
81 | + Disable some compiler optimizations that tend to generate human unreadable | |
82 | + assembler output. This may make the kernel slightly slower, but it helps | |
83 | + to keep kernel developers who have to stare a lot at assembler listings | |
84 | + sane. | |
85 | + | |
77 | 86 | config UNUSED_SYMBOLS |
78 | 87 | bool "Enable unused/obsolete exported symbols" |
79 | 88 | default y if X86 |