Merge tag 'for-linus' of git://github.com/rustyrussell/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 2 Apr 2012 15:53:24 +0000 (08:53 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 2 Apr 2012 15:53:24 +0000 (08:53 -0700)
Pull cpumask cleanups from Rusty Russell:
 "(Somehow forgot to send this out; it's been sitting in linux-next, and
  if you don't want it, it can sit there another cycle)"

I'm a sucker for things that actually delete lines of code.

Fix up trivial conflict in arch/arm/kernel/kprobes.c, where Rusty fixed
a user of &cpu_online_map to be cpu_online_mask, but that code got
deleted by commit b21d55e98ac2 ("ARM: 7332/1: extract out code patch
function from kprobes").

* tag 'for-linus' of git://github.com/rustyrussell/linux:
  cpumask: remove old cpu_*_map.
  documentation: remove references to cpu_*_map.
  drivers/cpufreq/db8500-cpufreq: remove references to cpu_*_map.
  remove references to cpu_*_map in arch/

1  2 
arch/arm/kernel/kprobes.c
arch/arm/kernel/smp.c
kernel/cpuset.c

@@@ -29,7 -29,6 +29,7 @@@
  #include <asm/cacheflush.h>
  
  #include "kprobes.h"
 +#include "patch.h"
  
  #define MIN_STACK_SIZE(addr)                          \
        min((unsigned long)MAX_STACK_SIZE,              \
@@@ -104,33 -103,57 +104,33 @@@ int __kprobes arch_prepare_kprobe(struc
        return 0;
  }
  
 -#ifdef CONFIG_THUMB2_KERNEL
 -
 -/*
 - * For a 32-bit Thumb breakpoint spanning two memory words we need to take
 - * special precautions to insert the breakpoint atomically, especially on SMP
 - * systems. This is achieved by calling this arming function using stop_machine.
 - */
 -static int __kprobes set_t32_breakpoint(void *addr)
 -{
 -      ((u16 *)addr)[0] = KPROBE_THUMB32_BREAKPOINT_INSTRUCTION >> 16;
 -      ((u16 *)addr)[1] = KPROBE_THUMB32_BREAKPOINT_INSTRUCTION & 0xffff;
 -      flush_insns(addr, 2*sizeof(u16));
 -      return 0;
 -}
 -
  void __kprobes arch_arm_kprobe(struct kprobe *p)
  {
 -      uintptr_t addr = (uintptr_t)p->addr & ~1; /* Remove any Thumb flag */
 -
 -      if (!is_wide_instruction(p->opcode)) {
 -              *(u16 *)addr = KPROBE_THUMB16_BREAKPOINT_INSTRUCTION;
 -              flush_insns(addr, sizeof(u16));
 -      } else if (addr & 2) {
 -              /* A 32-bit instruction spanning two words needs special care */
 -              stop_machine(set_t32_breakpoint, (void *)addr, cpu_online_mask);
 +      unsigned int brkp;
 +      void *addr;
 +
 +      if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) {
 +              /* Remove any Thumb flag */
 +              addr = (void *)((uintptr_t)p->addr & ~1);
 +
 +              if (is_wide_instruction(p->opcode))
 +                      brkp = KPROBE_THUMB32_BREAKPOINT_INSTRUCTION;
 +              else
 +                      brkp = KPROBE_THUMB16_BREAKPOINT_INSTRUCTION;
        } else {
 -              /* Word aligned 32-bit instruction can be written atomically */
 -              u32 bkp = KPROBE_THUMB32_BREAKPOINT_INSTRUCTION;
 -#ifndef __ARMEB__ /* Swap halfwords for little-endian */
 -              bkp = (bkp >> 16) | (bkp << 16);
 -#endif
 -              *(u32 *)addr = bkp;
 -              flush_insns(addr, sizeof(u32));
 -      }
 -}
 +              kprobe_opcode_t insn = p->opcode;
  
 -#else /* !CONFIG_THUMB2_KERNEL */
 +              addr = p->addr;
 +              brkp = KPROBE_ARM_BREAKPOINT_INSTRUCTION;
  
 -void __kprobes arch_arm_kprobe(struct kprobe *p)
 -{
 -      kprobe_opcode_t insn = p->opcode;
 -      kprobe_opcode_t brkp = KPROBE_ARM_BREAKPOINT_INSTRUCTION;
 -      if (insn >= 0xe0000000)
 -              brkp |= 0xe0000000;  /* Unconditional instruction */
 -      else
 -              brkp |= insn & 0xf0000000;  /* Copy condition from insn */
 -      *p->addr = brkp;
 -      flush_insns(p->addr, sizeof(p->addr[0]));
 -}
 +              if (insn >= 0xe0000000)
 +                      brkp |= 0xe0000000;  /* Unconditional instruction */
 +              else
 +                      brkp |= insn & 0xf0000000;  /* Copy condition from insn */
 +      }
  
 -#endif /* !CONFIG_THUMB2_KERNEL */
 +      patch_text(addr, brkp);
 +}
  
  /*
   * The actual disarming is done here on each CPU and synchronized using
  int __kprobes __arch_disarm_kprobe(void *p)
  {
        struct kprobe *kp = p;
 -#ifdef CONFIG_THUMB2_KERNEL
 -      u16 *addr = (u16 *)((uintptr_t)kp->addr & ~1);
 -      kprobe_opcode_t insn = kp->opcode;
 -      unsigned int len;
 +      void *addr = (void *)((uintptr_t)kp->addr & ~1);
  
 -      if (is_wide_instruction(insn)) {
 -              ((u16 *)addr)[0] = insn>>16;
 -              ((u16 *)addr)[1] = insn;
 -              len = 2*sizeof(u16);
 -      } else {
 -              ((u16 *)addr)[0] = insn;
 -              len = sizeof(u16);
 -      }
 -      flush_insns(addr, len);
 +      __patch_text(addr, kp->opcode);
  
 -#else /* !CONFIG_THUMB2_KERNEL */
 -      *kp->addr = kp->opcode;
 -      flush_insns(kp->addr, sizeof(kp->addr[0]));
 -#endif
        return 0;
  }
  
  void __kprobes arch_disarm_kprobe(struct kprobe *p)
  {
-       stop_machine(__arch_disarm_kprobe, p, &cpu_online_map);
+       stop_machine(__arch_disarm_kprobe, p, cpu_online_mask);
  }
  
  void __kprobes arch_remove_kprobe(struct kprobe *p)
