Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 29 Jul 2016 20:55:30 +0000 (13:55 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 29 Jul 2016 20:55:30 +0000 (13:55 -0700)
Pull smp hotplug updates from Thomas Gleixner:
 "This is the next part of the hotplug rework.

   - Convert all notifiers with a priority assigned

   - Convert all CPU_STARTING/DYING notifiers

     The final removal of the STARTING/DYING infrastructure will happen
     when the merge window closes.

  Another 700 hundred line of unpenetrable maze gone :)"

* 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (70 commits)
  timers/core: Correct callback order during CPU hot plug
  leds/trigger/cpu: Move from CPU_STARTING to ONLINE level
  powerpc/numa: Convert to hotplug state machine
  arm/perf: Fix hotplug state machine conversion
  irqchip/armada: Avoid unused function warnings
  ARC/time: Convert to hotplug state machine
  clocksource/atlas7: Convert to hotplug state machine
  clocksource/armada-370-xp: Convert to hotplug state machine
  clocksource/exynos_mct: Convert to hotplug state machine
  clocksource/arm_global_timer: Convert to hotplug state machine
  rcu: Convert rcutree to hotplug state machine
  KVM/arm/arm64/vgic-new: Convert to hotplug state machine
  smp/cfd: Convert core to hotplug state machine
  x86/x2apic: Convert to CPU hotplug state machine
  profile: Convert to hotplug state machine
  timers/core: Convert to hotplug state machine
  hrtimer: Convert to hotplug state machine
  x86/tboot: Convert to hotplug state machine
  arm64/armv8 deprecated: Convert to hotplug state machine
  hwtracing/coresight-etm4x: Convert to hotplug state machine
  ...

23 files changed:
1  2 
arch/arm/mach-mvebu/coherency.c
arch/arm/xen/enlighten.c
arch/arm64/kernel/armv8_deprecated.c
arch/s390/kernel/perf_cpum_sf.c
arch/x86/entry/vdso/vma.c
arch/x86/events/amd/ibs.c
arch/x86/events/core.c
arch/x86/events/intel/core.c
arch/x86/events/intel/cstate.c
arch/x86/events/intel/rapl.c
arch/x86/events/intel/uncore.c
arch/x86/kernel/apic/x2apic_cluster.c
arch/x86/kvm/x86.c
drivers/acpi/processor_driver.c
drivers/irqchip/irq-armada-370-xp.c
drivers/irqchip/irq-bcm2836.c
drivers/irqchip/irq-gic.c
drivers/perf/arm_pmu.c
include/linux/perf_event.h
kernel/events/core.c
kernel/smp.c
kernel/workqueue.c
virt/kvm/kvm_main.c

Simple merge
@@@ -425,12 -334,8 +408,8 @@@ static int __init xen_guest_init(void
                return -EINVAL;
        }
  
-       xen_percpu_init();
-       register_cpu_notifier(&xen_cpu_notifier);
 -      pv_time_ops.steal_clock = xen_stolen_accounting;
 -      static_key_slow_inc(&paravirt_steal_enabled);
 +      xen_time_setup_guest();
 +
        if (xen_initial_domain())
                pvclock_gtod_register_notifier(&xen_pvclock_gtod_notifier);
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -202,30 -202,23 +202,23 @@@ static void bcm2836_arm_irqchip_send_ip
        }
  }
  
- /* Unmasks the IPI on the CPU when it's online. */
- static int bcm2836_arm_irqchip_cpu_notify(struct notifier_block *nfb,
-                                         unsigned long action, void *hcpu)
+ static int bcm2836_cpu_starting(unsigned int cpu)
  {
-       unsigned int cpu = (unsigned long)hcpu;
-       unsigned int int_reg = LOCAL_MAILBOX_INT_CONTROL0;
-       unsigned int mailbox = 0;
-       if (action == CPU_STARTING || action == CPU_STARTING_FROZEN)
-               bcm2836_arm_irqchip_unmask_per_cpu_irq(int_reg, mailbox, cpu);
-       else if (action == CPU_DYING)
-               bcm2836_arm_irqchip_mask_per_cpu_irq(int_reg, mailbox, cpu);
-       return NOTIFY_OK;
+       bcm2836_arm_irqchip_unmask_per_cpu_irq(LOCAL_MAILBOX_INT_CONTROL0, 0,
+                                              cpu);
+       return 0;
  }
  
