Merge branches 'x86-asm-for-linus', 'x86-cleanups-for-linus', 'x86-cpu-for-linus...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 May 2012 17:09:50 +0000 (10:09 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 May 2012 17:09:50 +0000 (10:09 -0700)
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

16 files changed:
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

index 546515c..8e4131b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -566,6 +566,16 @@ else
 KBUILD_CFLAGS  += -O2
 endif
 
+ifdef CONFIG_READABLE_ASM
+# Disable optimizations that make assembler listings hard to read.
+# reorder blocks reorders the control in the function
+# ipa clone creates specialized cloned functions
+# partial inlining inlines only parts of functions
+KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
+                 $(call cc-option,-fno-ipa-cp-clone,) \
+                 $(call cc-option,-fno-partial-inlining)
+endif
+
 include $(srctree)/arch/$(SRCARCH)/Makefile
 
 ifneq ($(CONFIG_FRAME_WARN),0)
index aec2202..edca9c0 100644 (file)
@@ -287,11 +287,6 @@ asmlinkage long sys32_sigaction(int sig, struct old_sigaction32 __user *act,
        return ret;
 }
 
-asmlinkage long sys32_alarm(unsigned int seconds)
-{
-       return alarm_setitimer(seconds);
-}
-
 asmlinkage long sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr,
                              int options)
 {
@@ -300,11 +295,6 @@ asmlinkage long sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr,
 
 /* 32-bit timeval and related flotsam.  */
 
-asmlinkage long sys32_sysfs(int option, u32 arg1, u32 arg2)
-{
-       return sys_sysfs(option, arg1, arg2);
-}
-
 asmlinkage long sys32_sched_rr_get_interval(compat_pid_t pid,
                                    struct compat_timespec __user *interval)
 {
@@ -375,19 +365,6 @@ asmlinkage long sys32_pwrite(unsigned int fd, const char __user *ubuf,
 }
 
 
-asmlinkage long sys32_personality(unsigned long personality)
-{
-       int ret;
-
-       if (personality(current->personality) == PER_LINUX32 &&
-               personality == PER_LINUX)
-               personality = PER_LINUX32;
-       ret = sys_personality(personality);
-       if (ret == PER_LINUX32)
-               ret = PER_LINUX;
-       return ret;
-}
-
 asmlinkage long sys32_sendfile(int out_fd, int in_fd,
                               compat_off_t __user *offset, s32 count)
 {
index d73f157..2c37aad 100644 (file)
@@ -24,7 +24,6 @@ enum die_val {
 extern void printk_address(unsigned long address, int reliable);
 extern void die(const char *, struct pt_regs *,long);
 extern int __must_check __die(const char *, struct pt_regs *, long);
-extern void show_registers(struct pt_regs *regs);
 extern void show_trace(struct task_struct *t, struct pt_regs *regs,
                       unsigned long *sp, unsigned long bp);
 extern void __show_regs(struct pt_regs *regs, int all);
index 76bfa2c..b315a33 100644 (file)
 
 #ifdef CONFIG_X86_32
 # define LOCK_PTR_REG "a"
-# define REG_PTR_MODE "k"
 #else
 # define LOCK_PTR_REG "D"
-# define REG_PTR_MODE "q"
 #endif
 
 #if defined(CONFIG_X86_32) && \
index 5da1269..e2dbcb7 100644 (file)
@@ -27,21 +27,29 @@ static int num_scan_areas;
 
 static __init int set_corruption_check(char *arg)
 {
-       char *end;
+       ssize_t ret;
+       unsigned long val;
 
-       memory_corruption_check = simple_strtol(arg, &end, 10);
+       ret = kstrtoul(arg, 10, &val);
+       if (ret)
+               return ret;
 
-       return (*end == 0) ? 0 : -EINVAL;
+       memory_corruption_check = val;
+       return 0;
 }
 early_param("memory_corruption_check", set_corruption_check);
 
 static __init int set_corruption_check_period(char *arg)
 {
-       char *end;
+       ssize_t ret;
+       unsigned long val;
 
-       corruption_check_period = simple_strtoul(arg, &end, 10);
+       ret = kstrtoul(arg, 10, &val);
+       if (ret)
+               return ret;
 
-       return (*end == 0) ? 0 : -EINVAL;
+       corruption_check_period = val;
+       return 0;
 }
 early_param("memory_corruption_check_period", set_corruption_check_period);
 
index b8f3653..9a7c90d 100644 (file)
@@ -615,14 +615,14 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
                                        new_l2 = this_leaf.size/1024;
                                        num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing;
                                        index_msb = get_count_order(num_threads_sharing);
-                                       l2_id = c->apicid >> index_msb;
+                                       l2_id = c->apicid & ~((1 << index_msb) - 1);
                                        break;
                                case 3:
                                        new_l3 = this_leaf.size/1024;
                                        num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing;
                                        index_msb = get_count_order(
                                                        num_threads_sharing);
-                                       l3_id = c->apicid >> index_msb;
+                                       l3_id = c->apicid & ~((1 << index_msb) - 1);
                                        break;
                                default:
                                        break;
index 1b81839..571246d 100644 (file)
@@ -271,7 +271,7 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
                        current->thread.trap_nr, SIGSEGV) == NOTIFY_STOP)
                return 1;
 
-       show_registers(regs);
+       show_regs(regs);
 #ifdef CONFIG_X86_32
        if (user_mode_vm(regs)) {
                sp = regs->sp;
@@ -311,16 +311,33 @@ void die(const char *str, struct pt_regs *regs, long err)
 
 static int __init kstack_setup(char *s)
 {
+       ssize_t ret;
+       unsigned long val;
+
        if (!s)
                return -EINVAL;
-       kstack_depth_to_print = simple_strtoul(s, NULL, 0);
+
+       ret = kstrtoul(s, 0, &val);
+       if (ret)
+               return ret;
+       kstack_depth_to_print = val;
        return 0;
 }
 early_param("kstack", kstack_setup);
 
 static int __init code_bytes_setup(char *s)
 {
-       code_bytes = simple_strtoul(s, NULL, 0);
+       ssize_t ret;
+       unsigned long val;
+
+       if (!s)
+               return -EINVAL;
+
+       ret = kstrtoul(s, 0, &val);
+       if (ret)
+               return ret;
+
+       code_bytes = val;
        if (code_bytes > 8192)
                code_bytes = 8192;
 
index 88ec912..e0b1d78 100644 (file)
@@ -82,7 +82,7 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
 }
 
 
-void show_registers(struct pt_regs *regs)
+void show_regs(struct pt_regs *regs)
 {
        int i;
 
index 17107bd..791b761 100644 (file)
@@ -245,7 +245,7 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
        show_trace_log_lvl(task, regs, sp, bp, log_lvl);
 }
 
-void show_registers(struct pt_regs *regs)
+void show_regs(struct pt_regs *regs)
 {
        int i;
        unsigned long sp;
index e213fc8..e2f751e 100644 (file)
@@ -1037,9 +1037,9 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
                               "current sp %p does not match saved sp %p\n",
                               stack_addr(regs), kcb->jprobe_saved_sp);
                        printk(KERN_ERR "Saved registers for jprobe %p\n", jp);
-                       show_registers(saved_regs);
+                       show_regs(saved_regs);
                        printk(KERN_ERR "Current registers\n");
-                       show_registers(regs);
+                       show_regs(regs);
                        BUG();
                }
                *regs = kcb->jprobe_saved_regs;
index c9bda6d..fbdfc69 100644 (file)
@@ -299,12 +299,11 @@ static ssize_t reload_store(struct device *dev,
 {
        unsigned long val;
        int cpu = dev->id;
-       int ret = 0;
-       char *end;
+       ssize_t ret = 0;
 
-       val = simple_strtoul(buf, &end, 0);
-       if (end == buf)
-               return -EINVAL;
+       ret = kstrtoul(buf, 0, &val);
+       if (ret)
+               return ret;
 
        if (val == 1) {
                get_online_cpus();
index a1faed5..bffdfd4 100644 (file)
@@ -209,7 +209,7 @@ io_check_error(unsigned char reason, struct pt_regs *regs)
        pr_emerg(
        "NMI: IOCK error (debug interrupt?) for reason %02x on CPU %d.\n",
                 reason, smp_processor_id());
-       show_registers(regs);
+       show_regs(regs);
 
        if (panic_on_io_nmi)
                panic("NMI IOCK error: Not continuing");
index d0b2fb9..b72838b 100644 (file)
@@ -1480,8 +1480,9 @@ cleanup:
 static int __init calgary_parse_options(char *p)
 {
        unsigned int bridge;
+       unsigned long val;
        size_t len;
-       char* endp;
+       ssize_t ret;
 
        while (*p) {
                if (!strncmp(p, "64k", 3))
@@ -1512,10 +1513,11 @@ static int __init calgary_parse_options(char *p)
                                ++p;
                        if (*p == '\0')
                                break;
-                       bridge = simple_strtoul(p, &endp, 0);
-                       if (p == endp)
+                       ret = kstrtoul(p, 0, &val);
+                       if (ret)
                                break;
 
+                       bridge = val;
                        if (bridge < MAX_PHB_BUS_NUM) {
                                printk(KERN_INFO "Calgary: disabling "
                                       "translation for PHB %#x\n", bridge);
index 8040b75..f2e8c0f 100644 (file)
@@ -113,12 +113,6 @@ void exit_thread(void)
        }
 }
 
-void show_regs(struct pt_regs *regs)
-{
-       show_registers(regs);
-       show_trace(NULL, regs, (unsigned long *)kernel_stack_pointer(regs), 0);
-}
-
 void show_regs_common(void)
 {
        const char *vendor, *product, *board;
index 7e67c5a..9b4204e 100644 (file)
@@ -393,10 +393,9 @@ static void __init reserve_initrd(void)
        initrd_start = 0;
 
        if (ramdisk_size >= (end_of_lowmem>>1)) {
-               memblock_free(ramdisk_image, ramdisk_end - ramdisk_image);
-               printk(KERN_ERR "initrd too large to handle, "
-                      "disabling initrd\n");
-               return;
+               panic("initrd too large to handle, "
+                      "disabling initrd (%lld needed, %lld available)\n",
+                      ramdisk_size, end_of_lowmem>>1);
        }
 
        printk(KERN_INFO "RAMDISK: %08llx - %08llx\n", ramdisk_image,
index e119341..a42d3ae 100644 (file)
@@ -74,6 +74,15 @@ config STRIP_ASM_SYMS
          that look like '.Lxxx') so they don't pollute the output of
          get_wchan() and suchlike.
 
+config READABLE_ASM
+        bool "Generate readable assembler code"
+        depends on DEBUG_KERNEL
+        help
+          Disable some compiler optimizations that tend to generate human unreadable
+          assembler output. This may make the kernel slightly slower, but it helps
+          to keep kernel developers who have to stare a lot at assembler listings
+          sane.
+
 config UNUSED_SYMBOLS
        bool "Enable unused/obsolete exported symbols"
        default y if X86