diff --combined arch/arm/kernel/smp.c
@@@ -58,8 -58,6 +58,8 @@@ enum ipi_msg_type 
        IPI_CPU_STOP,
  };
  
 +static DECLARE_COMPLETION(cpu_running);
 +
  int __cpuinit __cpu_up(unsigned int cpu)
  {
        struct cpuinfo_arm *ci = &per_cpu(cpu_data, cpu);
         */
        ret = boot_secondary(cpu, idle);
        if (ret == 0) {
 -              unsigned long timeout;
 -
                /*
                 * CPU was successfully started, wait for it
                 * to come online or time out.
                 */
 -              timeout = jiffies + HZ;
 -              while (time_before(jiffies, timeout)) {
 -                      if (cpu_online(cpu))
 -                              break;
 -
 -                      udelay(10);
 -                      barrier();
 -              }
 +              wait_for_completion_timeout(&cpu_running,
 +                                               msecs_to_jiffies(1000));
  
                if (!cpu_online(cpu)) {
                        pr_crit("CPU%u: failed to come online\n", cpu);
@@@ -282,10 -288,9 +282,10 @@@ asmlinkage void __cpuinit secondary_sta
        /*
         * OK, now it's safe to let the boot CPU continue.  Wait for
         * the CPU migration code to notice that the CPU is online
 -       * before we continue.
 +       * before we continue - which happens after __cpu_up returns.
         */
        set_cpu_online(cpu, true);
 +      complete(&cpu_running);
  
        /*
         * Setup the percpu timer for this CPU.
@@@ -349,7 -354,7 +349,7 @@@ void __init smp_prepare_cpus(unsigned i
                 * re-initialize the map in platform_smp_prepare_cpus() if
                 * present != possible (e.g. physical hotplug).
                 */
-               init_cpu_present(&cpu_possible_map);
+               init_cpu_present(cpu_possible_mask);
  
                /*
                 * Initialise the SCU if there are more than one CPU
@@@ -581,8 -586,9 +581,9 @@@ void smp_send_stop(void
        unsigned long timeout;
  
        if (num_online_cpus() > 1) {
-               cpumask_t mask = cpu_online_map;
-               cpu_clear(smp_processor_id(), mask);
+               struct cpumask mask;
+               cpumask_copy(&mask, cpu_online_mask);
+               cpumask_clear_cpu(smp_processor_id(), &mask);
  
                smp_cross_call(&mask, IPI_CPU_STOP);
        }
diff --combined kernel/cpuset.c
@@@ -270,11 -270,11 +270,11 @@@ static struct file_system_type cpuset_f
   * are online.  If none are online, walk up the cpuset hierarchy
   * until we find one that does have some online cpus.  If we get
   * all the way to the top and still haven't found any online cpus,
-  * return cpu_online_map.  Or if passed a NULL cs from an exit'ing
-  * task, return cpu_online_map.
+  * return cpu_online_mask.  Or if passed a NULL cs from an exit'ing
+  * task, return cpu_online_mask.
   *
   * One way or another, we guarantee to return some non-empty subset
-  * of cpu_online_map.
+  * of cpu_online_mask.
   *
   * Call with callback_mutex held.
   */
@@@ -867,7 -867,7 +867,7 @@@ static int update_cpumask(struct cpuse
        int retval;
        int is_load_balanced;
  
-       /* top_cpuset.cpus_allowed tracks cpu_online_map; it's read-only */
+       /* top_cpuset.cpus_allowed tracks cpu_online_mask; it's read-only */
        if (cs == &top_cpuset)
                return -EACCES;
  
@@@ -2149,7 -2149,7 +2149,7 @@@ void __init cpuset_init_smp(void
   *
   * Description: Returns the cpumask_var_t cpus_allowed of the cpuset
   * attached to the specified @tsk.  Guaranteed to return some non-empty
-  * subset of cpu_online_map, even if this means going outside the
+  * subset of cpu_online_mask, even if this means going outside the
   * tasks cpuset.
   **/
  
@@@ -2162,9 -2162,10 +2162,9 @@@ void cpuset_cpus_allowed(struct task_st
        mutex_unlock(&callback_mutex);
  }
  
 -int cpuset_cpus_allowed_fallback(struct task_struct *tsk)
 +void cpuset_cpus_allowed_fallback(struct task_struct *tsk)
  {
        const struct cpuset *cs;
 -      int cpu;
  
        rcu_read_lock();
        cs = task_cs(tsk);
         * changes in tsk_cs()->cpus_allowed. Otherwise we can temporary
         * set any mask even if it is not right from task_cs() pov,
         * the pending set_cpus_allowed_ptr() will fix things.
 +       *
 +       * select_fallback_rq() will fix things ups and set cpu_possible_mask
 +       * if required.
         */
 -
 -      cpu = cpumask_any_and(&tsk->cpus_allowed, cpu_active_mask);
 -      if (cpu >= nr_cpu_ids) {
 -              /*
 -               * Either tsk->cpus_allowed is wrong (see above) or it
 -               * is actually empty. The latter case is only possible
 -               * if we are racing with remove_tasks_in_empty_cpuset().
 -               * Like above we can temporary set any mask and rely on
 -               * set_cpus_allowed_ptr() as synchronization point.
 -               */
 -              do_set_cpus_allowed(tsk, cpu_possible_mask);
 -              cpu = cpumask_any(cpu_active_mask);
 -      }
 -
 -      return cpu;
  }
  
  void cpuset_init_current_mems_allowed(void)