Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 29 Mar 2012 21:28:26 +0000 (14:28 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 29 Mar 2012 21:28:26 +0000 (14:28 -0700)
Pull x86 updates from Ingo Molnar.

This touches some non-x86 files due to the sanitized INLINE_SPIN_UNLOCK
config usage.

Fixed up trivial conflicts due to just header include changes (removing
headers due to cpu_idle() merge clashing with the <asm/system.h> split).

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/apic/amd: Be more verbose about LVT offset assignments
  x86, tls: Off by one limit check
  x86/ioapic: Add io_apic_ops driver layer to allow interception
  x86/olpc: Add debugfs interface for EC commands
  x86: Merge the x86_32 and x86_64 cpu_idle() functions
  x86/kconfig: Remove CONFIG_TR=y from the defconfigs
  x86: Stop recursive fault in print_context_stack after stack overflow
  x86/io_apic: Move and reenable irq only when CONFIG_GENERIC_PENDING_IRQ=y
  x86/apic: Add separate apic_id_valid() functions for selected apic drivers
  locking/kconfig: Simplify INLINE_SPIN_UNLOCK usage
  x86/kconfig: Update defconfigs
  x86: Fix excessive MSR print out when show_msr is not specified

1  2 
arch/x86/include/asm/apic.h
arch/x86/kernel/cpu/common.c
arch/x86/kernel/process.c
arch/x86/kernel/process_32.c
arch/x86/kernel/process_64.c
arch/x86/kernel/tls.c
lib/Kconfig.debug

@@@ -11,6 -11,7 +11,6 @@@
  #include <linux/atomic.h>
  #include <asm/fixmap.h>
  #include <asm/mpspec.h>
 -#include <asm/system.h>
  #include <asm/msr.h>
  
  #define ARCH_APICTIMER_STOPS_ON_C3    1
@@@ -534,7 -535,7 +534,7 @@@ static inline unsigned int read_apic_id
  
  static inline int default_apic_id_valid(int apicid)
  {
-       return x2apic_mode || (apicid < 255);
+       return (apicid < 255);
  }
  
  extern void default_setup_apic_routing(void);
@@@ -18,7 -18,6 +18,7 @@@
  #include <asm/archrandom.h>
  #include <asm/hypervisor.h>
  #include <asm/processor.h>
 +#include <asm/debugreg.h>
  #include <asm/sections.h>
  #include <linux/topology.h>
  #include <linux/cpumask.h>
@@@ -999,7 -998,7 +999,7 @@@ void __cpuinit print_cpu_info(struct cp
        else
                printk(KERN_CONT "\n");
  
-       __print_cpu_msr();
+       print_cpu_msr(c);
  }
  
  void __cpuinit print_cpu_msr(struct cpuinfo_x86 *c)
  #include <linux/user-return-notifier.h>
  #include <linux/dmi.h>
  #include <linux/utsname.h>
+ #include <linux/stackprotector.h>
+ #include <linux/tick.h>
+ #include <linux/cpuidle.h>
  #include <trace/events/power.h>
  #include <linux/hw_breakpoint.h>
  #include <asm/cpu.h>
 -#include <asm/system.h>
  #include <asm/apic.h>
  #include <asm/syscalls.h>
  #include <asm/idle.h>
  #include <asm/i387.h>
  #include <asm/fpu-internal.h>
  #include <asm/debugreg.h>
+ #include <asm/nmi.h>
+ #ifdef CONFIG_X86_64
+ static DEFINE_PER_CPU(unsigned char, is_idle);
+ static ATOMIC_NOTIFIER_HEAD(idle_notifier);
+ void idle_notifier_register(struct notifier_block *n)
+ {
+       atomic_notifier_chain_register(&idle_notifier, n);
+ }
+ EXPORT_SYMBOL_GPL(idle_notifier_register);
+ void idle_notifier_unregister(struct notifier_block *n)
+ {
+       atomic_notifier_chain_unregister(&idle_notifier, n);
+ }
+ EXPORT_SYMBOL_GPL(idle_notifier_unregister);
+ #endif
  
  struct kmem_cache *task_xstate_cachep;
  EXPORT_SYMBOL_GPL(task_xstate_cachep);
@@@ -370,6 -392,99 +391,99 @@@ static inline int hlt_use_halt(void
  }
  #endif
  
+ #ifndef CONFIG_SMP
+ static inline void play_dead(void)
+ {
+       BUG();
+ }
+ #endif
+ #ifdef CONFIG_X86_64
+ void enter_idle(void)
+ {
+       percpu_write(is_idle, 1);
+       atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL);
+ }
+ static void __exit_idle(void)
+ {
+       if (x86_test_and_clear_bit_percpu(0, is_idle) == 0)
+               return;
+       atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL);
+ }
+ /* Called from interrupts to signify idle end */
+ void exit_idle(void)
+ {
+       /* idle loop has pid 0 */
+       if (current->pid)
+               return;
+       __exit_idle();
+ }
+ #endif
+ /*
+  * The idle thread. There's no useful work to be
+  * done, so just try to conserve power and have a
+  * low exit latency (ie sit in a loop waiting for
+  * somebody to say that they'd like to reschedule)
+  */
+ void cpu_idle(void)
+ {
+       /*
+        * If we're the non-boot CPU, nothing set the stack canary up
+        * for us.  CPU0 already has it initialized but no harm in
+        * doing it again.  This is a good place for updating it, as
+        * we wont ever return from this function (so the invalid
+        * canaries already on the stack wont ever trigger).
+        */
+       boot_init_stack_canary();
+       current_thread_info()->status |= TS_POLLING;
+       while (1) {
+               tick_nohz_idle_enter();
+               while (!need_resched()) {
+                       rmb();
+                       if (cpu_is_offline(smp_processor_id()))
+                               play_dead();
+                       /*
+                        * Idle routines should keep interrupts disabled
+                        * from here on, until they go to idle.
+                        * Otherwise, idle callbacks can misfire.
+                        */
+                       local_touch_nmi();
+                       local_irq_disable();
+                       enter_idle();
+                       /* Don't trace irqs off for idle */
+                       stop_critical_timings();
+                       /* enter_idle() needs rcu for notifiers */
+                       rcu_idle_enter();
+                       if (cpuidle_idle_call())
+                               pm_idle();
+                       rcu_idle_exit();
+                       start_critical_timings();
+                       /* In many cases the interrupt that ended idle
+                          has already called exit_idle. But some idle
+                          loops can be woken up without interrupt. */
+                       __exit_idle();
+               }
+               tick_nohz_idle_exit();
+               preempt_enable_no_resched();
+               schedule();
+               preempt_disable();
+       }
+ }
  /*
   * We use this if we don't have any better
   * idle routine..
@@@ -9,7 -9,6 +9,6 @@@
   * This file handles the architecture-dependent parts of process handling..
   */
  
