Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 597f03f9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull CPU hotplug updates from Thomas Gleixner:
 "Yet another batch of cpu hotplug core updates and conversions:

   - Provide core infrastructure for multi instance drivers so the
     drivers do not have to keep custom lists.

   - Convert custom lists to the new infrastructure. The block-mq custom
     list conversion comes through the block tree and makes the diffstat
     tip over to more lines removed than added.

   - Handle unbalanced hotplug enable/disable calls more gracefully.

   - Remove the obsolete CPU_STARTING/DYING notifier support.

   - Convert another batch of notifier users.

   The relayfs changes which conflicted with the conversion have been
   shipped to me by Andrew.

   The remaining lot is targeted for 4.10 so that we finally can remove
   the rest of the notifiers"

* 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (46 commits)
  cpufreq: Fix up conversion to hotplug state machine
  blk/mq: Reserve hotplug states for block multiqueue
  x86/apic/uv: Convert to hotplug state machine
  s390/mm/pfault: Convert to hotplug state machine
  mips/loongson/smp: Convert to hotplug state machine
  mips/octeon/smp: Convert to hotplug state machine
  fault-injection/cpu: Convert to hotplug state machine
  padata: Convert to hotplug state machine
  cpufreq: Convert to hotplug state machine
  ACPI/processor: Convert to hotplug state machine
  virtio scsi: Convert to hotplug state machine
  oprofile/timer: Convert to hotplug state machine
  block/softirq: Convert to hotplug state machine
  lib/irq_poll: Convert to hotplug state machine
  x86/microcode: Convert to hotplug state machine
  sh/SH-X3 SMP: Convert to hotplug state machine
  ia64/mca: Convert to hotplug state machine
  ARM/OMAP/wakeupgen: Convert to hotplug state machine
  ARM/shmobile: Convert to hotplug state machine
  arm64/FP/SIMD: Convert to hotplug state machine
  ...
parents 999dcbe2 0bf71e4d
Loading
Loading
Loading
Loading
+13 −22
Original line number Diff line number Diff line
@@ -322,34 +322,25 @@ static void irq_save_secure_context(void)
#endif

#ifdef CONFIG_HOTPLUG_CPU
static int irq_cpu_hotplug_notify(struct notifier_block *self,
				  unsigned long action, void *hcpu)
static int omap_wakeupgen_cpu_online(unsigned int cpu)
{
	unsigned int cpu = (unsigned int)hcpu;

	/*
	 * Corresponding FROZEN transitions do not have to be handled,
	 * they are handled by at a higher level
	 * (drivers/cpuidle/coupled.c).
	 */
	switch (action) {
	case CPU_ONLINE:
	wakeupgen_irqmask_all(cpu, 0);
		break;
	case CPU_DEAD:
		wakeupgen_irqmask_all(cpu, 1);
		break;
	}
	return NOTIFY_OK;
	return 0;
}

static struct notifier_block irq_hotplug_notifier = {
	.notifier_call = irq_cpu_hotplug_notify,
};
static int omap_wakeupgen_cpu_dead(unsigned int cpu)
{
	wakeupgen_irqmask_all(cpu, 1);
	return 0;
}

static void __init irq_hotplug_init(void)
{
	register_hotcpu_notifier(&irq_hotplug_notifier);
	cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "arm/omap-wake:online",
				  omap_wakeupgen_cpu_online, NULL);
	cpuhp_setup_state_nocalls(CPUHP_ARM_OMAP_WAKE_DEAD,
				  "arm/omap-wake:dead", NULL,
				  omap_wakeupgen_cpu_dead);
}
#else
static void __init irq_hotplug_init(void)
+8 −18
Original line number Diff line number Diff line
@@ -21,26 +21,14 @@
static phys_addr_t shmobile_scu_base_phys;
static void __iomem *shmobile_scu_base;

static int shmobile_smp_scu_notifier_call(struct notifier_block *nfb,
					  unsigned long action, void *hcpu)
static int shmobile_scu_cpu_prepare(unsigned int cpu)
{
	unsigned int cpu = (long)hcpu;

	switch (action) {
	case CPU_UP_PREPARE:
	/* For this particular CPU register SCU SMP boot vector */
	shmobile_smp_hook(cpu, virt_to_phys(shmobile_boot_scu),
			  shmobile_scu_base_phys);
		break;
	};

	return NOTIFY_OK;
	return 0;
}

static struct notifier_block shmobile_smp_scu_notifier = {
	.notifier_call = shmobile_smp_scu_notifier_call,
};