- static struct notifier_block bcm2836_arm_irqchip_cpu_notifier = {
-       .notifier_call = bcm2836_arm_irqchip_cpu_notify,
-       .priority = 100,
- };
+ static int bcm2836_cpu_dying(unsigned int cpu)
+ {
+       bcm2836_arm_irqchip_mask_per_cpu_irq(LOCAL_MAILBOX_INT_CONTROL0, 0,
+                                            cpu);
+       return 0;
+ }
  
  #ifdef CONFIG_ARM
 -int __init bcm2836_smp_boot_secondary(unsigned int cpu,
 -                                    struct task_struct *idle)
 +static int __init bcm2836_smp_boot_secondary(unsigned int cpu,
 +                                           struct task_struct *idle)
  {
        unsigned long secondary_startup_phys =
                (unsigned long)virt_to_phys((void *)secondary_startup);
Simple merge
Simple merge
@@@ -1302,48 -1283,8 +1302,13 @@@ extern void perf_restore_debug_store(vo
  static inline void perf_restore_debug_store(void)                     { }
  #endif
  
 +static __always_inline bool perf_raw_frag_last(const struct perf_raw_frag *frag)
 +{
 +      return frag->pad < sizeof(u64);
 +}
 +
  #define perf_output_put(handle, x) perf_output_copy((handle), &(x), sizeof(x))
  
- /*
-  * This has to have a higher priority than migration_notifier in sched/core.c.
-  */
- #define perf_cpu_notifier(fn)                                         \
- do {                                                                  \
-       static struct notifier_block fn##_nb =                          \
-               { .notifier_call = fn, .priority = CPU_PRI_PERF };      \
-       unsigned long cpu = smp_processor_id();                         \
-       unsigned long flags;                                            \
-                                                                       \
-       cpu_notifier_register_begin();                                  \
-       fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE,                     \
-               (void *)(unsigned long)cpu);                            \
-       local_irq_save(flags);                                          \
-       fn(&fn##_nb, (unsigned long)CPU_STARTING,                       \
-               (void *)(unsigned long)cpu);                            \
-       local_irq_restore(flags);                                       \
-       fn(&fn##_nb, (unsigned long)CPU_ONLINE,                         \
-               (void *)(unsigned long)cpu);                            \
-       __register_cpu_notifier(&fn##_nb);                              \
-       cpu_notifier_register_done();                                   \
- } while (0)
- /*
-  * Bare-bones version of perf_cpu_notifier(), which doesn't invoke the
-  * callback for already online CPUs.
-  */
- #define __perf_cpu_notifier(fn)                                               \
- do {                                                                  \
-       static struct notifier_block fn##_nb =                          \
-               { .notifier_call = fn, .priority = CPU_PRI_PERF };      \
-                                                                       \
-       __register_cpu_notifier(&fn##_nb);                              \
- } while (0)
  struct perf_pmu_events_attr {
        struct device_attribute attr;
        u64 id;
Simple merge
diff --cc kernel/smp.c
Simple merge
@@@ -4604,18 -4605,27 +4604,24 @@@ static void restore_unbound_workers_cpu
  
        /* as we're called from CPU_ONLINE, the following shouldn't fail */
        for_each_pool_worker(worker, pool)
 -              WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task,
 -                                                pool->attrs->cpumask) < 0);
 +              WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, &cpumask) < 0);
  }
  
- /*
-  * Workqueues should be brought up before normal priority CPU notifiers.
-  * This will be registered high priority CPU notifier.
-  */
- static int workqueue_cpu_up_callback(struct notifier_block *nfb,
-                                              unsigned long action,
-                                              void *hcpu)
+ int workqueue_prepare_cpu(unsigned int cpu)
+ {
+       struct worker_pool *pool;
+       for_each_cpu_worker_pool(pool, cpu) {
+               if (pool->nr_workers)
+                       continue;
+               if (!create_worker(pool))
+                       return -ENOMEM;
+       }
+       return 0;
+ }
+ int workqueue_online_cpu(unsigned int cpu)
  {
-       int cpu = (unsigned long)hcpu;
        struct worker_pool *pool;
        struct workqueue_struct *wq;
        int pi;
Simple merge