Skip to contentSkip to conversation

Gloabl CPU Hot-plug flag _FROZEN Clean up

RFC PATCH In review Chen, Gong 4 participants 105 messages Jul 23, 2014 – Jul 31, 2014

Subsystems (48)
lore
Share & tools
lore

Chen, Gong

author
#0 lore raw

cover Gloabl CPU Hot-plug flag _FROZEN Clean up

Back to long time ago (about 1.5 years), Thomas began the work for CPU hot-plug, one first thing is CPU hotplug flag cleanup. Paul hoped all the _FROZEN variants of the notifier actions can be removed at that time. Now here it is.

Patch 1 ~ 69: remove all kinds of XXX_FROZEN usages Patch 70: remove XXX_FROZEN from the kernel thoroughly

Not sure if removing XXX_FROZEN flags thoroughly is overkilled. Fix me if I'm wrong.

P.S. My last post is banned because of the capital Triple-X in subject :-(

----------------------------------------------------------------
Chen, Gong (69):
ia64, err_inject: _FROZEN Cleanup
ia64, mca: _FROZEN Cleanup
ia64, palinfo: _FROZEN Cleanup
ia64, salinfo: _FROZEN Cleanup
ia64, topology: _FROZEN Cleanup
x86, intel_cacheinfo: _FROZEN Cleanup x86, mce, therm_throt: _FROZEN Cleanup x86, mce_amd: _FROZEN Cleanup
x86, kvm: _FROZEN Cleanup
x86, vsyscall_64: _FROZEN Cleanup
x86, pci, amd_bus: _FROZEN Cleanup
x86, x2apic_cluster: _FROZEN Cleanup x86, microcode, core: _FROZEN Cleanup x86, kernel, cpuid: _FROZEN Cleanup x86, kernel, msr: _FROZEN Cleanup
arm, vfp, vfpmodule: _FROZEN Cleanup arm, kvm: _FROZEN Cleanup
powerpc, sysfs: _FROZEN Cleanup powerpc, mm, numa: _FROZEN Cleanup powerpc, powermac, smp: _FROZEN Cleanup powerpc, mmu_context_nohash: _FROZEN Cleanup mips, loongson, smp: _FROZEN Cleanup s390, perf_cpum_sf: _FROZEN Cleanup sparc, sysfs: _FROZEN Cleanup
rcu, tree: _FROZEN Cleanup
kernel, padata: _FROZEN Cleanup
kernel, profile: _FROZEN Cleanup kernel, sched, core: _FROZEN Cleanup kernel, hrtimer: _FROZEN Cleanup kernel, relay: _FROZEN Cleanup
kernel, smp: _FROZEN Cleanup
kernel, timer: _FROZEN Cleanup
kernel, softirq: _FROZEN Cleanup
mm, slab: _FROZEN Cleanup
mm, vmscan: _FROZEN Cleanup
mm, vmstat: _FROZEN Cleanup
mm, memcontrol: _FROZEN Cleanup
mm, page_alloc: _FROZEN Cleanup
mm, slub: _FROZEN Cleanup
fs, buffer: _FROZEN Cleanup
xfs, xfs_mount: _FROZEN Cleanup
net, iucv: _FROZEN Cleanup
net, core, flow: _FROZEN Cleanup
net, core, dev: _FROZEN Cleanup
block, blk-mq: _FROZEN Cleanup
block, blk-iopoll: _FROZEN Cleanup block, blk-softirq: _FROZEN Cleanup driver, base, topology: _FROZEN Cleanup clocksource, metag_generic: _FROZEN Cleanup powercap, intel_rapl: _FROZEN Cleanup cpuidle, cpuidle-powernv: _FROZEN Cleanup cpuidle, cpuidle-pseries: _FROZEN Cleanup cpufreq, acpi-cpufreq: _FROZEN Cleanup irqchip, irq-armada-370-xp: _FROZEN Cleanup irqchip, irq-gic: _FROZEN Cleanup
scsi, bnx2fc, bnx2fc_fcoe: _FROZEN Cleanup scsi, bnx2i, bnx2i_init: _FROZEN Cleanup scsi, fcoe: _FROZEN Cleanup
scsi, virtio_scsi: _FROZEN Cleanup
md, raid5: _FROZEN Cleanup
virt, kvm, arm, arch_timer: _FROZEN Cleanup virt, kvm, arm, vgic: _FROZEN Cleanup trace, ring_buffer: _FROZEN Cleanup oprofile, timer_int: _FROZEN Cleanup lib, cpu-notifier-error-inject: _FROZEN Cleanup lib, percpu_counter: _FROZEN Cleanup lib, radix-tree: _FROZEN Cleanup staging, lustre, linux-cpu: _FROZEN Cleanup
cpu: Eliminate _FROZEN flags thoroughly

Thomas Gleixner (1):
cpu: Restructure FROZEN state handling

 arch/arm/kvm/arm.c                                 |  3 +-
 arch/arm/vfp/vfpmodule.c                           |  6 +-
 arch/ia64/kernel/err_inject.c                      |  4 +-
 arch/ia64/kernel/mca.c                             |  3 +-
 arch/ia64/kernel/palinfo.c                         |  4 +-
 arch/ia64/kernel/salinfo.c                         |  4 +-
 arch/ia64/kernel/topology.c                        |  4 +-
 arch/mips/loongson/loongson-3/smp.c                |  5 +-
 arch/powerpc/kernel/sysfs.c                        |  4 +-
 arch/powerpc/mm/mmu_context_nohash.c               |  5 +-
 arch/powerpc/mm/numa.c                             |  5 +-
 arch/powerpc/platforms/powermac/smp.c              | 11 ++--
 arch/s390/kernel/perf_cpum_sf.c                    |  1 -
 arch/sparc/kernel/sysfs.c                          |  4 +-
 arch/x86/kernel/apic/x2apic_cluster.c              | 11 +++-
 arch/x86/kernel/cpu/intel_cacheinfo.c              |  4 +-
 arch/x86/kernel/cpu/mcheck/mce_amd.c               |  4 +-
 arch/x86/kernel/cpu/mcheck/therm_throt.c           |  5 +-
 arch/x86/kernel/cpu/microcode/core.c               |  8 +--
 arch/x86/kernel/cpuid.c                            |  6 +-
 arch/x86/kernel/kvm.c                              |  9 +--
 arch/x86/kernel/msr.c                              |  6 +-
 arch/x86/kernel/vsyscall_64.c                      |  2 +-
 arch/x86/pci/amd_bus.c                             |  3 +-
 block/blk-iopoll.c                                 |  2 +-
 block/blk-mq.c                                     | 10 ++--
 block/blk-softirq.c                                |  2 +-
 drivers/base/topology.c                            |  5 +-
 drivers/clocksource/metag_generic.c                |  3 +-
 drivers/cpufreq/acpi-cpufreq.c                     |  4 +-
 drivers/cpuidle/cpuidle-powernv.c                  |  4 +-
 drivers/cpuidle/cpuidle-pseries.c                  |  4 +-
 drivers/irqchip/irq-armada-370-xp.c                |  2 +-
 drivers/irqchip/irq-gic.c                          |  2 +-
 drivers/md/raid5.c                                 |  4 +-
 drivers/oprofile/timer_int.c                       |  4 +-
 drivers/powercap/intel_rapl.c                      |  5 +-
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c                  |  4 +-
 drivers/scsi/bnx2i/bnx2i_init.c                    |  4 +-
 drivers/scsi/fcoe/fcoe.c                           |  4 +-
 drivers/scsi/virtio_scsi.c                         |  4 +-
 .../staging/lustre/lustre/libcfs/linux/linux-cpu.c |  6 +-
 fs/buffer.c                                        |  2 +-
 fs/xfs/xfs_mount.c                                 |  5 +-
 include/linux/cpu.h                                |  9 ---
 kernel/cpu.c                                       | 66 +++++++++-------------
 kernel/hrtimer.c                                   | 10 +---
 kernel/padata.c                                    |  6 +-
 kernel/profile.c                                   |  6 +-
 kernel/rcu/tree.c                                  | 12 ++--
 kernel/relay.c                                     |  4 +-
 kernel/sched/core.c                                | 55 ++++++++----------
 kernel/smp.c                                       |  8 +--
 kernel/softirq.c                                   |  3 +-
 kernel/timer.c                                     |  4 +-
 kernel/trace/ring_buffer.c                         |  4 +-
 lib/cpu-notifier-error-inject.c                    |  8 +--
 lib/percpu_counter.c                               |  2 +-
 lib/radix-tree.c                                   |  2 +-
 mm/memcontrol.c                                    |  2 +-
 mm/page_alloc.c                                    |  2 +-
 mm/slab.c                                          |  8 +--
 mm/slub.c                                          |  4 +-
 mm/vmscan.c                                        |  2 +-
 mm/vmstat.c                                        |  6 +-
 net/core/dev.c                                     |  2 +-
 net/core/flow.c                                    |  4 +-
 net/iucv/iucv.c                                    |  8 +--
 virt/kvm/arm/arch_timer.c                          |  4 +-
 virt/kvm/arm/vgic.c                                |  4 +-
 70 files changed, 159 insertions(+), 287 deletions(-)
author
#1 lore raw

RFC PATCH 1/70 cpu: Restructure FROZEN state handling

From: Thomas Gleixner <[email protected]>

There are only a few callbacks which really care about FROZEN vs. !FROZEN. No need to have extra states for this.

Publish the frozen state in an extra variable which is updated under the hotplug lock and let the users interested deal with it w/o imposing that extra state checks on everyone.

---
 kernel/cpu.c | 66 +++++++++++++++++++++++++-----------------------------------
 1 file changed, 27 insertions(+), 39 deletions(-)
kernel/cpu.c +27 -39
index a343bde..3da7e82 100644
@@ -27,6 +27,7 @@
 #ifdef CONFIG_SMP
 /* Serializes the updates to cpu_online_mask, cpu_present_mask */
 static DEFINE_MUTEX(cpu_add_remove_lock);
+static bool cpuhp_tasks_frozen;
 
 /*
  * The following two APIs (cpu_maps_update_begin/done) must be used when
@@ -194,27 +195,30 @@ int __ref __register_cpu_notifier(struct notifier_block *nb)
 	return raw_notifier_chain_register(&cpu_chain, nb);
 }
 
-static int __cpu_notify(unsigned long val, void *v, int nr_to_call,
+static int __cpu_notify(unsigned long val, unsigned int cpu, int nr_to_call,
 			int *nr_calls)
 {
+	unsigned long mod = cpuhp_tasks_frozen ? CPU_TASKS_FROZEN : 0;
+	void *hcpu = (void *)(long)cpu;
+
 	int ret;
 
-	ret = __raw_notifier_call_chain(&cpu_chain, val, v, nr_to_call,
+	ret = __raw_notifier_call_chain(&cpu_chain, val | mod, hcpu, nr_to_call,
 					nr_calls);
 
 	return notifier_to_errno(ret);
 }
 
-static int cpu_notify(unsigned long val, void *v)
+static int cpu_notify(unsigned long val, unsigned int cpu)
 {
-	return __cpu_notify(val, v, -1, NULL);
+	return __cpu_notify(val, cpu, -1, NULL);
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
 
-static void cpu_notify_nofail(unsigned long val, void *v)
+static void cpu_notify_nofail(unsigned long val, unsigned int cpu)
 {
-	BUG_ON(cpu_notify(val, v));
+	BUG_ON(cpu_notify(val, cpu));
 }
 EXPORT_SYMBOL(register_cpu_notifier);
 EXPORT_SYMBOL(__register_cpu_notifier);
@@ -291,23 +295,17 @@ static inline void check_for_tasks(int cpu)
 	write_unlock_irq(&tasklist_lock);
 }
 
-struct take_cpu_down_param {
-	unsigned long mod;
-	void *hcpu;
-};
-
 /* Take this CPU down. */
 static int __ref take_cpu_down(void *_param)
 {
-	struct take_cpu_down_param *param = _param;
-	int err;
+	int err, cpu = smp_processor_id();
 
 	/* Ensure this CPU doesn't handle any more interrupts. */
 	err = __cpu_disable();
 	if (err < 0)
 		return err;
 
-	cpu_notify(CPU_DYING | param->mod, param->hcpu);
+	cpu_notify(CPU_DYING, cpu);
 	/* Park the stopper thread */
 	kthread_park(current);
 	return 0;
@@ -317,12 +315,6 @@ static int __ref take_cpu_down(void *_param)
 static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
 {
 	int err, nr_calls = 0;
-	void *hcpu = (void *)(long)cpu;
-	unsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0;
-	struct take_cpu_down_param tcd_param = {
-		.mod = mod,
-		.hcpu = hcpu,
-	};
 
 	if (num_online_cpus() == 1)
 		return -EBUSY;
@@ -332,10 +324,12 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
 
 	cpu_hotplug_begin();
 
-	err = __cpu_notify(CPU_DOWN_PREPARE | mod, hcpu, -1, &nr_calls);
+	cpuhp_tasks_frozen = tasks_frozen;
+
+	err = __cpu_notify(CPU_DOWN_PREPARE, cpu, -1, &nr_calls);
 	if (err) {
 		nr_calls--;
-		__cpu_notify(CPU_DOWN_FAILED | mod, hcpu, nr_calls, NULL);
+		__cpu_notify(CPU_DOWN_FAILED, cpu, nr_calls, NULL);
 		pr_warn("%s: attempt to take down CPU %u failed\n",
 			__func__, cpu);
 		goto out_release;
@@ -362,11 +356,11 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
 	 * So now all preempt/rcu users must observe !cpu_active().
 	 */
 
-	err = __stop_machine(take_cpu_down, &tcd_param, cpumask_of(cpu));
+	err = __stop_machine(take_cpu_down, NULL, cpumask_of(cpu));
 	if (err) {
 		/* CPU didn't die: tell everyone.  Can't complain. */
 		smpboot_unpark_threads(cpu);
-		cpu_notify_nofail(CPU_DOWN_FAILED | mod, hcpu);
+		cpu_notify_nofail(CPU_DOWN_FAILED, cpu);
 		goto out_release;
 	}
 	BUG_ON(cpu_online(cpu));
@@ -385,14 +379,14 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
 	__cpu_die(cpu);
 
 	/* CPU is completely dead: tell everyone.  Too late to complain. */
-	cpu_notify_nofail(CPU_DEAD | mod, hcpu);
+	cpu_notify_nofail(CPU_DEAD, cpu);
 
 	check_for_tasks(cpu);
 
 out_release:
 	cpu_hotplug_done();
 	if (!err)
-		cpu_notify_nofail(CPU_POST_DEAD | mod, hcpu);
+		cpu_notify_nofail(CPU_POST_DEAD, cpu);
 	return err;
 }
 
@@ -419,10 +413,8 @@ EXPORT_SYMBOL(cpu_down);
 /* Requires cpu_add_remove_lock to be held */
 static int _cpu_up(unsigned int cpu, int tasks_frozen)
 {
-	int ret, nr_calls = 0;
-	void *hcpu = (void *)(long)cpu;
-	unsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0;
 	struct task_struct *idle;
+	int ret, nr_calls = 0;
 
 	cpu_hotplug_begin();
 
@@ -441,7 +433,9 @@ static int _cpu_up(unsigned int cpu, int tasks_frozen)
 	if (ret)
 		goto out;
 
-	ret = __cpu_notify(CPU_UP_PREPARE | mod, hcpu, -1, &nr_calls);
+	cpuhp_tasks_frozen = tasks_frozen;
+
+	ret = __cpu_notify(CPU_UP_PREPARE, cpu, -1, &nr_calls);
 	if (ret) {
 		nr_calls--;
 		pr_warn("%s: attempt to bring up CPU %u failed\n",
@@ -459,11 +453,11 @@ static int _cpu_up(unsigned int cpu, int tasks_frozen)
 	smpboot_unpark_threads(cpu);
 
 	/* Now call notifier in preparation. */
-	cpu_notify(CPU_ONLINE | mod, hcpu);
+	cpu_notify(CPU_ONLINE, cpu);
 
 out_notify:
 	if (ret != 0)
-		__cpu_notify(CPU_UP_CANCELED | mod, hcpu, nr_calls, NULL);
+		__cpu_notify(CPU_UP_CANCELED, cpu, nr_calls, NULL);
 out:
 	cpu_hotplug_done();
 
@@ -650,13 +644,7 @@ core_initcall(cpu_hotplug_pm_sync_init);
  */
 void notify_cpu_starting(unsigned int cpu)
 {
-	unsigned long val = CPU_STARTING;
-
-#ifdef CONFIG_PM_SLEEP_SMP
-	if (frozen_cpus != NULL && cpumask_test_cpu(cpu, frozen_cpus))
-		val = CPU_STARTING_FROZEN;
-#endif /* CONFIG_PM_SLEEP_SMP */
-	cpu_notify(val, (void *)(long)cpu);
+	cpu_notify(CPU_STARTING, cpu);
 }
 
 #endif /* CONFIG_SMP */
Signature · 1 line
2.0.0.rc2
maintainer Acked-by on v1 1/70
#2 lore raw

Re: [RFC PATCH v1 01/70] cpu: Restructure FROZEN state handling

Quoted 11 lines · Gong

From: Thomas Gleixner <[email protected]>

There are only a few callbacks which really care about FROZEN vs. !FROZEN. No need to have extra states for this.

Publish the frozen state in an extra variable which is updated under the hotplug lock and let the users interested deal with it w/o imposing that extra state checks on everyone.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author
#3 lore raw

RFC PATCH 2/70 ia64, err_inject: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from ia64/err_inject.

---
 arch/ia64/kernel/err_inject.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/ia64/kernel/err_inject.c +1 -3
index 0c161ed..a8b70d4 100644
@@ -242,13 +242,11 @@ static int err_inject_cpu_callback(struct notifier_block *nfb,
 	struct device *sys_dev;
 
 	sys_dev = get_cpu_device(cpu);
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		err_inject_add_dev(sys_dev);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		err_inject_remove_dev(sys_dev);
 		break;
 	}
Signature · 1 line
2.0.0.rc2
author
#4 lore raw

RFC PATCH 3/70 ia64, mca: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from ia64/mca.

---
 arch/ia64/kernel/mca.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/ia64/kernel/mca.c +1 -2
index db7b36b..c89faa6 100644
@@ -1906,9 +1906,8 @@ static int mca_cpu_callback(struct notifier_block *nfb,
 {
 	int hotcpu = (unsigned long) hcpu;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		smp_call_function_single(hotcpu, ia64_mca_cmc_vector_adjust,
 					 NULL, 0);
 		break;
Signature · 1 line
2.0.0.rc2
author
#5 lore raw

RFC PATCH 4/70 ia64, palinfo: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from ia64/palinfo.

---
 arch/ia64/kernel/palinfo.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/ia64/kernel/palinfo.c +1 -3
index c39c3cd..e0ce152 100644
@@ -967,13 +967,11 @@ static int palinfo_cpu_callback(struct notifier_block *nfb,
 {
 	unsigned int hotcpu = (unsigned long)hcpu;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		create_palinfo_proc_entries(hotcpu);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		remove_palinfo_proc_entries(hotcpu);
 		break;
 	}
Signature · 1 line
2.0.0.rc2
author
#6 lore raw

RFC PATCH 5/70 ia64, salinfo: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from ia64/salinfo.

---
 arch/ia64/kernel/salinfo.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/ia64/kernel/salinfo.c +1 -3
index ee9719e..c454375 100644
@@ -574,9 +574,8 @@ salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu
 	unsigned int i, cpu = (unsigned long)hcpu;
 	unsigned long flags;
 	struct salinfo_data *data;
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		spin_lock_irqsave(&data_saved_lock, flags);
 		for (i = 0, data = salinfo_data;
 		     i < ARRAY_SIZE(salinfo_data);
@@ -587,7 +586,6 @@ salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu
 		spin_unlock_irqrestore(&data_saved_lock, flags);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		spin_lock_irqsave(&data_saved_lock, flags);
 		for (i = 0, data = salinfo_data;
 		     i < ARRAY_SIZE(salinfo_data);
Signature · 1 line
2.0.0.rc2
author
#7 lore raw

RFC PATCH 6/70 ia64, topology: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from ia64/topology.

---
 arch/ia64/kernel/topology.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/ia64/kernel/topology.c +1 -3
index f295f9a..b39c9b6 100644
@@ -432,13 +432,11 @@ static int cache_cpu_callback(struct notifier_block *nfb,
 	struct device *sys_dev;
 
 	sys_dev = get_cpu_device(cpu);
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		cache_add_dev(sys_dev);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		cache_remove_dev(sys_dev);
 		break;
 	}
Signature · 1 line
2.0.0.rc2
author
#8 lore raw

RFC PATCH 7/70 x86, intel_cacheinfo: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from x86/intel_cacheinfo.

---
 arch/x86/kernel/cpu/intel_cacheinfo.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/x86/kernel/cpu/intel_cacheinfo.c +1 -3
index a952e9c..2e8161e 100644
@@ -1206,13 +1206,11 @@ static int cacheinfo_cpu_callback(struct notifier_block *nfb,
 	struct device *dev;
 
 	dev = get_cpu_device(cpu);
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		cache_add_dev(dev);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		cache_remove_dev(dev);
 		break;
 	}
Signature · 1 line
2.0.0.rc2
author
#10 lore raw

RFC PATCH 8/70 x86, mce, therm_throt: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from mce/therm_throt.

---
 arch/x86/kernel/cpu/mcheck/therm_throt.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/x86/kernel/cpu/mcheck/therm_throt.c +1 -4
index 36a1bb6..dd13686 100644
@@ -283,16 +283,13 @@ thermal_throttle_cpu_callback(struct notifier_block *nfb,
 
 	dev = get_cpu_device(cpu);
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		err = thermal_throttle_add_dev(dev, cpu);
 		WARN_ON(err);
 		break;
 	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		thermal_throttle_remove_dev(dev);
 		break;
 	}
Signature · 1 line
2.0.0.rc2
author
#12 lore raw

RFC PATCH 9/70 x86, mce_amd: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from x86/mce_amd.

---
 arch/x86/kernel/cpu/mcheck/mce_amd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/x86/kernel/cpu/mcheck/mce_amd.c +1 -3
index 603df4f..cc57f13 100644
@@ -737,13 +737,11 @@ static void threshold_remove_device(unsigned int cpu)
 static void
 amd_64_threshold_cpu_callback(unsigned long action, unsigned int cpu)
 {
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		threshold_create_device(cpu);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		threshold_remove_device(cpu);
 		break;
 	default:
Signature · 1 line
2.0.0.rc2
author
#14 lore raw

RFC PATCH 10/70 x86, kvm: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from kvm.

---
 arch/x86/kernel/kvm.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
arch/x86/kernel/kvm.c +5 -4
index 3dd8e2c..22d472b 100644
@@ -442,19 +442,20 @@ static int kvm_cpu_notify(struct notifier_block *self, unsigned long action,
 			  void *hcpu)
 {
 	int cpu = (unsigned long)hcpu;
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_DOWN_FAILED:
-	case CPU_ONLINE_FROZEN:
 		smp_call_function_single(cpu, kvm_guest_cpu_online, NULL, 0);
 		break;
 	case CPU_DOWN_PREPARE:
-	case CPU_DOWN_PREPARE_FROZEN:
 		smp_call_function_single(cpu, kvm_guest_cpu_offline, NULL, 1);
 		break;
 	default:
 		break;
 	}
+
+	if (action == CPU_DOWN_FAILED)
+		smp_call_function_single(cpu, kvm_guest_cpu_online, NULL, 0);
+
 	return NOTIFY_OK;
 }
 
Signature · 1 line
2.0.0.rc2
maintainer
#15 lore raw

Re: [RFC PATCH v1 10/70] x86, kvm: _FROZEN Cleanup

Quoted 12 lines · Gong

Remove XXX_FROZEN state from kvm.

---
 arch/x86/kernel/kvm.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
arch/x86/kernel/kvm.c +0 -0
index 3dd8e2c..22d472b 100644

arch/x86/kernel/kvm.c static int kvm_cpu_notify(struct notifier_block *self, unsigned long action, · line 447

Quoted 7 lines
arch/x86/kernel/kvm.c +1 -2
@@ -442,19 +442,20 @@ static int kvm_cpu_notify(struct notifier_block *self, unsigned long action,
 			  void *hcpu)
 {
 	int cpu = (unsigned long)hcpu;
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_DOWN_FAILED:

This looks strange. Why even touch CPU_DOWN_FAILED ...

arch/x86/kernel/kvm.c static int kvm_cpu_notify(struct notifier_block *self, unsigned long action, · line 457

Quoted 13 lines
arch/x86/kernel/kvm.c +3 -2
-	case CPU_ONLINE_FROZEN:
 		smp_call_function_single(cpu, kvm_guest_cpu_online, NULL, 0);
 		break;
 	case CPU_DOWN_PREPARE:
-	case CPU_DOWN_PREPARE_FROZEN:
 		smp_call_function_single(cpu, kvm_guest_cpu_offline, NULL, 1);
 		break;
 	default:
 		break;
 	}
+
+	if (action == CPU_DOWN_FAILED)
+		smp_call_function_single(cpu, kvm_guest_cpu_online, NULL, 0);

to move it here?

Just remove the _FROZEN stuff and don't touch anything else.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
maintainer Acked-by
#16 lore raw

Re: [RFC PATCH v1 10/70] x86, kvm: _FROZEN Cleanup

Quoted 1 line · Borislav Petkov

Just remove the _FROZEN stuff and don't touch anything else.

Bah, nevermind, patch is correct.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author
#17 lore raw

RFC PATCH 11/70 x86, vsyscall_64: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from x86/vsyscall_64.

---
 arch/x86/kernel/vsyscall_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/vsyscall_64.c +1 -1
index ea5b570..72a1576 100644
@@ -320,7 +320,7 @@ cpu_vsyscall_notifier(struct notifier_block *n, unsigned long action, void *arg)
 {
 	long cpu = (long)arg;
 
-	if (action == CPU_ONLINE || action == CPU_ONLINE_FROZEN)
+	if ((action & ~CPU_TASKS_FROZEN) == CPU_ONLINE)
 		smp_call_function_single(cpu, cpu_vsyscall_init, NULL, 1);
 
 	return NOTIFY_DONE;
Signature · 1 line
2.0.0.rc2
author
#19 lore raw

RFC PATCH 12/70 x86, pci, amd_bus: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from x86/pci/amd_bus.

---
 arch/x86/pci/amd_bus.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/pci/amd_bus.c +1 -2
index c20d2cc..30f0fca9 100644
@@ -341,9 +341,8 @@ static int amd_cpu_notify(struct notifier_block *self, unsigned long action,
 			  void *hcpu)
 {
 	int cpu = (long)hcpu;
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		smp_call_function_single(cpu, enable_pci_io_ecs, NULL, 0);
 		break;
 	default:
Signature · 1 line
2.0.0.rc2
maintainer
#20 lore raw

Re: [RFC PATCH v1 12/70] x86, pci, amd_bus: _FROZEN Cleanup

Quoted 12 lines · Gong

Remove XXX_FROZEN state from x86/pci/amd_bus.

---
 arch/x86/pci/amd_bus.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/pci/amd_bus.c +0 -0
index c20d2cc..30f0fca9 100644

arch/x86/pci/amd_bus.c static int amd_cpu_notify(struct notifier_block *self, unsigned long action, · line 348

Quoted 10 lines
arch/x86/pci/amd_bus.c +1 -2
@@ -341,9 +341,8 @@ static int amd_cpu_notify(struct notifier_block *self, unsigned long action,
 			  void *hcpu)
 {
 	int cpu = (long)hcpu;
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		smp_call_function_single(cpu, enable_pci_io_ecs, NULL, 0);
 		break;
 	default:

Or you can kill all the switch-case gunk and make it even more readable:

arch/x86/pci/amd_bus.c +3 -9
Index: b/arch/x86/pci/amd_bus.c
===================================================================
@@ -340,15 +340,9 @@ static void enable_pci_io_ecs(void *unus
 static int amd_cpu_notify(struct notifier_block *self, unsigned long action,
 			  void *hcpu)
 {
-	int cpu = (long)hcpu;
-	switch (action) {
-	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
-		smp_call_function_single(cpu, enable_pci_io_ecs, NULL, 0);
-		break;
-	default:
-		break;
-	}
+	if ((action & ~CPU_TASKS_FROZEN) == CPU_ONLINE)
+		smp_call_function_single((long)hcpu, enable_pci_io_ecs, NULL, 0);
+
 	return NOTIFY_OK;
 }
 
Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author
#21 lore raw

Re: [RFC PATCH v1 12/70] x86, pci, amd_bus: _FROZEN Cleanup

Quoted 32 lines · Borislav Petkov

Date: Wed, 23 Jul 2014 20:07:18 +0200
From: Borislav Petkov <[email protected]>
To: "Chen, Gong" <[email protected]>
Cc: [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [RFC PATCH v1 12/70] x86, pci, amd_bus: _FROZEN Cleanup
User-Agent: Mutt/1.5.23 (2014-03-12)

Quoted 16 lines · Gong

Remove XXX_FROZEN state from x86/pci/amd_bus.

---
 arch/x86/pci/amd_bus.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/pci/amd_bus.c +0 -1
index c20d2cc..30f0fca9 100644
@@ -341,9 +341,8 @@ static int amd_cpu_notify(struct notifier_block *self, unsigned long action,
 			  void *hcpu)
 {
 	int cpu = (long)hcpu;
-	switch (action) {
Quoted 9 lines

arch/x86/pci/amd_bus.c static int amd_cpu_notify(struct notifier_block *self, unsigned long action, · line 348

Quoted 6 lines
arch/x86/pci/amd_bus.c +1 -1
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		smp_call_function_single(cpu, enable_pci_io_ecs, NULL, 0);
 		break;
 	default:

Or you can kill all the switch-case gunk and make it even more readable:

But what if new action is added? We have to change it back. If you prefer to use that style I can update in next version.

maintainer
#22 lore raw

Re: [RFC PATCH v1 12/70] x86, pci, amd_bus: _FROZEN Cleanup

Quoted 2 lines · Gong

But what if new action is added? We have to change it back. If you prefer to use that style I can update in next version.

Not likely. This functionality in amd_bus.c is not going to expand anyway but rather die with its last user, AFAICR.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author
#23 lore raw

Re: [RFC PATCH v1 12/70] x86, pci, amd_bus: _FROZEN Cleanup

Quoted 7 lines · Borislav Petkov
Quoted 2 lines · Gong

But what if new action is added? We have to change it back. If you prefer to use that style I can update in next version.

Not likely. This functionality in amd_bus.c is not going to expand anyway but rather die with its last user, AFAICR.

--------8<--------

Subject: [RFC PATCH v2 12/70] x86, pci, amd_bus: _FROZEN Cleanup

Remove XXX_FROZEN state from x86/pci/amd_bus.

---
 arch/x86/pci/amd_bus.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
arch/x86/pci/amd_bus.c +4 -9
index c20d2cc..2d7c6c6 100644
@@ -340,15 +340,10 @@ static void enable_pci_io_ecs(void *unused)
 static int amd_cpu_notify(struct notifier_block *self, unsigned long action,
 			  void *hcpu)
 {
-	int cpu = (long)hcpu;
-	switch (action) {
-	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
-		smp_call_function_single(cpu, enable_pci_io_ecs, NULL, 0);
-		break;
-	default:
-		break;
-	}
+	if ((action & ~CPU_TASKS_FROZEN) == CPU_ONLINE)
+		smp_call_function_single((long)hcpu, enable_pci_io_ecs,
+					 NULL, 0);
+
 	return NOTIFY_OK;
 }
 
Signature · 1 line
2.0.0.rc2
author
#24 lore raw

RFC PATCH 13/70 x86, x2apic_cluster: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from x86/x2apic_cluster.

---
 arch/x86/kernel/apic/x2apic_cluster.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
arch/x86/kernel/apic/x2apic_cluster.c +8 -3
index e66766b..bfd2369 100644
@@ -154,8 +154,11 @@ update_clusterinfo(struct notifier_block *nfb, unsigned long action, void *hcpu)
 	unsigned int cpu;
 	int err = 0;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
+		if (action & CPU_TASKS_FROZEN)
+			break;
+
 		if (!zalloc_cpumask_var(&per_cpu(cpus_in_cluster, this_cpu),
 					GFP_KERNEL)) {
 			err = -ENOMEM;
@@ -165,9 +168,11 @@ update_clusterinfo(struct notifier_block *nfb, unsigned long action, void *hcpu)
 			err = -ENOMEM;
 		}
 		break;
-	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 	case CPU_DEAD:
+		/* fall though to next if action == CPU_DEAD */
+		if (action & CPU_TASKS_FROZEN)
+			break;
+	case CPU_UP_CANCELED:
 		for_each_online_cpu(cpu) {
 			if (x2apic_cluster(this_cpu) != x2apic_cluster(cpu))
 				continue;
Signature · 1 line
2.0.0.rc2
maintainer
#25 lore raw

Re: [RFC PATCH v1 13/70] x86, x2apic_cluster: _FROZEN Cleanup

Quoted 28 lines · Gong

Remove XXX_FROZEN state from x86/x2apic_cluster.

---
 arch/x86/kernel/apic/x2apic_cluster.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
arch/x86/kernel/apic/x2apic_cluster.c +4 -1
index e66766b..bfd2369 100644
@@ -154,8 +154,11 @@ update_clusterinfo(struct notifier_block *nfb, unsigned long action, void *hcpu)
 	unsigned int cpu;
 	int err = 0;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
+		if (action & CPU_TASKS_FROZEN)
+			break;
+
 		if (!zalloc_cpumask_var(&per_cpu(cpus_in_cluster, this_cpu),
 					GFP_KERNEL)) {
 			err = -ENOMEM;
@@ -165,9 +168,11 @@ update_clusterinfo(struct notifier_block *nfb, unsigned long action, void *hcpu)
 			err = -ENOMEM;
 		}
 		break;

arch/x86/kernel/apic/x2apic_cluster.c update_clusterinfo(struct notifier_block *nfb, unsigned long action, void *hcpu) · line 178

Quoted 10 lines
arch/x86/kernel/apic/x2apic_cluster.c +4 -2
-	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 	case CPU_DEAD:
+		/* fall though to next if action == CPU_DEAD */
+		if (action & CPU_TASKS_FROZEN)
+			break;
+	case CPU_UP_CANCELED:
 		for_each_online_cpu(cpu) {
 			if (x2apic_cluster(this_cpu) != x2apic_cluster(cpu))
 				continue;

Those checks dealing with CPU_TASKS_FROZEN in-between make the whole switch statement hard to follow.

How about we go a step further and deal with CPU_UP_CANCELED_FROZEN upfront and even simplify the rest:

---

arch/x86/kernel/apic/x2apic_cluster.c +24 -10
Index: b/arch/x86/kernel/apic/x2apic_cluster.c
===================================================================
@@ -144,6 +144,21 @@ static void init_x2apic_ldr(void)
 	}
 }
 
+static void __update_clusterinfo(unsigned int this_cpu)
+{
+	unsigned int cpu;
+
+	for_each_online_cpu(cpu) {
+		if (x2apic_cluster(this_cpu) != x2apic_cluster(cpu))
+			continue;
+		__cpu_clear(this_cpu, per_cpu(cpus_in_cluster, cpu));
+		__cpu_clear(cpu, per_cpu(cpus_in_cluster, this_cpu));
+	}
+
+	free_cpumask_var(per_cpu(cpus_in_cluster, this_cpu));
+	free_cpumask_var(per_cpu(ipi_mask, this_cpu));
+}
+
  /*
   * At CPU state changes, update the x2apic cluster sibling info.
   */
@@ -151,9 +166,14 @@ static int
 update_clusterinfo(struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
 	unsigned int this_cpu = (unsigned long)hcpu;
-	unsigned int cpu;
 	int err = 0;
 
+	if (action & CPU_TASKS_FROZEN) {
+		if ((action & ~CPU_TASKS_FROZEN) == CPU_UP_CANCELED)
+			__update_clusterinfo(this_cpu);
+		return NOTIFY_OK;
+	}
+
 	switch (action) {
 	case CPU_UP_PREPARE:
 		if (!zalloc_cpumask_var(&per_cpu(cpus_in_cluster, this_cpu),
@@ -166,16 +186,10 @@ update_clusterinfo(struct notifier_block
 		}
 		break;
 	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 	case CPU_DEAD:
-		for_each_online_cpu(cpu) {
-			if (x2apic_cluster(this_cpu) != x2apic_cluster(cpu))
-				continue;
-			__cpu_clear(this_cpu, per_cpu(cpus_in_cluster, cpu));
-			__cpu_clear(cpu, per_cpu(cpus_in_cluster, this_cpu));
-		}
-		free_cpumask_var(per_cpu(cpus_in_cluster, this_cpu));
-		free_cpumask_var(per_cpu(ipi_mask, this_cpu));
+		__update_clusterinfo(this_cpu);
+		break;
+	default:
 		break;
 	}
 
Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author
#26 lore raw

Re: [RFC PATCH v1 13/70] x86, x2apic_cluster: _FROZEN Cleanup

Quoted 6 lines · Borislav Petkov

Those checks dealing with CPU_TASKS_FROZEN in-between make the whole switch statement hard to follow.

How about we go a step further and deal with CPU_UP_CANCELED_FROZEN upfront and even simplify the rest:

--------8<--------
Subject: [RFC PATCH v2 13/70] x86, x2apic_cluster: _FROZEN Cleanup

Remove XXX_FROZEN state from x86/x2apic_cluster.

---
 arch/x86/kernel/apic/x2apic_cluster.c | 37 +++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 13 deletions(-)
arch/x86/kernel/apic/x2apic_cluster.c +24 -13
index e66766b..b8a6ea8 100644
@@ -144,6 +144,20 @@ static void init_x2apic_ldr(void)
 	}
 }
 
+static void __update_clusterinfo(unsigned int this_cpu)
+{
+	unsigned int cpu;
+
+	for_each_online_cpu(cpu) {
+		if (x2apic_cluster(this_cpu) != x2apic_cluster(cpu))
+			continue;
+		__cpu_clear(this_cpu, per_cpu(cpus_in_cluster, cpu));
+		__cpu_clear(cpu, per_cpu(cpus_in_cluster, this_cpu));
+	}
+	free_cpumask_var(per_cpu(cpus_in_cluster, this_cpu));
+	free_cpumask_var(per_cpu(ipi_mask, this_cpu));
+}
+
  /*
   * At CPU state changes, update the x2apic cluster sibling info.
   */
@@ -151,34 +165,31 @@ static int
 update_clusterinfo(struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
 	unsigned int this_cpu = (unsigned long)hcpu;
-	unsigned int cpu;
 	int err = 0;
 
 	switch (action) {
 	case CPU_UP_PREPARE:
 		if (!zalloc_cpumask_var(&per_cpu(cpus_in_cluster, this_cpu),
-					GFP_KERNEL)) {
+					GFP_KERNEL))
 			err = -ENOMEM;
-		} else if (!zalloc_cpumask_var(&per_cpu(ipi_mask, this_cpu),
-					       GFP_KERNEL)) {
+		else if (!zalloc_cpumask_var(&per_cpu(ipi_mask, this_cpu),
+					     GFP_KERNEL)) {
 			free_cpumask_var(per_cpu(cpus_in_cluster, this_cpu));
 			err = -ENOMEM;
 		}
 		break;
 	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 	case CPU_DEAD:
-		for_each_online_cpu(cpu) {
-			if (x2apic_cluster(this_cpu) != x2apic_cluster(cpu))
-				continue;
-			__cpu_clear(this_cpu, per_cpu(cpus_in_cluster, cpu));
-			__cpu_clear(cpu, per_cpu(cpus_in_cluster, this_cpu));
-		}
-		free_cpumask_var(per_cpu(cpus_in_cluster, this_cpu));
-		free_cpumask_var(per_cpu(ipi_mask, this_cpu));
+		__update_clusterinfo(this_cpu);
+		break;
+	default:
 		break;
 	}
 
+	if (test_and_clear_bit(CPU_TASKS_FROZEN, &action) &&
+	    (action == CPU_UP_CANCELED))
+		__update_clusterinfo(this_cpu);
+
 	return notifier_from_errno(err);
 }
 
Signature · 1 line
2.0.0.rc2
maintainer
#27 lore raw

Re: [RFC PATCH v1 13/70] x86, x2apic_cluster: _FROZEN Cleanup

Quoted 53 lines · Gong
Quoted 6 lines · Borislav Petkov

Those checks dealing with CPU_TASKS_FROZEN in-between make the whole switch statement hard to follow.

How about we go a step further and deal with CPU_UP_CANCELED_FROZEN upfront and even simplify the rest:

--------8<--------
Subject: [RFC PATCH v2 13/70] x86, x2apic_cluster: _FROZEN Cleanup

Remove XXX_FROZEN state from x86/x2apic_cluster.

---
 arch/x86/kernel/apic/x2apic_cluster.c | 37 +++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 13 deletions(-)
arch/x86/kernel/apic/x2apic_cluster.c +14 -1
index e66766b..b8a6ea8 100644
@@ -144,6 +144,20 @@ static void init_x2apic_ldr(void)
 	}
 }
 
+static void __update_clusterinfo(unsigned int this_cpu)
+{
+	unsigned int cpu;
+
+	for_each_online_cpu(cpu) {
+		if (x2apic_cluster(this_cpu) != x2apic_cluster(cpu))
+			continue;
+		__cpu_clear(this_cpu, per_cpu(cpus_in_cluster, cpu));
+		__cpu_clear(cpu, per_cpu(cpus_in_cluster, this_cpu));
+	}
+	free_cpumask_var(per_cpu(cpus_in_cluster, this_cpu));
+	free_cpumask_var(per_cpu(ipi_mask, this_cpu));
+}
+
  /*
   * At CPU state changes, update the x2apic cluster sibling info.
   */
@@ -151,34 +165,31 @@ static int
 update_clusterinfo(struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
 	unsigned int this_cpu = (unsigned long)hcpu;
-	unsigned int cpu;
 	int err = 0;
 
 	switch (action) {
 	case CPU_UP_PREPARE:

arch/x86/kernel/apic/x2apic_cluster.c static int · line 178

Quoted 10 lines
arch/x86/kernel/apic/x2apic_cluster.c +3 -3
 		if (!zalloc_cpumask_var(&per_cpu(cpus_in_cluster, this_cpu),
-					GFP_KERNEL)) {
+					GFP_KERNEL))
 			err = -ENOMEM;
-		} else if (!zalloc_cpumask_var(&per_cpu(ipi_mask, this_cpu),
-					       GFP_KERNEL)) {
+		else if (!zalloc_cpumask_var(&per_cpu(ipi_mask, this_cpu),
+					     GFP_KERNEL)) {
 			free_cpumask_var(per_cpu(cpus_in_cluster, this_cpu));
 			err = -ENOMEM;

You need to start restraining yourself and doing clean patches. Those changes here are unrelated, please drop them.

Go and reread Documentation/SubmittingPatches, section 3 in particular.

Quoted 10 lines
arch/x86/kernel/apic/x2apic_cluster.c +0 -6
 		}
 		break;
 	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 	case CPU_DEAD:
-		for_each_online_cpu(cpu) {
-			if (x2apic_cluster(this_cpu) != x2apic_cluster(cpu))
-				continue;
-			__cpu_clear(this_cpu, per_cpu(cpus_in_cluster, cpu));
-			__cpu_clear(cpu, per_cpu(cpus_in_cluster, this_cpu));

arch/x86/kernel/apic/x2apic_cluster.c static int · line 189

Quoted 10 lines
arch/x86/kernel/apic/x2apic_cluster.c +4 -3
-		}
-		free_cpumask_var(per_cpu(cpus_in_cluster, this_cpu));
-		free_cpumask_var(per_cpu(ipi_mask, this_cpu));
+		__update_clusterinfo(this_cpu);
+		break;
+	default:
 		break;
 	}
 
+	if (test_and_clear_bit(CPU_TASKS_FROZEN, &action) &&

What.. why?

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author
#28 lore raw

Re: [RFC PATCH v1 13/70] x86, x2apic_cluster: _FROZEN Cleanup

Quoted 16 lines · Borislav Petkov

arch/x86/kernel/apic/x2apic_cluster.c static int · line 178

Quoted 12 lines
arch/x86/kernel/apic/x2apic_cluster.c +3 -3
 	switch (action) {
 	case CPU_UP_PREPARE:
 		if (!zalloc_cpumask_var(&per_cpu(cpus_in_cluster, this_cpu),
-					GFP_KERNEL)) {
+					GFP_KERNEL))
 			err = -ENOMEM;
-		} else if (!zalloc_cpumask_var(&per_cpu(ipi_mask, this_cpu),
-					       GFP_KERNEL)) {
+		else if (!zalloc_cpumask_var(&per_cpu(ipi_mask, this_cpu),
+					     GFP_KERNEL)) {
 			free_cpumask_var(per_cpu(cpus_in_cluster, this_cpu));
 			err = -ENOMEM;

You need to start restraining yourself and doing clean patches. Those changes here are unrelated, please drop them.

Quoted 2 lines

Go and reread Documentation/SubmittingPatches, section 3 in particular.

Copy that.

Quoted 4 lines

arch/x86/kernel/apic/x2apic_cluster.c static int · line 189

Quoted 1 line
arch/x86/kernel/apic/x2apic_cluster.c +1 -0
+	if (test_and_clear_bit(CPU_TASKS_FROZEN, &action) &&

What.. why?

Sorry for that.

author
#29 lore raw

Re: [RFC PATCH v1 13/70] x86, x2apic_cluster: _FROZEN Cleanup

In reply to Borislav Petkov
Quoted 6 lines · Borislav Petkov

/*
* At CPU state changes, update the x2apic cluster sibling info. */

arch/x86/kernel/apic/x2apic_cluster.c +0 -0
@@ -151,9 +166,14 @@ static int
 update_clusterinfo(struct notifier_block *nfb, unsigned long action, void *hcpu)
 {

arch/x86/kernel/apic/x2apic_cluster.c static int · line 176

Quoted 10 lines
arch/x86/kernel/apic/x2apic_cluster.c +6 -1
 	unsigned int this_cpu = (unsigned long)hcpu;
-	unsigned int cpu;
 	int err = 0;
 
+	if (action & CPU_TASKS_FROZEN) {
+		if ((action & ~CPU_TASKS_FROZEN) == CPU_UP_CANCELED)
+			__update_clusterinfo(this_cpu);
+		return NOTIFY_OK;
+	}
+

Hi, Boris

Here you assume once the action contains FROZEN flag, it will return NOTIFY_OK. It looks like not quite comply with original logic. Once new FROZEN logic is added, we have to update this code again. How about using following code snippet:

+ if ((action & CPU_TASKS_FROZEN) &&
+ ((action & ~CPU_TASKS_FROZEN) == CPU_UP_CANCELED)) {
+ __update_clusterinfo(this_cpu);
+ return NOTIFY_OK;
+ }
+

maintainer
#30 lore raw

Re: [RFC PATCH v1 13/70] x86, x2apic_cluster: _FROZEN Cleanup

Quoted 19 lines · Gong
Quoted 6 lines · Borislav Petkov

/*
* At CPU state changes, update the x2apic cluster sibling info. */

arch/x86/kernel/apic/x2apic_cluster.c +0 -0
@@ -151,9 +166,14 @@ static int
 update_clusterinfo(struct notifier_block *nfb, unsigned long action, void *hcpu)
 {

arch/x86/kernel/apic/x2apic_cluster.c static int · line 176

Quoted 10 lines
arch/x86/kernel/apic/x2apic_cluster.c +6 -1
 	unsigned int this_cpu = (unsigned long)hcpu;
-	unsigned int cpu;
 	int err = 0;
 
+	if (action & CPU_TASKS_FROZEN) {
+		if ((action & ~CPU_TASKS_FROZEN) == CPU_UP_CANCELED)
+			__update_clusterinfo(this_cpu);
+		return NOTIFY_OK;
+	}
+

Hi, Boris

Quoted 2 lines

Here you assume once the action contains FROZEN flag, it will return NOTIFY_OK.

Well, look at the original code. What do you think happens if another _FROZEN action comes in which we don't handle in the switch-case?

Take a piece of paper and play it through slowly if you don't see it.
Hint: err = 0.

arch/x86/kernel/apic/x2apic_cluster.c static int · line 174

Quoted 8 lines

It looks like not quite comply with original logic. Once new FROZEN logic is added, we have to update this code again. How about using following code snippet:

arch/x86/kernel/apic/x2apic_cluster.c +4 -0
+       if ((action & CPU_TASKS_FROZEN) &&
+           ((action & ~CPU_TASKS_FROZEN) == CPU_UP_CANCELED)) {
+               __update_clusterinfo(this_cpu);
+               return NOTIFY_OK;

No, this is different now from the original logic.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author
#31 lore raw

Re: [RFC PATCH v1 13/70] x86, x2apic_cluster: _FROZEN Cleanup

Quoted 24 lines · Borislav Petkov

Date: Wed, 30 Jul 2014 10:48:52 +0200
From: Borislav Petkov <[email protected]>
To: "Chen, Gong" <[email protected]>
Cc: [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [RFC PATCH v1 13/70] x86, x2apic_cluster: _FROZEN Cleanup
User-Agent: Mutt/1.5.23 (2014-03-12)
Well, look at the original code. What do you think happens if another _FROZEN action comes in which we don't handle in the switch-case?

Take a piece of paper and play it through slowly if you don't see it.
Hint: err = 0.

Quoted 4 lines

It looks like not quite comply with original logic. Once new FROZEN logic is added, we have to update this code again. How about using following code snippet:

Quoted 7 lines

arch/x86/kernel/apic/x2apic_cluster.c static int · line 174

Quoted 4 lines
arch/x86/kernel/apic/x2apic_cluster.c +4 -0
+       if ((action & CPU_TASKS_FROZEN) &&
+           ((action & ~CPU_TASKS_FROZEN) == CPU_UP_CANCELED)) {
+               __update_clusterinfo(this_cpu);
+               return NOTIFY_OK;

No, this is different now from the original logic.

I'm silly. You are right. I will use your patch directly(I should do it at the beginning :-)).

maintainer
#32 lore raw

Re: [RFC PATCH v1 13/70] x86, x2apic_cluster: _FROZEN Cleanup

Quoted 2 lines · Gong

I'm silly. You are right. I will use your patch directly(I should do it at the beginning :-)).

I think it is still ok that we talked about this, it can easily be gotten wrong.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author
#33 lore raw

RFC PATCH 14/70 x86, microcode, core: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from x86/microcode/core.

---
 arch/x86/kernel/cpu/microcode/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/microcode/core.c +4 -4
index dd9d619..27e47be 100644
@@ -499,6 +499,10 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
 		pr_debug("CPU%d removed\n", cpu);
 		break;
 
+	case CPU_UP_CANCELED:
+		/* The CPU refused to come up during a system resume */
+		if (action & CPU_TASKS_FROZEN)
+			microcode_fini_cpu(cpu);
 	/*
 	 * case CPU_DEAD:
 	 *
@@ -509,10 +513,6 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
 	 */
 	}
 
-	/* The CPU refused to come up during a system resume */
-	if (action == CPU_UP_CANCELED_FROZEN)
-		microcode_fini_cpu(cpu);
-
 	return NOTIFY_OK;
 }
 
Signature · 1 line
2.0.0.rc2
maintainer
#34 lore raw

Re: [RFC PATCH v1 14/70] x86, microcode, core: _FROZEN Cleanup

Quoted 12 lines · Gong

Remove XXX_FROZEN state from x86/microcode/core.

---
 arch/x86/kernel/cpu/microcode/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/microcode/core.c +0 -0
index dd9d619..27e47be 100644

arch/x86/kernel/cpu/microcode/core.c mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu) · line 505

Quoted 7 lines
arch/x86/kernel/cpu/microcode/core.c +4 -0
@@ -499,6 +499,10 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
 		pr_debug("CPU%d removed\n", cpu);
 		break;
 
+	case CPU_UP_CANCELED:
+		/* The CPU refused to come up during a system resume */
+		if (action & CPU_TASKS_FROZEN)
+			microcode_fini_cpu(cpu);

Missing "break". We like to add those even if it doesn't matter in this case.

Also, add the boilerplate

"default:

	break;"

while you're at it, please.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author
#35 lore raw

Re: [RFC PATCH v1 14/70] x86, microcode, core: _FROZEN Cleanup

Quoted 11 lines · Borislav Petkov

Missing "break". We like to add those even if it doesn't matter in this case.

Also, add the boilerplate

"default:

	break;"

while you're at it, please.

--------8<--------
Subject: [RFC PATCH v2 14/70] x86, microcode, core: _FROZEN Cleanup

Remove XXX_FROZEN state from x86/microcode/core.

---
 arch/x86/kernel/cpu/microcode/core.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/microcode/core.c +7 -4
index dd9d619..da3c2206 100644
@@ -499,6 +499,11 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
 		pr_debug("CPU%d removed\n", cpu);
 		break;
 
+	case CPU_UP_CANCELED:
+		/* The CPU refused to come up during a system resume */
+		if (action & CPU_TASKS_FROZEN)
+			microcode_fini_cpu(cpu);
+		break;
 	/*
 	 * case CPU_DEAD:
 	 *
@@ -507,12 +512,10 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
 	 * CPU comes back online without unnecessarily requesting the userspace
 	 * for it again.
 	 */
+	default:
+		break;
 	}
 
-	/* The CPU refused to come up during a system resume */
-	if (action == CPU_UP_CANCELED_FROZEN)
-		microcode_fini_cpu(cpu);
-
 	return NOTIFY_OK;
 }
 
Signature · 1 line
2.0.0.rc2
author
#36 lore raw

RFC PATCH 15/70 x86, kernel, cpuid: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from x86/kernel/cpuid.

---
 arch/x86/kernel/cpuid.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/x86/kernel/cpuid.c +4 -2
index 3225ae6c..0288e4f 100644
@@ -161,12 +161,14 @@ static int cpuid_class_cpu_callback(struct notifier_block *nfb,
 	case CPU_UP_PREPARE:
 		err = cpuid_device_create(cpu);
 		break;
-	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 	case CPU_DEAD:
 		cpuid_device_destroy(cpu);
 		break;
 	}
+
+	if ((action & ~CPU_TASKS_FROZEN) == CPU_UP_CANCELED)
+		cpuid_device_destroy(cpu);
+
 	return notifier_from_errno(err);
 }
 
Signature · 1 line
2.0.0.rc2
author
#38 lore raw

RFC PATCH 16/70 x86, kernel, msr: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from x86/kernel/msr.

---
 arch/x86/kernel/msr.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/x86/kernel/msr.c +4 -2
index c9603ac..e388659 100644
@@ -224,12 +224,14 @@ static int msr_class_cpu_callback(struct notifier_block *nfb,
 	case CPU_UP_PREPARE:
 		err = msr_device_create(cpu);
 		break;
-	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 	case CPU_DEAD:
 		msr_device_destroy(cpu);
 		break;
 	}
+
+	if ((action & ~CPU_TASKS_FROZEN) == CPU_UP_CANCELED)
+		msr_device_destroy(cpu);
+
 	return notifier_from_errno(err);
 }
 
Signature · 1 line
2.0.0.rc2
author
#40 lore raw

RFC PATCH 17/70 arm, vfp, vfpmodule: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from arm/vfp/vfpmodule.

---
 arch/arm/vfp/vfpmodule.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/vfp/vfpmodule.c +4 -2
index 2f37e1d..a1a6154 100644
@@ -642,9 +642,11 @@ int vfp_restore_user_hwstate(struct user_vfp __user *ufp,
 static int vfp_hotplug(struct notifier_block *b, unsigned long action,
 	void *hcpu)
 {
-	if (action == CPU_DYING || action == CPU_DYING_FROZEN)
+	action &= ~CPU_TASKS_FROZEN;
+
+	if (action == CPU_DYING)
 		vfp_current_hw_state[(long)hcpu] = NULL;
-	else if (action == CPU_STARTING || action == CPU_STARTING_FROZEN)
+	else if (action == CPU_STARTING)
 		vfp_enable(NULL);
 	return NOTIFY_OK;
 }
Signature · 1 line
2.0.0.rc2
author
#41 lore raw

RFC PATCH 18/70 arm, kvm: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from arm/kvm.

---
 arch/arm/kvm/arm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/kvm/arm.c +1 -2
index 3c82b37..0014464 100644
@@ -860,9 +860,8 @@ static void cpu_init_hyp_mode(void *dummy)
 static int hyp_init_cpu_notify(struct notifier_block *self,
 			       unsigned long action, void *cpu)
 {
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_STARTING:
-	case CPU_STARTING_FROZEN:
 		cpu_init_hyp_mode(NULL);
 		break;
 	}
Signature · 1 line
2.0.0.rc2
author
#42 lore raw

RFC PATCH 19/70 powerpc, sysfs: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from powerpc/sysfs.

---
 arch/powerpc/kernel/sysfs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/powerpc/kernel/sysfs.c +1 -3
index 67fd2fd..8a3739c 100644
@@ -852,14 +852,12 @@ static int sysfs_cpu_notify(struct notifier_block *self,
 {
 	unsigned int cpu = (unsigned int)(long)hcpu;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		register_cpu_online(cpu);
 		break;
 #ifdef CONFIG_HOTPLUG_CPU
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		unregister_cpu_online(cpu);
 		break;
 #endif
Signature · 1 line
2.0.0.rc2
author
#43 lore raw

RFC PATCH 20/70 powerpc, mm, numa: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from powerpc/mm/numa.

---
 arch/powerpc/mm/numa.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/powerpc/mm/numa.c +1 -4
index 3b181b2..080ef52 100644
@@ -598,18 +598,15 @@ static int cpu_numa_callback(struct notifier_block *nfb, unsigned long action,
 	unsigned long lcpu = (unsigned long)hcpu;
 	int ret = NOTIFY_DONE, nid;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		nid = numa_setup_cpu(lcpu);
 		verify_cpu_node_mapping((int)lcpu, nid);
 		ret = NOTIFY_OK;
 		break;
 #ifdef CONFIG_HOTPLUG_CPU
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 		unmap_cpu_from_node(lcpu);
 		break;
 		ret = NOTIFY_OK;
Signature · 1 line
2.0.0.rc2
author
#44 lore raw

RFC PATCH 21/70 powerpc, powermac, smp: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from powermac/smp.

---
 arch/powerpc/platforms/powermac/smp.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
arch/powerpc/platforms/powermac/smp.c +6 -5
index 5cbd4d6..980605f 100644
@@ -861,9 +861,8 @@ static int smp_core99_cpu_notify(struct notifier_block *self,
 {
 	int rc;
 
-	switch(action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		/* Open i2c bus if it was used for tb sync */
 		if (pmac_tb_clock_chip_host) {
 			rc = pmac_i2c_open(pmac_tb_clock_chip_host, 1);
@@ -875,9 +874,11 @@ static int smp_core99_cpu_notify(struct notifier_block *self,
 		break;
 	case CPU_ONLINE:
 	case CPU_UP_CANCELED:
-		/* Close i2c bus if it was used for tb sync */
-		if (pmac_tb_clock_chip_host)
-			pmac_i2c_close(pmac_tb_clock_chip_host);
+		if (!(action & CPU_TASKS_FROZEN)) {
+			/* Close i2c bus if it was used for tb sync */
+			if (pmac_tb_clock_chip_host)
+				pmac_i2c_close(pmac_tb_clock_chip_host);
+		}
 		break;
 	default:
 		break;
Signature · 1 line
2.0.0.rc2
author
#45 lore raw

RFC PATCH 22/70 powerpc, mmu_context_nohash: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from powerpc/mmu_context_nohash.

---
 arch/powerpc/mm/mmu_context_nohash.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/powerpc/mm/mmu_context_nohash.c +1 -4
index 928ebe7..4ada715 100644
@@ -343,17 +343,14 @@ static int mmu_context_cpu_notify(struct notifier_block *self,
 	if (cpu == boot_cpuid)
 		return NOTIFY_OK;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		pr_devel("MMU: Allocating stale context map for CPU %d\n", cpu);
 		stale_map[cpu] = kzalloc(CTX_MAP_SIZE, GFP_KERNEL);
 		break;
 #ifdef CONFIG_HOTPLUG_CPU
 	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		pr_devel("MMU: Freeing stale context map for CPU %d\n", cpu);
 		kfree(stale_map[cpu]);
 		stale_map[cpu] = NULL;
Signature · 1 line
2.0.0.rc2
author
#46 lore raw

RFC PATCH 23/70 mips, loongson, smp: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from loongson/smp.

---
 arch/mips/loongson/loongson-3/smp.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/mips/loongson/loongson-3/smp.c +1 -4
index 1e88940..30b91e8 100644
@@ -389,20 +389,17 @@ void play_dead(void)
 	play_dead_at_ckseg1(state_addr);
 }
 
-#define CPU_POST_DEAD_FROZEN	(CPU_POST_DEAD | CPU_TASKS_FROZEN)
 static int loongson3_cpu_callback(struct notifier_block *nfb,
 	unsigned long action, void *hcpu)
 {
 	unsigned int cpu = (unsigned long)hcpu;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_POST_DEAD:
-	case CPU_POST_DEAD_FROZEN:
 		pr_info("Disable clock for CPU#%d\n", cpu);
 		LOONGSON_CHIPCFG0 &= ~(1 << (12 + cpu));
 		break;
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		pr_info("Enable clock for CPU#%d\n", cpu);
 		LOONGSON_CHIPCFG0 |= 1 << (12 + cpu);
 		break;
Signature · 1 line
2.0.0.rc2
author
#47 lore raw

RFC PATCH 24/70 s390, perf_cpum_sf: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from s390/perf_cpum_sf.

---
 arch/s390/kernel/perf_cpum_sf.c | 1 -
 1 file changed, 1 deletion(-)
arch/s390/kernel/perf_cpum_sf.c +0 -1
index ea0c7b2..1cbd3c7 100644
@@ -1526,7 +1526,6 @@ static int cpumf_pmu_notifier(struct notifier_block *self,
 
 	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		flags = PMC_INIT;
 		smp_call_function_single(cpu, setup_pmc_cpu, &flags, 1);
 		break;
Signature · 1 line
2.0.0.rc2
author
#48 lore raw

RFC PATCH 25/70 sparc, sysfs: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from sparc/sysfs.

---
 arch/sparc/kernel/sysfs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/sparc/kernel/sysfs.c +1 -3
index 7f41d40..e15a4b8 100644
@@ -251,14 +251,12 @@ static int sysfs_cpu_notify(struct notifier_block *self,
 {
 	unsigned int cpu = (unsigned int)(long)hcpu;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		register_cpu_online(cpu);
 		break;
 #ifdef CONFIG_HOTPLUG_CPU
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		unregister_cpu_online(cpu);
 		break;
 #endif
Signature · 1 line
2.0.0.rc2
author
#49 lore raw

RFC PATCH 26/70 rcu, tree: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from rcu/tree.

---
 kernel/rcu/tree.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
kernel/rcu/tree.c +5 -7
index 625d0b0..8518338 100644
@@ -3440,28 +3440,26 @@ static int rcu_cpu_notify(struct notifier_block *self,
 	struct rcu_state *rsp;
 
 	trace_rcu_utilization(TPS("Start CPU hotplug"));
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		rcu_prepare_cpu(cpu);
 		rcu_prepare_kthreads(cpu);
 		break;
 	case CPU_ONLINE:
 	case CPU_DOWN_FAILED:
-		rcu_boost_kthread_setaffinity(rnp, -1);
+		if (!(action & CPU_TASKS_FROZEN))
+			rcu_boost_kthread_setaffinity(rnp, -1);
 		break;
 	case CPU_DOWN_PREPARE:
-		rcu_boost_kthread_setaffinity(rnp, cpu);
+		if (!(action & CPU_TASKS_FROZEN))
+			rcu_boost_kthread_setaffinity(rnp, cpu);
 		break;
 	case CPU_DYING:
-	case CPU_DYING_FROZEN:
 		for_each_rcu_flavor(rsp)
 			rcu_cleanup_dying_cpu(rsp);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 		for_each_rcu_flavor(rsp)
 			rcu_cleanup_dead_cpu(cpu, rsp);
 		break;
Signature · 1 line
2.0.0.rc2
author
#50 lore raw

RFC PATCH 27/70 kernel, padata: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from padata.

---
 kernel/padata.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
kernel/padata.c +1 -5
index 161402f..3a6bc6e 100644
@@ -842,11 +842,9 @@ static int padata_cpu_callback(struct notifier_block *nfb,
 
 	pinst = container_of(nfb, struct padata_instance, cpu_notifier);
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 	case CPU_DOWN_FAILED:
-	case CPU_DOWN_FAILED_FROZEN:
 		if (!pinst_has_cpu(pinst, cpu))
 			break;
 		mutex_lock(&pinst->lock);
@@ -857,9 +855,7 @@ static int padata_cpu_callback(struct notifier_block *nfb,
 		break;
 
 	case CPU_DOWN_PREPARE:
-	case CPU_DOWN_PREPARE_FROZEN:
 	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 		if (!pinst_has_cpu(pinst, cpu))
 			break;
 		mutex_lock(&pinst->lock);
Signature · 1 line
2.0.0.rc2
author
#51 lore raw

RFC PATCH 28/70 kernel, profile: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from kernel/profile.

---
 kernel/profile.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
kernel/profile.c +1 -5
index 54bf5ba..22bca4b 100644
@@ -333,9 +333,8 @@ static int profile_cpu_callback(struct notifier_block *info,
 	int node, cpu = (unsigned long)__cpu;
 	struct page *page;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		node = cpu_to_mem(cpu);
 		per_cpu(cpu_profile_flip, cpu) = 0;
 		if (!per_cpu(cpu_profile_hits, cpu)[1]) {
@@ -361,14 +360,11 @@ out_free:
 		__free_page(page);
 		return notifier_from_errno(-ENOMEM);
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		if (prof_cpu_mask != NULL)
 			cpumask_set_cpu(cpu, prof_cpu_mask);
 		break;
 	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		if (prof_cpu_mask != NULL)
 			cpumask_clear_cpu(cpu, prof_cpu_mask);
 		if (per_cpu(cpu_profile_hits, cpu)[0]) {
Signature · 1 line
2.0.0.rc2
author
#52 lore raw

RFC PATCH 29/70 kernel, sched, core: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from sched/core.

---
 kernel/sched/core.c | 55 ++++++++++++++++++++++++-----------------------------
 1 file changed, 25 insertions(+), 30 deletions(-)
kernel/sched/core.c +25 -30
index bc1638b..f0aff5f 100644
@@ -459,13 +459,10 @@ hotplug_hrtick(struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
 	int cpu = (int)(long)hcpu;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 	case CPU_DOWN_PREPARE:
-	case CPU_DOWN_PREPARE_FROZEN:
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		hrtick_clear(cpu_rq(cpu));
 		return NOTIFY_OK;
 	}
@@ -6742,30 +6739,28 @@ static int num_cpus_frozen;	/* used to mark begin/end of suspend/resume */
 static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action,
 			     void *hcpu)
 {
-	switch (action) {
-	case CPU_ONLINE_FROZEN:
-	case CPU_DOWN_FAILED_FROZEN:
-
-		/*
-		 * num_cpus_frozen tracks how many CPUs are involved in suspend
-		 * resume sequence. As long as this is not the last online
-		 * operation in the resume sequence, just build a single sched
-		 * domain, ignoring cpusets.
-		 */
-		num_cpus_frozen--;
-		if (likely(num_cpus_frozen)) {
-			partition_sched_domains(1, NULL, NULL);
-			break;
+	switch (action & ~CPU_TASKS_FROZEN) {
+	case CPU_ONLINE:
+	case CPU_DOWN_FAILED:
+		if (action & CPU_TASKS_FROZEN) {
+			/*
+			 * num_cpus_frozen tracks how many CPUs are involved
+			 * in suspend resume sequence. As long as this is not
+			 * the last online operation in the resume sequence,
+			 * just build a single sched domain, ignoring cpusets.
+			 */
+			num_cpus_frozen--;
+			if (likely(num_cpus_frozen)) {
+				partition_sched_domains(1, NULL, NULL);
+				break;
+			}
 		}
 
 		/*
-		 * This is the last CPU online operation. So fall through and
-		 * restore the original sched domains by considering the
-		 * cpuset configurations.
+		 * This is the last CPU online operation. So restore the
+		 * original sched domains by considering the cpuset
+		 * configurations.
 		 */
-
-	case CPU_ONLINE:
-	case CPU_DOWN_FAILED:
 		cpuset_update_active_cpus(true);
 		break;
 	default:
@@ -6777,13 +6772,13 @@ static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action,
 static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action,
 			       void *hcpu)
 {
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_DOWN_PREPARE:
-		cpuset_update_active_cpus(false);
-		break;
-	case CPU_DOWN_PREPARE_FROZEN:
-		num_cpus_frozen++;
-		partition_sched_domains(1, NULL, NULL);
+		if (action & CPU_TASKS_FROZEN) {
+			num_cpus_frozen++;
+			partition_sched_domains(1, NULL, NULL);
+		} else
+			cpuset_update_active_cpus(false);
 		break;
 	default:
 		return NOTIFY_DONE;
Signature · 1 line
2.0.0.rc2
author
#53 lore raw

RFC PATCH 30/70 kernel, hrtimer: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from kernel/hrtimer.

---
 kernel/hrtimer.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
kernel/hrtimer.c +1 -9
index 3ab2899..a37958e 100644
@@ -1756,27 +1756,19 @@ static int hrtimer_cpu_notify(struct notifier_block *self,
 {
 	int scpu = (long)hcpu;
 
-	switch (action) {
-
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		init_hrtimers_cpu(scpu);
 		break;
-
 #ifdef CONFIG_HOTPLUG_CPU
 	case CPU_DYING:
-	case CPU_DYING_FROZEN:
 		clockevents_notify(CLOCK_EVT_NOTIFY_CPU_DYING, &scpu);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
-	{
 		clockevents_notify(CLOCK_EVT_NOTIFY_CPU_DEAD, &scpu);
 		migrate_hrtimers(scpu);
 		break;
-	}
 #endif
-
 	default:
 		break;
 	}
Signature · 1 line
2.0.0.rc2
author
#54 lore raw

RFC PATCH 31/70 kernel, relay: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from fs/relay.

---
 kernel/relay.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/relay.c +1 -3
index 5a56d3c..3f7b6b1 100644
@@ -523,9 +523,8 @@ static int relay_hotcpu_callback(struct notifier_block *nb,
 	unsigned int hotcpu = (unsigned long)hcpu;
 	struct rchan *chan;
 
-	switch(action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		mutex_lock(&relay_channels_mutex);
 		list_for_each_entry(chan, &relay_channels, list) {
 			if (chan->buf[hotcpu])
@@ -542,7 +541,6 @@ static int relay_hotcpu_callback(struct notifier_block *nb,
 		mutex_unlock(&relay_channels_mutex);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		/* No need to flush the cpu : will be flushed upon
 		 * final relay_flush() call. */
 		break;
Signature · 1 line
2.0.0.rc2
author
#55 lore raw

RFC PATCH 32/70 kernel, smp: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from kernel/smp.

---
 kernel/smp.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
kernel/smp.c +1 -7
index 80c33f8..808ec06 100644
@@ -37,9 +37,8 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
 	long cpu = (long)hcpu;
 	struct call_function_data *cfd = &per_cpu(cfd_data, cpu);
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		if (!zalloc_cpumask_var_node(&cfd->cpumask, GFP_KERNEL,
 				cpu_to_node(cpu)))
 			return notifier_from_errno(-ENOMEM);
@@ -52,17 +51,12 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
 
 #ifdef CONFIG_HOTPLUG_CPU
 	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
-		/* Fall-through to the CPU_DEAD[_FROZEN] case. */
-
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		free_cpumask_var(cfd->cpumask);
 		free_percpu(cfd->csd);
 		break;
 
 	case CPU_DYING:
-	case CPU_DYING_FROZEN:
 		/*
 		 * The IPIs for the smp-call-function callbacks queued by other
 		 * CPUs might arrive late, either due to hardware latencies or
Signature · 1 line
2.0.0.rc2
author
#56 lore raw

RFC PATCH 33/70 kernel, timer: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from kernel/timer.

---
 kernel/timer.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/timer.c +1 -3
index 3bb01a3..cc11324 100644
@@ -1642,16 +1642,14 @@ static int timer_cpu_notify(struct notifier_block *self,
 	long cpu = (long)hcpu;
 	int err;
 
-	switch(action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		err = init_timers_cpu(cpu);
 		if (err < 0)
 			return notifier_from_errno(err);
 		break;
 #ifdef CONFIG_HOTPLUG_CPU
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		migrate_timers(cpu);
 		break;
 #endif
Signature · 1 line
2.0.0.rc2
author
#57 lore raw

RFC PATCH 34/70 kernel, softirq: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from kernel/softirq.

---
 kernel/softirq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/softirq.c +1 -2
index 5918d22..c4d4484 100644
@@ -726,10 +726,9 @@ static void takeover_tasklets(unsigned int cpu)
 static int cpu_callback(struct notifier_block *nfb, unsigned long action,
 			void *hcpu)
 {
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 #ifdef CONFIG_HOTPLUG_CPU
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		takeover_tasklets((unsigned long)hcpu);
 		break;
 #endif /* CONFIG_HOTPLUG_CPU */
Signature · 1 line
2.0.0.rc2
author
#58 lore raw

RFC PATCH 35/70 mm, slab: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from mm/slab.

---
 mm/slab.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
mm/slab.c +1 -7
index 3070b92..5490528 100644
@@ -1325,20 +1325,17 @@ static int cpuup_callback(struct notifier_block *nfb,
 	long cpu = (long)hcpu;
 	int err = 0;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		mutex_lock(&slab_mutex);
 		err = cpuup_prepare(cpu);
 		mutex_unlock(&slab_mutex);
 		break;
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		start_cpu_timer(cpu);
 		break;
 #ifdef CONFIG_HOTPLUG_CPU
   	case CPU_DOWN_PREPARE:
-  	case CPU_DOWN_PREPARE_FROZEN:
 		/*
 		 * Shutdown cache reaper. Note that the slab_mutex is
 		 * held so that if cache_reap() is invoked it cannot do
@@ -1350,11 +1347,9 @@ static int cpuup_callback(struct notifier_block *nfb,
 		per_cpu(slab_reap_work, cpu).work.func = NULL;
   		break;
   	case CPU_DOWN_FAILED:
-  	case CPU_DOWN_FAILED_FROZEN:
 		start_cpu_timer(cpu);
   		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		/*
 		 * Even if all the cpus of a node are down, we don't free the
 		 * kmem_cache_node of any cache. This to avoid a race between
@@ -1366,7 +1361,6 @@ static int cpuup_callback(struct notifier_block *nfb,
 		/* fall through */
 #endif
 	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 		mutex_lock(&slab_mutex);
 		cpuup_canceled(cpu);
 		mutex_unlock(&slab_mutex);
Signature · 1 line
2.0.0.rc2
author
#60 lore raw

RFC PATCH 36/70 mm, vmscan: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from mm/vmscan.

---
 mm/vmscan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/vmscan.c +1 -1
index 0f16ffe..25c0109 100644
@@ -3454,7 +3454,7 @@ static int cpu_callback(struct notifier_block *nfb, unsigned long action,
 {
 	int nid;
 
-	if (action == CPU_ONLINE || action == CPU_ONLINE_FROZEN) {
+	if ((action & ~CPU_TASKS_FROZEN) == CPU_ONLINE) {
 		for_each_node_state(nid, N_MEMORY) {
 			pg_data_t *pgdat = NODE_DATA(nid);
 			const struct cpumask *mask;
Signature · 1 line
2.0.0.rc2
author
#61 lore raw

RFC PATCH 37/70 mm, vmstat: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from mm/vmstat.

---
 mm/vmstat.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
mm/vmstat.c +1 -5
index b37bd49..a29a3d8 100644
@@ -1268,24 +1268,20 @@ static int vmstat_cpuup_callback(struct notifier_block *nfb,
 {
 	long cpu = (long)hcpu;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		refresh_zone_stat_thresholds();
 		start_cpu_timer(cpu);
 		node_set_state(cpu_to_node(cpu), N_CPU);
 		break;
 	case CPU_DOWN_PREPARE:
-	case CPU_DOWN_PREPARE_FROZEN:
 		cancel_delayed_work_sync(&per_cpu(vmstat_work, cpu));
 		per_cpu(vmstat_work, cpu).work.func = NULL;
 		break;
 	case CPU_DOWN_FAILED:
-	case CPU_DOWN_FAILED_FROZEN:
 		start_cpu_timer(cpu);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		refresh_zone_stat_thresholds();
 		vmstat_cpu_dead(cpu_to_node(cpu));
 		break;
Signature · 1 line
2.0.0.rc2
author
#63 lore raw

RFC PATCH 38/70 mm, memcontrol: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from mm/memcontrol.

---
 mm/memcontrol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memcontrol.c +1 -1
index a2c7bcb..871667d 100644
@@ -2540,7 +2540,7 @@ static int memcg_cpu_hotplug_callback(struct notifier_block *nb,
 	if (action == CPU_ONLINE)
 		return NOTIFY_OK;
 
-	if (action != CPU_DEAD && action != CPU_DEAD_FROZEN)
+	if ((action & ~CPU_TASKS_FROZEN) != CPU_DEAD)
 		return NOTIFY_OK;
 
 	for_each_mem_cgroup(iter)
Signature · 1 line
2.0.0.rc2
author
#64 lore raw

RFC PATCH 39/70 mm, page_alloc: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from mm/page_alloc.

---
 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_alloc.c +1 -1
index 0ea758b..c52c2a8 100644
@@ -5537,7 +5537,7 @@ static int page_alloc_cpu_notify(struct notifier_block *self,
 {
 	int cpu = (unsigned long)hcpu;
 
-	if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) {
+	if ((action & ~CPU_TASKS_FROZEN) == CPU_DEAD) {
 		lru_add_drain_cpu(cpu);
 		drain_pages(cpu);
 
Signature · 1 line
2.0.0.rc2
author
#65 lore raw

RFC PATCH 40/70 mm, slub: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from mm/slub.

---
 mm/slub.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
mm/slub.c +1 -3
index 7300480..0504f6b 100644
@@ -3796,11 +3796,9 @@ static int slab_cpuup_callback(struct notifier_block *nfb,
 	struct kmem_cache *s;
 	unsigned long flags;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		mutex_lock(&slab_mutex);
 		list_for_each_entry(s, &slab_caches, list) {
 			local_irq_save(flags);
Signature · 1 line
2.0.0.rc2
author
#67 lore raw

RFC PATCH 41/70 fs, buffer: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from fs/buffer.

---
 fs/buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/buffer.c +1 -1
index eba6e4f..47960b7 100644
@@ -3373,7 +3373,7 @@ static void buffer_exit_cpu(int cpu)
 static int buffer_cpu_notify(struct notifier_block *self,
 			      unsigned long action, void *hcpu)
 {
-	if (action == CPU_DEAD || action == CPU_DEAD_FROZEN)
+	if ((action & ~CPU_TASKS_FROZEN) == CPU_DEAD)
 		buffer_exit_cpu((unsigned long)hcpu);
 	return NOTIFY_OK;
 }
Signature · 1 line
2.0.0.rc2
author
#68 lore raw

RFC PATCH 42/70 xfs, xfs_mount: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from xfs/xfs_mount.

---
 fs/xfs/xfs_mount.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
fs/xfs/xfs_mount.c +1 -4
index 3507cd0..b701946 100644
@@ -1531,15 +1531,13 @@ xfs_icsb_cpu_notify(
 	mp = (xfs_mount_t *)container_of(nfb, xfs_mount_t, m_icsb_notifier);
 	cntp = (xfs_icsb_cnts_t *)
 			per_cpu_ptr(mp->m_sb_cnts, (unsigned long)hcpu);
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		/* Easy Case - initialize the area and locks, and
 		 * then rebalance when online does everything else for us. */
 		memset(cntp, 0, sizeof(xfs_icsb_cnts_t));
 		break;
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		xfs_icsb_lock(mp);
 		xfs_icsb_balance_counter(mp, XFS_SBS_ICOUNT, 0);
 		xfs_icsb_balance_counter(mp, XFS_SBS_IFREE, 0);
@@ -1547,7 +1545,6 @@ xfs_icsb_cpu_notify(
 		xfs_icsb_unlock(mp);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		/* Disable all the counters, then fold the dead cpu's
 		 * count into the total on the global superblock and
 		 * re-enable the counters. */
Signature · 1 line
2.0.0.rc2
author
#69 lore raw

RFC PATCH 43/70 net, iucv: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from net/iucv.

---
 net/iucv/iucv.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
net/iucv/iucv.c +1 -7
index da78793..4a44595 100644
@@ -663,28 +663,22 @@ static int iucv_cpu_notify(struct notifier_block *self,
 	cpumask_t cpumask;
 	long cpu = (long) hcpu;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		if (alloc_iucv_data(cpu))
 			return notifier_from_errno(-ENOMEM);
 		break;
 	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		free_iucv_data(cpu);
 		break;
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 	case CPU_DOWN_FAILED:
-	case CPU_DOWN_FAILED_FROZEN:
 		if (!iucv_path_table)
 			break;
 		smp_call_function_single(cpu, iucv_declare_cpu, NULL, 1);
 		break;
 	case CPU_DOWN_PREPARE:
-	case CPU_DOWN_PREPARE_FROZEN:
 		if (!iucv_path_table)
 			break;
 		cpumask_copy(&cpumask, &iucv_buffer_cpumask);
Signature · 1 line
2.0.0.rc2
author
#70 lore raw

RFC PATCH 44/70 net, core, flow: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from net/core/flow.

---
 net/core/flow.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
net/core/flow.c +1 -3
index a0348fd..3bb5dc0 100644
@@ -417,15 +417,13 @@ static int flow_cache_cpu(struct notifier_block *nfb,
 	int res, cpu = (unsigned long) hcpu;
 	struct flow_cache_percpu *fcp = per_cpu_ptr(fc->percpu, cpu);
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		res = flow_cache_cpu_prepare(fc, cpu);
 		if (res)
 			return notifier_from_errno(res);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		__flow_cache_shrink(fc, fcp, 0);
 		break;
 	}
Signature · 1 line
2.0.0.rc2
author
#71 lore raw

RFC PATCH 45/70 net, core, dev: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from net/core/dev.

---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dev.c +1 -1
index 7990984..2c3801a 100644
@@ -6805,7 +6805,7 @@ static int dev_cpu_callback(struct notifier_block *nfb,
 	unsigned int cpu, oldcpu = (unsigned long)ocpu;
 	struct softnet_data *sd, *oldsd;
 
-	if (action != CPU_DEAD && action != CPU_DEAD_FROZEN)
+	if ((action & ~CPU_TASKS_FROZEN) != CPU_DEAD)
 		return NOTIFY_OK;
 
 	local_irq_disable();
Signature · 1 line
2.0.0.rc2
author
#72 lore raw

RFC PATCH 46/70 block, blk-mq: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from block/blk-mq.

---
 block/blk-mq.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
block/blk-mq.c +6 -4
index ad69ef6..b5cd279 100644
@@ -1522,9 +1522,11 @@ static int blk_mq_hctx_notify(void *data, unsigned long action,
 {
 	struct blk_mq_hw_ctx *hctx = data;
 
-	if (action == CPU_DEAD || action == CPU_DEAD_FROZEN)
+	action &= ~CPU_TASKS_FROZEN;
+
+	if (action == CPU_DEAD)
 		return blk_mq_hctx_cpu_offline(hctx, cpu);
-	else if (action == CPU_ONLINE || action == CPU_ONLINE_FROZEN)
+	else if (action == CPU_ONLINE)
 		return blk_mq_hctx_cpu_online(hctx, cpu);
 
 	return NOTIFY_OK;
@@ -1939,8 +1941,8 @@ static int blk_mq_queue_reinit_notify(struct notifier_block *nb,
 	 * offline CPUs to first hardware queue. We will re-init the queue
 	 * below to get optimal settings.
 	 */
-	if (action != CPU_DEAD && action != CPU_DEAD_FROZEN &&
-	    action != CPU_ONLINE && action != CPU_ONLINE_FROZEN)
+	action &= ~CPU_TASKS_FROZEN;
+	if (action != CPU_DEAD && action != CPU_ONLINE)
 		return NOTIFY_OK;
 
 	mutex_lock(&all_q_mutex);
Signature · 1 line
2.0.0.rc2
author
#73 lore raw

RFC PATCH 47/70 block, blk-iopoll: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from block/blk-iopoll.

---
 block/blk-iopoll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-iopoll.c +1 -1
index 0736729..ba88c82 100644
@@ -193,7 +193,7 @@ static int blk_iopoll_cpu_notify(struct notifier_block *self,
 	 * If a CPU goes away, splice its entries to the current CPU
 	 * and trigger a run of the softirq
 	 */
-	if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) {
+	if ((action & ~CPU_TASKS_FROZEN) == CPU_DEAD) {
 		int cpu = (unsigned long) hcpu;
 
 		local_irq_disable();
Signature · 1 line
2.0.0.rc2
author
#74 lore raw

RFC PATCH 48/70 block, blk-softirq: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from block/blk-softirq.

---
 block/blk-softirq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-softirq.c +1 -1
index 53b1737..3ab9c2e 100644
@@ -85,7 +85,7 @@ static int blk_cpu_notify(struct notifier_block *self, unsigned long action,
 	 * If a CPU goes away, splice its entries to the current CPU
 	 * and trigger a run of the softirq
 	 */
-	if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) {
+	if ((action & ~CPU_TASKS_FROZEN) == CPU_DEAD) {
 		int cpu = (unsigned long) hcpu;
 
 		local_irq_disable();
Signature · 1 line
2.0.0.rc2
author
#75 lore raw

RFC PATCH 49/70 driver, base, topology: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from driver/base/topology.

---
 drivers/base/topology.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/base/topology.c +1 -4
index be7c1fb..369e437 100644
@@ -141,15 +141,12 @@ static int topology_cpu_callback(struct notifier_block *nfb,
 	unsigned int cpu = (unsigned long)hcpu;
 	int rc = 0;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		rc = topology_add_dev(cpu);
 		break;
 	case CPU_UP_CANCELED:
-	case CPU_UP_CANCELED_FROZEN:
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		topology_remove_dev(cpu);
 		break;
 	}
Signature · 1 line
2.0.0.rc2
author
#76 lore raw

RFC PATCH 50/70 clocksource, metag_generic: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from clocksource/metag_generic.

---
 drivers/clocksource/metag_generic.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clocksource/metag_generic.c +1 -2
index 9e4db41..eefa164 100644
@@ -159,9 +159,8 @@ static int arch_timer_cpu_notify(struct notifier_block *self,
 {
 	int cpu = (long)hcpu;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_STARTING:
-	case CPU_STARTING_FROZEN:
 		arch_timer_setup(cpu);
 		break;
 	}
Signature · 1 line
2.0.0.rc2
author
#77 lore raw

RFC PATCH 51/70 powercap, intel_rapl: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from powercap/intel_rapl.

---
 drivers/powercap/intel_rapl.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/powercap/intel_rapl.c +1 -4
index b1cda6f..c55de1a 100644
@@ -1328,11 +1328,9 @@ static int rapl_cpu_callback(struct notifier_block *nfb,
 	struct rapl_package *rp;
 
 	phy_package_id = topology_physical_package_id(cpu);
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 	case CPU_DOWN_FAILED:
-	case CPU_DOWN_FAILED_FROZEN:
 		rp = find_package_by_id(phy_package_id);
 		if (rp)
 			++rp->nr_cpus;
@@ -1340,7 +1338,6 @@ static int rapl_cpu_callback(struct notifier_block *nfb,
 			rapl_add_package(cpu);
 		break;
 	case CPU_DOWN_PREPARE:
-	case CPU_DOWN_PREPARE_FROZEN:
 		rp = find_package_by_id(phy_package_id);
 		if (!rp)
 			break;
Signature · 1 line
2.0.0.rc2
author
#78 lore raw

RFC PATCH 52/70 cpuidle, cpuidle-powernv: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from cpuidle/cpuidle-powernv.

---
 drivers/cpuidle/cpuidle-powernv.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cpuidle/cpuidle-powernv.c +1 -3
index 74f5788..78575a8 100644
@@ -107,16 +107,14 @@ static int powernv_cpuidle_add_cpu_notifier(struct notifier_block *n,
 				per_cpu(cpuidle_devices, hotcpu);
 
 	if (dev && cpuidle_get_driver()) {
-		switch (action) {
+		switch (action & ~CPU_TASKS_FROZEN) {
 		case CPU_ONLINE:
-		case CPU_ONLINE_FROZEN:
 			cpuidle_pause_and_lock();
 			cpuidle_enable_device(dev);
 			cpuidle_resume_and_unlock();
 			break;
 
 		case CPU_DEAD:
-		case CPU_DEAD_FROZEN:
 			cpuidle_pause_and_lock();
 			cpuidle_disable_device(dev);
 			cpuidle_resume_and_unlock();
Signature · 1 line
2.0.0.rc2
author
#79 lore raw

RFC PATCH 53/70 cpuidle, cpuidle-pseries: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from cpuidle/cpuidle-pseries.

---
 drivers/cpuidle/cpuidle-pseries.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cpuidle/cpuidle-pseries.c +1 -3
index 6f7b019..11902eb 100644
@@ -176,16 +176,14 @@ static int pseries_cpuidle_add_cpu_notifier(struct notifier_block *n,
 				per_cpu(cpuidle_devices, hotcpu);
 
 	if (dev && cpuidle_get_driver()) {
-		switch (action) {
+		switch (action & ~CPU_TASKS_FROZEN) {
 		case CPU_ONLINE:
-		case CPU_ONLINE_FROZEN:
 			cpuidle_pause_and_lock();
 			cpuidle_enable_device(dev);
 			cpuidle_resume_and_unlock();
 			break;
 
 		case CPU_DEAD:
-		case CPU_DEAD_FROZEN:
 			cpuidle_pause_and_lock();
 			cpuidle_disable_device(dev);
 			cpuidle_resume_and_unlock();
Signature · 1 line
2.0.0.rc2
author
#80 lore raw

RFC PATCH 54/70 cpufreq, acpi-cpufreq: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from cpufreq/acpi-cpufreq.

---
 drivers/cpufreq/acpi-cpufreq.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +1 -3
index b0c18ed..2b7ffc1 100644
@@ -533,14 +533,12 @@ static int boost_notify(struct notifier_block *nb, unsigned long action,
 	 * sync with the current global state.
 	 */
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		boost_set_msrs(acpi_cpufreq_driver.boost_enabled, cpumask);
 		break;
 
 	case CPU_DOWN_PREPARE:
-	case CPU_DOWN_PREPARE_FROZEN:
 		boost_set_msrs(1, cpumask);
 		break;
 
Signature · 1 line
2.0.0.rc2
author
#81 lore raw

RFC PATCH 55/70 irqchip, irq-armada-370-xp: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from irqchip/irq-armada-370-xp.

---
 drivers/irqchip/irq-armada-370-xp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-armada-370-xp.c +1 -1
index 574aba0..1c46257 100644
@@ -357,7 +357,7 @@ static void armada_xp_mpic_smp_cpu_init(void)
 static int armada_xp_mpic_secondary_init(struct notifier_block *nfb,
 					 unsigned long action, void *hcpu)
 {
-	if (action == CPU_STARTING || action == CPU_STARTING_FROZEN)
+	if ((action & ~CPU_TASKS_FROZEN) == CPU_STARTING)
 		armada_xp_mpic_smp_cpu_init();
 	return NOTIFY_OK;
 }
Signature · 1 line
2.0.0.rc2
author
#82 lore raw

RFC PATCH 56/70 irqchip, irq-gic: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from irqchip/irq-gic.

---
 drivers/irqchip/irq-gic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic.c +1 -1
index 7c131cf..a8df097 100644
@@ -877,7 +877,7 @@ static int gic_irq_domain_xlate(struct irq_domain *d,
 static int gic_secondary_init(struct notifier_block *nfb, unsigned long action,
 			      void *hcpu)
 {
-	if (action == CPU_STARTING || action == CPU_STARTING_FROZEN)
+	if ((action & ~CPU_TASKS_FROZEN) == CPU_STARTING)
 		gic_cpu_init(&gic_data[0]);
 	return NOTIFY_OK;
 }
Signature · 1 line
2.0.0.rc2
author
#83 lore raw

RFC PATCH 57/70 scsi, bnx2fc, bnx2fc_fcoe: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from scsi/bnx2fc_fcoe.

---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +1 -3
index 785d0d7..c56281d 100644
@@ -2507,14 +2507,12 @@ static int bnx2fc_cpu_callback(struct notifier_block *nfb,
 {
 	unsigned cpu = (unsigned long)hcpu;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		printk(PFX "CPU %x online: Create Rx thread\n", cpu);
 		bnx2fc_percpu_thread_create(cpu);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		printk(PFX "CPU %x offline: Remove Rx thread\n", cpu);
 		bnx2fc_percpu_thread_destroy(cpu);
 		break;
Signature · 1 line
2.0.0.rc2
author
#84 lore raw

RFC PATCH 58/70 scsi, bnx2i, bnx2i_init: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from scsi/bnx2i_init.

---
 drivers/scsi/bnx2i/bnx2i_init.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +1 -3
index 80c03b4..bd71179 100644
@@ -476,15 +476,13 @@ static int bnx2i_cpu_callback(struct notifier_block *nfb,
 {
 	unsigned cpu = (unsigned long)hcpu;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		printk(KERN_INFO "bnx2i: CPU %x online: Create Rx thread\n",
 			cpu);
 		bnx2i_percpu_thread_create(cpu);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		printk(KERN_INFO "CPU %x offline: Remove Rx thread\n", cpu);
 		bnx2i_percpu_thread_destroy(cpu);
 		break;
Signature · 1 line
2.0.0.rc2
author
#85 lore raw

RFC PATCH 59/70 scsi, fcoe: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from scsi/fcoe.

---
 drivers/scsi/fcoe/fcoe.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/fcoe/fcoe.c +1 -3
index 00ee0ed..f1d3f6a 100644
@@ -1376,14 +1376,12 @@ static int fcoe_cpu_callback(struct notifier_block *nfb,
 {
 	unsigned cpu = (unsigned long)hcpu;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		FCOE_DBG("CPU %x online: Create Rx thread\n", cpu);
 		fcoe_percpu_thread_create(cpu);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		FCOE_DBG("CPU %x offline: Remove Rx thread\n", cpu);
 		fcoe_percpu_thread_destroy(cpu);
 		break;
Signature · 1 line
2.0.0.rc2
author
#86 lore raw

RFC PATCH 60/70 scsi, virtio_scsi: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from scsi/virtio_scsi.

---
 drivers/scsi/virtio_scsi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/virtio_scsi.c +1 -3
index 308256b..22f4a6e5 100644
@@ -782,11 +782,9 @@ static int virtscsi_cpu_callback(struct notifier_block *nfb,
 				 unsigned long action, void *hcpu)
 {
 	struct virtio_scsi *vscsi = container_of(nfb, struct virtio_scsi, nb);
-	switch(action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		__virtscsi_set_affinity(vscsi, true);
 		break;
 	default:
Signature · 1 line
2.0.0.rc2
author
#87 lore raw

RFC PATCH 61/70 md, raid5: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from md/raid5.

---
 drivers/md/raid5.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/md/raid5.c +1 -3
index 6234b2e..3d76235 100644
@@ -5665,9 +5665,8 @@ static int raid456_cpu_notify(struct notifier_block *nfb, unsigned long action,
 	long cpu = (long)hcpu;
 	struct raid5_percpu *percpu = per_cpu_ptr(conf->percpu, cpu);
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		if (alloc_scratch_buffer(conf, percpu)) {
 			pr_err("%s: failed memory allocation for cpu%ld\n",
 			       __func__, cpu);
@@ -5675,7 +5674,6 @@ static int raid456_cpu_notify(struct notifier_block *nfb, unsigned long action,
 		}
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		free_scratch_buffer(conf, per_cpu_ptr(conf->percpu, cpu));
 		break;
 	default:
Signature · 1 line
2.0.0.rc2
author
#88 lore raw

RFC PATCH 62/70 virt, kvm, arm, arch_timer: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from kvm/arm/arch_timer.

---
 virt/kvm/arm/arch_timer.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
virt/kvm/arm/arch_timer.c +1 -3
index 22fa819..169512d 100644
@@ -220,13 +220,11 @@ u64 kvm_arm_timer_get_reg(struct kvm_vcpu *vcpu, u64 regid)
 static int kvm_timer_cpu_notify(struct notifier_block *self,
 				unsigned long action, void *cpu)
 {
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_STARTING:
-	case CPU_STARTING_FROZEN:
 		kvm_timer_init_interrupt(NULL);
 		break;
 	case CPU_DYING:
-	case CPU_DYING_FROZEN:
 		disable_percpu_irq(host_vtimer_irq);
 		break;
 	}
Signature · 1 line
2.0.0.rc2
author
#89 lore raw

RFC PATCH 63/70 virt, kvm, arm, vgic: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from kvm/arm/vgic.

---
 virt/kvm/arm/vgic.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
virt/kvm/arm/vgic.c +1 -3
index 56ff9be..f93b8c5 100644
@@ -1452,13 +1452,11 @@ static void vgic_init_maintenance_interrupt(void *info)
 static int vgic_cpu_notify(struct notifier_block *self,
 			   unsigned long action, void *cpu)
 {
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_STARTING:
-	case CPU_STARTING_FROZEN:
 		vgic_init_maintenance_interrupt(NULL);
 		break;
 	case CPU_DYING:
-	case CPU_DYING_FROZEN:
 		disable_percpu_irq(vgic_maint_irq);
 		break;
 	}
Signature · 1 line
2.0.0.rc2
author
#90 lore raw

RFC PATCH 64/70 trace, ring_buffer: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from trace/ring_buffer.

---
 kernel/trace/ring_buffer.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/trace/ring_buffer.c +1 -3
index ff70271..1cd5793 100644
@@ -4607,9 +4607,8 @@ static int rb_cpu_notify(struct notifier_block *self,
 	int cpu_i, nr_pages_same;
 	unsigned int nr_pages;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_UP_PREPARE:
-	case CPU_UP_PREPARE_FROZEN:
 		if (cpumask_test_cpu(cpu, buffer->cpumask))
 			return NOTIFY_OK;
 
@@ -4639,7 +4638,6 @@ static int rb_cpu_notify(struct notifier_block *self,
 		cpumask_set_cpu(cpu, buffer->cpumask);
 		break;
 	case CPU_DOWN_PREPARE:
-	case CPU_DOWN_PREPARE_FROZEN:
 		/*
 		 * Do nothing.
 		 *  If we were to free the buffer, then the user would
Signature · 1 line
2.0.0.rc2
author
#91 lore raw

RFC PATCH 65/70 oprofile, timer_int: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from oprofile/timer_int.

---
 drivers/oprofile/timer_int.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/oprofile/timer_int.c +1 -3
index 61be1d9..ab5a0a9 100644
@@ -79,14 +79,12 @@ static int oprofile_cpu_notify(struct notifier_block *self,
 {
 	long cpu = (long) hcpu;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		smp_call_function_single(cpu, __oprofile_hrtimer_start,
 					 NULL, 1);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		__oprofile_hrtimer_stop(cpu);
 		break;
 	}
Signature · 1 line
2.0.0.rc2
Acked-by on v1 65/70
#92 lore raw

Re: [RFC PATCH v1 65/70] oprofile, timer_int: _FROZEN Cleanup

Quoted 3 lines · Gong

Remove XXX_FROZEN state from oprofile/timer_int.

Quoted 27 lines
---
 drivers/oprofile/timer_int.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/oprofile/timer_int.c +1 -3
index 61be1d9..ab5a0a9 100644
@@ -79,14 +79,12 @@ static int oprofile_cpu_notify(struct notifier_block *self,
 {
 	long cpu = (long) hcpu;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		smp_call_function_single(cpu, __oprofile_hrtimer_start,
 					 NULL, 1);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		__oprofile_hrtimer_stop(cpu);
 		break;
 	}
Signature · 1 line
2.0.0.rc2
author
#93 lore raw

RFC PATCH 66/70 lib, cpu-notifier-error-inject: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from lib/cpu-notifier-error-inject.

---
 lib/cpu-notifier-error-inject.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/cpu-notifier-error-inject.c +4 -4
index 707ca24..78c28db 100644
@@ -10,10 +10,10 @@ MODULE_PARM_DESC(priority, "specify cpu notifier priority");
 
 static struct notifier_err_inject cpu_notifier_err_inject = {
 	.actions = {
-		{ NOTIFIER_ERR_INJECT_ACTION(CPU_UP_PREPARE) },
-		{ NOTIFIER_ERR_INJECT_ACTION(CPU_UP_PREPARE_FROZEN) },
-		{ NOTIFIER_ERR_INJECT_ACTION(CPU_DOWN_PREPARE) },
-		{ NOTIFIER_ERR_INJECT_ACTION(CPU_DOWN_PREPARE_FROZEN) },
+		{NOTIFIER_ERR_INJECT_ACTION(CPU_UP_PREPARE)},
+		{NOTIFIER_ERR_INJECT_ACTION(CPU_UP_PREPARE|CPU_TASKS_FROZEN)},
+		{NOTIFIER_ERR_INJECT_ACTION(CPU_DOWN_PREPARE)},
+		{NOTIFIER_ERR_INJECT_ACTION(CPU_DOWN_PREPARE|CPU_TASKS_FROZEN)},
 		{}
 	}
 };
Signature · 1 line
2.0.0.rc2
author
#94 lore raw

RFC PATCH 67/70 lib, percpu_counter: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from lib/percpu_counter.

---
 lib/percpu_counter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/percpu_counter.c +1 -1
index 7dd33577..9a833ea 100644
@@ -169,7 +169,7 @@ static int percpu_counter_hotcpu_callback(struct notifier_block *nb,
 	struct percpu_counter *fbc;
 
 	compute_batch_value();
-	if (action != CPU_DEAD && action != CPU_DEAD_FROZEN)
+	if ((action & ~CPU_TASKS_FROZEN) != CPU_DEAD)
 		return NOTIFY_OK;
 
 	cpu = (unsigned long)hcpu;
Signature · 1 line
2.0.0.rc2
author
#95 lore raw

RFC PATCH 68/70 lib, radix-tree: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from lib/radix-tree.

---
 lib/radix-tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/radix-tree.c +1 -1
index 3291a8e..5f7231c 100644
@@ -1465,7 +1465,7 @@ static int radix_tree_callback(struct notifier_block *nfb,
        struct radix_tree_preload *rtp;
 
        /* Free per-cpu pool of perloaded nodes */
-       if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) {
+       if ((action & ~CPU_TASKS_FROZEN) == CPU_DEAD) {
                rtp = &per_cpu(radix_tree_preloads, cpu);
                while (rtp->nr) {
                        kmem_cache_free(radix_tree_node_cachep,
Signature · 1 line
2.0.0.rc2
author
#96 lore raw

RFC PATCH 69/70 staging, lustre, linux-cpu: _FROZEN Cleanup

In reply to Chen, Gong

Remove XXX_FROZEN state from lustre/linux-cpu.

---
 drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +2 -4
index fc21210..0e061ca 100644
@@ -954,16 +954,14 @@ cfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
 	unsigned int  cpu = (unsigned long)hcpu;
 	bool	     warn;
 
-	switch (action) {
+	switch (action & ~CPU_TASKS_FROZEN) {
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		spin_lock(&cpt_data.cpt_lock);
 		cpt_data.cpt_version++;
 		spin_unlock(&cpt_data.cpt_lock);
 	default:
-		if (action != CPU_DEAD && action != CPU_DEAD_FROZEN) {
+		if ((action & ~CPU_TASKS_FROZEN) != CPU_DEAD) {
 			CDEBUG(D_INFO, "CPU changed [cpu %u action %lx]\n",
 			       cpu, action);
 			break;
Signature · 1 line
2.0.0.rc2
author
#97 lore raw

RFC PATCH 70/70 cpu: Eliminate _FROZEN flags thoroughly

In reply to Chen, Gong

By now all usages of XXX_FROZEN have been removed. It can be deleted safely.

---
 include/linux/cpu.h | 9 ---------
 1 file changed, 9 deletions(-)
include/linux/cpu.h +0 -9
index 95978ad..9de61cc 100644
@@ -97,15 +97,6 @@ enum {
  */
 #define CPU_TASKS_FROZEN	0x0010
 
-#define CPU_ONLINE_FROZEN	(CPU_ONLINE | CPU_TASKS_FROZEN)
-#define CPU_UP_PREPARE_FROZEN	(CPU_UP_PREPARE | CPU_TASKS_FROZEN)
-#define CPU_UP_CANCELED_FROZEN	(CPU_UP_CANCELED | CPU_TASKS_FROZEN)
-#define CPU_DOWN_PREPARE_FROZEN	(CPU_DOWN_PREPARE | CPU_TASKS_FROZEN)
-#define CPU_DOWN_FAILED_FROZEN	(CPU_DOWN_FAILED | CPU_TASKS_FROZEN)
-#define CPU_DEAD_FROZEN		(CPU_DEAD | CPU_TASKS_FROZEN)
-#define CPU_DYING_FROZEN	(CPU_DYING | CPU_TASKS_FROZEN)
-#define CPU_STARTING_FROZEN	(CPU_STARTING | CPU_TASKS_FROZEN)
-
 
 #ifdef CONFIG_SMP
 /* Need to know about CPUs going up/down? */
Signature · 1 line
2.0.0.rc2
author
#98 lore raw
In reply to Chen, Gong
Quoted 5 lines · Gong

Back to long time ago (about 1.5 years), Thomas began the work for CPU hot-plug, one first thing is CPU hotplug flag cleanup. Paul hoped all the _FROZEN variants of the notifier actions can be removed at that time. Now here it is.

Quoted 8 lines

Patch 1 ~ 69: remove all kinds of XXX_FROZEN usages Patch 70: remove XXX_FROZEN from the kernel thoroughly

Not sure if removing XXX_FROZEN flags thoroughly is overkilled. Fix me if I'm wrong.

P.S. My last post is banned because of the capital Triple-X in subject :-(

Hi, maintainers

Until now only Boris gave me some comments. Isn't interesting enough? Or I head into wrong way? Please let me know. Sincere thanks for everyone.

maintainer
#99 lore raw
Quoted 3 lines · Gong

Until now only Boris gave me some comments. Isn't interesting enough? Or I head into wrong way? Please let me know. Sincere thanks for everyone.

You're impatient. Give people some time, at least a week.

:-)

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author
#100 lore raw
Quoted 13 lines · Borislav Petkov
Quoted 3 lines · Gong

Until now only Boris gave me some comments. Isn't interesting enough? Or I head into wrong way? Please let me know. Sincere thanks for everyone.

You're impatient. Give people some time, at least a week.

:-)

Signature · 2 lines
Regards/Gruss,
    Boris.

Oh, I see. So Sorry for that.

#101 lore raw
In reply to Chen, Gong
Quoted 7 lines · Gong

Back to long time ago (about 1.5 years), Thomas began the work for CPU hot-plug, one first thing is CPU hotplug flag cleanup. Paul hoped all the _FROZEN variants of the notifier actions can be removed at that time. Now here it is.

Patch 1 ~ 69: remove all kinds of XXX_FROZEN usages Patch 70: remove XXX_FROZEN from the kernel thoroughly

You might want to update Documentation/ as well.

-Robert

author
#102 lore raw
Quoted 10 lines · Robert Richter
Quoted 7 lines

Back to long time ago (about 1.5 years), Thomas began the work for CPU hot-plug, one first thing is CPU hotplug flag cleanup. Paul hoped all the _FROZEN variants of the notifier actions can be removed at that time. Now here it is.

Patch 1 ~ 69: remove all kinds of XXX_FROZEN usages Patch 70: remove XXX_FROZEN from the kernel thoroughly

You might want to update Documentation/ as well.

Thanks for your reminder. I don't do that intentionally because
1) This is RFC patch and I'm not sure if maintainers agree to remove XXX_FROZEN thoroughtly
2) I have a little bit hesitation how to describe XXX_FROZEN status after they are removed.

Anyway, I will do that in formal patch series. Thanks again!

maintainer
#103 lore raw
Quoted 2 lines · Gong

1) This is RFC patch and I'm not sure if maintainers agree to remove XXX_FROZEN thoroughtly

I think so because this is part of a bigger rework of the whole stinking CPU hotplug pile. And the frozen states are gone:

https://lkml.kernel.org/r/[email protected]

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#104 lore raw
In reply to Chen, Gong
Quoted 11 lines · Gong
Quoted 10 lines · Robert Richter
Quoted 7 lines

Back to long time ago (about 1.5 years), Thomas began the work for CPU hot-plug, one first thing is CPU hotplug flag cleanup. Paul hoped all the _FROZEN variants of the notifier actions can be removed at that time. Now here it is.

Patch 1 ~ 69: remove all kinds of XXX_FROZEN usages Patch 70: remove XXX_FROZEN from the kernel thoroughly

You might want to update Documentation/ as well.

Quoted 7 lines

Thanks for your reminder. I don't do that intentionally because
1) This is RFC patch and I'm not sure if maintainers agree to remove XXX_FROZEN thoroughtly
2) I have a little bit hesitation how to describe XXX_FROZEN status after they are removed.

Anyway, I will do that in formal patch series. Thanks again!

Yes, thanks. It does not make sense to remove the XXX_FROZEN pattern in the code while keeping it in the cpu hotplug description.

-Robert