void __init shmobile_smp_scu_prepare_cpus(phys_addr_t scu_base_phys,
					  unsigned int max_cpus)
{
@@ -54,7 +42,9 @@ void __init shmobile_smp_scu_prepare_cpus(phys_addr_t scu_base_phys,
	scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);

	/* Use CPU notifier for reset vector control */
	register_cpu_notifier(&shmobile_smp_scu_notifier);
	cpuhp_setup_state_nocalls(CPUHP_ARM_SHMOBILE_SCU_PREPARE,
				  "arm/shmobile-scu:prepare",
				  shmobile_scu_cpu_prepare, NULL);
}

#ifdef CONFIG_HOTPLUG_CPU
+5 −17
Original line number Diff line number Diff line
@@ -299,28 +299,16 @@ static inline void fpsimd_pm_init(void) { }
#endif /* CONFIG_CPU_PM */

#ifdef CONFIG_HOTPLUG_CPU
static int fpsimd_cpu_hotplug_notifier(struct notifier_block *nfb,
				       unsigned long action,
				       void *hcpu)
static int fpsimd_cpu_dead(unsigned int cpu)
{
	unsigned int cpu = (long)hcpu;

	switch (action) {
	case CPU_DEAD:
	case CPU_DEAD_FROZEN:
	per_cpu(fpsimd_last_state, cpu) = NULL;
		break;
	}
	return NOTIFY_OK;
	return 0;
}

static struct notifier_block fpsimd_cpu_hotplug_notifier_block = {
	.notifier_call = fpsimd_cpu_hotplug_notifier,
};

static inline void fpsimd_hotplug_init(void)
{
	register_cpu_notifier(&fpsimd_cpu_hotplug_notifier_block);
	cpuhp_setup_state_nocalls(CPUHP_ARM64_FPSIMD_DEAD, "arm64/fpsimd:dead",
				  NULL, fpsimd_cpu_dead);
}

#else
+4 −22
Original line number Diff line number Diff line
@@ -1890,7 +1890,7 @@ ia64_mca_cpu_init(void *cpu_data)
							      PAGE_KERNEL)));
}

static void ia64_mca_cmc_vector_adjust(void *dummy)
static int ia64_mca_cpu_online(unsigned int cpu)
{
	unsigned long flags;

@@ -1898,25 +1898,9 @@ static void ia64_mca_cmc_vector_adjust(void *dummy)
	if (!cmc_polling_enabled)
		ia64_mca_cmc_vector_enable(NULL);
	local_irq_restore(flags);
	return 0;
}

static int mca_cpu_callback(struct notifier_block *nfb,
				      unsigned long action,
				      void *hcpu)
{
	switch (action) {
	case CPU_ONLINE:
	case CPU_ONLINE_FROZEN:
		ia64_mca_cmc_vector_adjust(NULL);
		break;
	}
	return NOTIFY_OK;
}

static struct notifier_block mca_cpu_notifier = {
	.notifier_call = mca_cpu_callback
};

/*
 * ia64_mca_init
 *
@@ -2111,15 +2095,13 @@ ia64_mca_late_init(void)
	if (!mca_init)
		return 0;

	register_hotcpu_notifier(&mca_cpu_notifier);

	/* Setup the CMCI/P vector and handler */
	setup_timer(&cmc_poll_timer, ia64_mca_cmc_poll, 0UL);

	/* Unmask/enable the vector */
	cmc_polling_enabled = 0;
	schedule_work(&cmc_enable_work);

	cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "ia64/mca:online",
			  ia64_mca_cpu_online, NULL);
	IA64_MCA_DEBUG("%s: CMCI/P setup and enabled.\n", __func__);

#ifdef CONFIG_ACPI
+3 −21
Original line number Diff line number Diff line
@@ -380,29 +380,11 @@ static int octeon_update_boot_vector(unsigned int cpu)
	return 0;
}

static int octeon_cpu_callback(struct notifier_block *nfb,
	unsigned long action, void *hcpu)
{
	unsigned int cpu = (unsigned long)hcpu;

	switch (action & ~CPU_TASKS_FROZEN) {
	case CPU_UP_PREPARE:
		octeon_update_boot_vector(cpu);
		break;
	case CPU_ONLINE:
		pr_info("Cpu %d online\n", cpu);
		break;
	case CPU_DEAD:
		break;
	}

	return NOTIFY_OK;
}

static int register_cavium_notifier(void)
{
	hotcpu_notifier(octeon_cpu_callback, 0);
	return 0;
	return cpuhp_setup_state_nocalls(CPUHP_MIPS_SOC_PREPARE,
					 "mips/cavium:prepare",
					 octeon_update_boot_vector, NULL);
}
late_initcall(register_cavium_notifier);

Loading