- #include <linux/stackprotector.h>
  #include <linux/cpu.h>
  #include <linux/errno.h>
  #include <linux/sched.h>
  #include <linux/kallsyms.h>
  #include <linux/ptrace.h>
  #include <linux/personality.h>
- #include <linux/tick.h>
  #include <linux/percpu.h>
  #include <linux/prctl.h>
  #include <linux/ftrace.h>
  #include <linux/uaccess.h>
  #include <linux/io.h>
  #include <linux/kdebug.h>
- #include <linux/cpuidle.h>
  
  #include <asm/pgtable.h>
 -#include <asm/system.h>
  #include <asm/ldt.h>
  #include <asm/processor.h>
  #include <asm/i387.h>
@@@ -57,8 -55,6 +54,7 @@@
  #include <asm/idle.h>
  #include <asm/syscalls.h>
  #include <asm/debugreg.h>
- #include <asm/nmi.h>
 +#include <asm/switch_to.h>
  
  asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
  
@@@ -70,60 -66,6 +66,6 @@@ unsigned long thread_saved_pc(struct ta
        return ((unsigned long *)tsk->thread.sp)[3];
  }
  
- #ifndef CONFIG_SMP
- static inline void play_dead(void)
- {
-       BUG();
- }
- #endif
- /*
-  * The idle thread. There's no useful work to be
-  * done, so just try to conserve power and have a
-  * low exit latency (ie sit in a loop waiting for
-  * somebody to say that they'd like to reschedule)
-  */
- void cpu_idle(void)
- {
-       int cpu = smp_processor_id();
-       /*
-        * If we're the non-boot CPU, nothing set the stack canary up
-        * for us.  CPU0 already has it initialized but no harm in
-        * doing it again.  This is a good place for updating it, as
-        * we wont ever return from this function (so the invalid
-        * canaries already on the stack wont ever trigger).
-        */
-       boot_init_stack_canary();
-       current_thread_info()->status |= TS_POLLING;
-       /* endless idle loop with no priority at all */
-       while (1) {
-               tick_nohz_idle_enter();
-               rcu_idle_enter();
-               while (!need_resched()) {
-                       check_pgt_cache();
-                       rmb();
-                       if (cpu_is_offline(cpu))
-                               play_dead();
-                       local_touch_nmi();
-                       local_irq_disable();
-                       /* Don't trace irqs off for idle */
-                       stop_critical_timings();
-                       if (cpuidle_idle_call())
-                               pm_idle();
-                       start_critical_timings();
-               }
-               rcu_idle_exit();
-               tick_nohz_idle_exit();
-               schedule_preempt_disabled();
-       }
- }
  void __show_regs(struct pt_regs *regs, int all)
  {
        unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
@@@ -14,7 -14,6 +14,6 @@@
   * This file handles the architecture-dependent parts of process handling..
   */
  
- #include <linux/stackprotector.h>
  #include <linux/cpu.h>
  #include <linux/errno.h>
  #include <linux/sched.h>
  #include <linux/notifier.h>
  #include <linux/kprobes.h>
  #include <linux/kdebug.h>
- #include <linux/tick.h>
  #include <linux/prctl.h>
  #include <linux/uaccess.h>
  #include <linux/io.h>
  #include <linux/ftrace.h>
- #include <linux/cpuidle.h>
  
  #include <asm/pgtable.h>
 -#include <asm/system.h>
  #include <asm/processor.h>
  #include <asm/i387.h>
  #include <asm/fpu-internal.h>
  #include <asm/idle.h>
  #include <asm/syscalls.h>
  #include <asm/debugreg.h>
- #include <asm/nmi.h>
 +#include <asm/switch_to.h>
  
  asmlinkage extern void ret_from_fork(void);
  
  DEFINE_PER_CPU(unsigned long, old_rsp);
- static DEFINE_PER_CPU(unsigned char, is_idle);
- static ATOMIC_NOTIFIER_HEAD(idle_notifier);
- void idle_notifier_register(struct notifier_block *n)
- {
-       atomic_notifier_chain_register(&idle_notifier, n);
- }
- EXPORT_SYMBOL_GPL(idle_notifier_register);
- void idle_notifier_unregister(struct notifier_block *n)
- {
-       atomic_notifier_chain_unregister(&idle_notifier, n);
- }
- EXPORT_SYMBOL_GPL(idle_notifier_unregister);
- void enter_idle(void)
- {
-       percpu_write(is_idle, 1);
-       atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL);
- }
- static void __exit_idle(void)
- {
-       if (x86_test_and_clear_bit_percpu(0, is_idle) == 0)
-               return;
-       atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL);
- }
- /* Called from interrupts to signify idle end */
- void exit_idle(void)
- {
-       /* idle loop has pid 0 */
-       if (current->pid)
-               return;
-       __exit_idle();
- }
- #ifndef CONFIG_SMP
- static inline void play_dead(void)
- {
-       BUG();
- }
- #endif
- /*
-  * The idle thread. There's no useful work to be
-  * done, so just try to conserve power and have a
-  * low exit latency (ie sit in a loop waiting for
-  * somebody to say that they'd like to reschedule)
-  */
- void cpu_idle(void)
- {
-       current_thread_info()->status |= TS_POLLING;
-       /*
-        * If we're the non-boot CPU, nothing set the stack canary up
-        * for us.  CPU0 already has it initialized but no harm in
-        * doing it again.  This is a good place for updating it, as
-        * we wont ever return from this function (so the invalid
-        * canaries already on the stack wont ever trigger).
-        */
-       boot_init_stack_canary();
-       /* endless idle loop with no priority at all */
-       while (1) {
-               tick_nohz_idle_enter();
-               while (!need_resched()) {
-                       rmb();
-                       if (cpu_is_offline(smp_processor_id()))
-                               play_dead();
-                       /*
-                        * Idle routines should keep interrupts disabled
-                        * from here on, until they go to idle.
-                        * Otherwise, idle callbacks can misfire.
-                        */
-                       local_touch_nmi();
-                       local_irq_disable();
-                       enter_idle();
-                       /* Don't trace irqs off for idle */
-                       stop_critical_timings();
-                       /* enter_idle() needs rcu for notifiers */
-                       rcu_idle_enter();
-                       if (cpuidle_idle_call())
-                               pm_idle();
-                       rcu_idle_exit();
-                       start_critical_timings();
-                       /* In many cases the interrupt that ended idle
-                          has already called exit_idle. But some idle
-                          loops can be woken up without interrupt. */
-                       __exit_idle();
-               }
-               tick_nohz_idle_exit();
-               schedule_preempt_disabled();
-       }
- }
  
  /* Prints also some state that isn't saved in the pt_regs */
  void __show_regs(struct pt_regs *regs, int all)
diff --combined arch/x86/kernel/tls.c
@@@ -6,6 -6,7 +6,6 @@@
  
  #include <asm/uaccess.h>
  #include <asm/desc.h>
 -#include <asm/system.h>
  #include <asm/ldt.h>
  #include <asm/processor.h>
  #include <asm/proto.h>
@@@ -162,7 -163,7 +162,7 @@@ int regset_tls_get(struct task_struct *
  {
        const struct desc_struct *tls;
  
-       if (pos > GDT_ENTRY_TLS_ENTRIES * sizeof(struct user_desc) ||
+       if (pos >= GDT_ENTRY_TLS_ENTRIES * sizeof(struct user_desc) ||
            (pos % sizeof(struct user_desc)) != 0 ||
            (count % sizeof(struct user_desc)) != 0)
                return -EINVAL;
@@@ -197,7 -198,7 +197,7 @@@ int regset_tls_set(struct task_struct *
        struct user_desc infobuf[GDT_ENTRY_TLS_ENTRIES];
        const struct user_desc *info;
  
-       if (pos > GDT_ENTRY_TLS_ENTRIES * sizeof(struct user_desc) ||
+       if (pos >= GDT_ENTRY_TLS_ENTRIES * sizeof(struct user_desc) ||
            (pos % sizeof(struct user_desc)) != 0 ||
            (count % sizeof(struct user_desc)) != 0)
                return -EINVAL;
diff --combined lib/Kconfig.debug
@@@ -184,7 -184,7 +184,7 @@@ config LOCKUP_DETECTO
  
  config HARDLOCKUP_DETECTOR
        def_bool LOCKUP_DETECTOR && PERF_EVENTS && HAVE_PERF_EVENTS_NMI && \
 -               !ARCH_HAS_NMI_WATCHDOG
 +               !HAVE_NMI_WATCHDOG
  
  config BOOTPARAM_HARDLOCKUP_PANIC
        bool "Panic (Reboot) On Hard Lockups"
@@@ -499,6 -499,7 +499,7 @@@ config RT_MUTEX_TESTE
  config DEBUG_SPINLOCK
        bool "Spinlock and rw-lock debugging: basic checks"
        depends on DEBUG_KERNEL
+       select UNINLINE_SPIN_UNLOCK
        help
          Say Y here and build SMP to catch missing spinlock initialization
          and certain other kinds of spinlock errors commonly made.  This is
@@@ -1141,6 -1142,14 +1142,6 @@@ config LATENCYTO
          Enable this option if you want to use the LatencyTOP tool
          to find out which userspace is blocking on what kernel operations.
  
 -config SYSCTL_SYSCALL_CHECK
 -      bool "Sysctl checks"
 -      depends on SYSCTL
 -      ---help---
 -        sys_sysctl uses binary paths that have been found challenging
 -        to properly maintain and use. This enables checks that help
 -        you to keep things correct.
 -
  source mm/Kconfig.debug
  source kernel/trace/Kconfig