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(-)
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.
Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Chen, Gong <[email protected]>
---
kernel/cpu.c | 66 +++++++++++++++++++++++++-----------------------------------
1 file changed, 27 insertions(+), 39 deletions(-)
diff --git a/kernel/cpu.c b/kernel/cpu.c
index a343bde..3da7e82 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -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 */
--
2.0.0.rc2
Remove XXX_FROZEN state from ia64/err_inject.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/ia64/kernel/err_inject.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c
index 0c161ed..a8b70d4 100644
--- a/arch/ia64/kernel/err_inject.c
+++ b/arch/ia64/kernel/err_inject.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from ia64/mca.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/ia64/kernel/mca.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index db7b36b..c89faa6 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from ia64/palinfo.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/ia64/kernel/palinfo.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
index c39c3cd..e0ce152 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from ia64/salinfo.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/ia64/kernel/salinfo.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c
index ee9719e..c454375 100644
--- a/arch/ia64/kernel/salinfo.c
+++ b/arch/ia64/kernel/salinfo.c
@@ -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);
--
2.0.0.rc2
Remove XXX_FROZEN state from ia64/topology.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/ia64/kernel/topology.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index f295f9a..b39c9b6 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from x86/intel_cacheinfo.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/x86/kernel/cpu/intel_cacheinfo.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index a952e9c..2e8161e 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from x86/mce_amd.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/x86/kernel/cpu/mcheck/mce_amd.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 603df4f..cc57f13 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -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:
--
2.0.0.rc2
Remove XXX_FROZEN state from kvm.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/x86/kernel/kvm.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 3dd8e2c..22d472b 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from mce/therm_throt.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/x86/kernel/cpu/mcheck/therm_throt.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index 36a1bb6..dd13686 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from x86/vsyscall_64.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/x86/kernel/vsyscall_64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index ea5b570..72a1576 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from x86/pci/amd_bus.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/x86/pci/amd_bus.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
index c20d2cc..30f0fca9 100644
--- a/arch/x86/pci/amd_bus.c
+++ b/arch/x86/pci/amd_bus.c
@@ -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:
--
2.0.0.rc2
Remove XXX_FROZEN state from x86/x2apic_cluster.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/x86/kernel/apic/x2apic_cluster.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
index e66766b..bfd2369 100644
--- a/arch/x86/kernel/apic/x2apic_cluster.c
+++ b/arch/x86/kernel/apic/x2apic_cluster.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from x86/kernel/cpuid.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/x86/kernel/cpuid.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 3225ae6c..0288e4f 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -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);
}
--
2.0.0.rc2
Remove XXX_FROZEN state from x86/kernel/msr.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/x86/kernel/msr.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index c9603ac..e388659 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -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);
}
--
2.0.0.rc2
Remove XXX_FROZEN state from powerpc/sysfs.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/powerpc/kernel/sysfs.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 67fd2fd..8a3739c 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -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
--
2.0.0.rc2
Remove XXX_FROZEN state from arm/vfp/vfpmodule.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/arm/vfp/vfpmodule.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 2f37e1d..a1a6154 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from arm/kvm.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/arm/kvm/arm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 3c82b37..0014464 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from powerpc/mmu_context_nohash.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/powerpc/mm/mmu_context_nohash.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/powerpc/mm/mmu_context_nohash.c b/arch/powerpc/mm/mmu_context_nohash.c
index 928ebe7..4ada715 100644
--- a/arch/powerpc/mm/mmu_context_nohash.c
+++ b/arch/powerpc/mm/mmu_context_nohash.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from loongson/smp.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/mips/loongson/loongson-3/smp.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/mips/loongson/loongson-3/smp.c b/arch/mips/loongson/loongson-3/smp.c
index 1e88940..30b91e8 100644
--- a/arch/mips/loongson/loongson-3/smp.c
+++ b/arch/mips/loongson/loongson-3/smp.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from s390/perf_cpum_sf.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/s390/kernel/perf_cpum_sf.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c
index ea0c7b2..1cbd3c7 100644
--- a/arch/s390/kernel/perf_cpum_sf.c
+++ b/arch/s390/kernel/perf_cpum_sf.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from sparc/sysfs.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/sparc/kernel/sysfs.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/sparc/kernel/sysfs.c b/arch/sparc/kernel/sysfs.c
index 7f41d40..e15a4b8 100644
--- a/arch/sparc/kernel/sysfs.c
+++ b/arch/sparc/kernel/sysfs.c
@@ -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
--
2.0.0.rc2
Remove XXX_FROZEN state from rcu/tree.
Signed-off-by: Chen, Gong <[email protected]>
---
kernel/rcu/tree.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 625d0b0..8518338 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from kernel/profile.
Signed-off-by: Chen, Gong <[email protected]>
---
kernel/profile.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/kernel/profile.c b/kernel/profile.c
index 54bf5ba..22bca4b 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -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]) {
--
2.0.0.rc2
Remove XXX_FROZEN state from padata.
Signed-off-by: Chen, Gong <[email protected]>
---
kernel/padata.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/kernel/padata.c b/kernel/padata.c
index 161402f..3a6bc6e 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -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);
--
2.0.0.rc2
Remove XXX_FROZEN state from fs/relay.
Signed-off-by: Chen, Gong <[email protected]>
---
kernel/relay.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/kernel/relay.c b/kernel/relay.c
index 5a56d3c..3f7b6b1 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from kernel/smp.
Signed-off-by: Chen, Gong <[email protected]>
---
kernel/smp.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/kernel/smp.c b/kernel/smp.c
index 80c33f8..808ec06 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -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
--
2.0.0.rc2
Remove XXX_FROZEN state from kernel/timer.
Signed-off-by: Chen, Gong <[email protected]>
---
kernel/timer.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/kernel/timer.c b/kernel/timer.c
index 3bb01a3..cc11324 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -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
--
2.0.0.rc2
Remove XXX_FROZEN state from kernel/softirq.
Signed-off-by: Chen, Gong <[email protected]>
---
kernel/softirq.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 5918d22..c4d4484 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -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 */
--
2.0.0.rc2
Remove XXX_FROZEN state from mm/slab.
Signed-off-by: Chen, Gong <[email protected]>
---
mm/slab.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index 3070b92..5490528 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -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);
--
2.0.0.rc2
Remove XXX_FROZEN state from mm/vmscan.
Signed-off-by: Chen, Gong <[email protected]>
---
mm/vmscan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 0f16ffe..25c0109 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from mm/vmstat.
Signed-off-by: Chen, Gong <[email protected]>
---
mm/vmstat.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/mm/vmstat.c b/mm/vmstat.c
index b37bd49..a29a3d8 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from mm/page_alloc.
Signed-off-by: Chen, Gong <[email protected]>
---
mm/page_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0ea758b..c52c2a8 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -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);
--
2.0.0.rc2
Remove XXX_FROZEN state from mm/slub.
Signed-off-by: Chen, Gong <[email protected]>
---
mm/slub.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mm/slub.c b/mm/slub.c
index 7300480..0504f6b 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -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);
--
2.0.0.rc2
Remove XXX_FROZEN state from xfs/xfs_mount.
Signed-off-by: Chen, Gong <[email protected]>
---
fs/xfs/xfs_mount.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 3507cd0..b701946 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -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. */
--
2.0.0.rc2
Remove XXX_FROZEN state from net/iucv.
Signed-off-by: Chen, Gong <[email protected]>
---
net/iucv/iucv.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index da78793..4a44595 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -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);
--
2.0.0.rc2
Remove XXX_FROZEN state from net/core/flow.
Signed-off-by: Chen, Gong <[email protected]>
---
net/core/flow.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/core/flow.c b/net/core/flow.c
index a0348fd..3bb5dc0 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from net/core/dev.
Signed-off-by: Chen, Gong <[email protected]>
---
net/core/dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 7990984..2c3801a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -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();
--
2.0.0.rc2
Remove XXX_FROZEN state from block/blk-mq.
Signed-off-by: Chen, Gong <[email protected]>
---
block/blk-mq.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index ad69ef6..b5cd279 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -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);
--
2.0.0.rc2
Remove XXX_FROZEN state from block/blk-iopoll.
Signed-off-by: Chen, Gong <[email protected]>
---
block/blk-iopoll.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/blk-iopoll.c b/block/blk-iopoll.c
index 0736729..ba88c82 100644
--- a/block/blk-iopoll.c
+++ b/block/blk-iopoll.c
@@ -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();
--
2.0.0.rc2
Remove XXX_FROZEN state from block/blk-softirq.
Signed-off-by: Chen, Gong <[email protected]>
---
block/blk-softirq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/blk-softirq.c b/block/blk-softirq.c
index 53b1737..3ab9c2e 100644
--- a/block/blk-softirq.c
+++ b/block/blk-softirq.c
@@ -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();
--
2.0.0.rc2
Remove XXX_FROZEN state from driver/base/topology.
Signed-off-by: Chen, Gong <[email protected]>
---
drivers/base/topology.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index be7c1fb..369e437 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from powercap/intel_rapl.
Signed-off-by: Chen, Gong <[email protected]>
---
drivers/powercap/intel_rapl.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c
index b1cda6f..c55de1a 100644
--- a/drivers/powercap/intel_rapl.c
+++ b/drivers/powercap/intel_rapl.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from cpufreq/acpi-cpufreq.
Signed-off-by: Chen, Gong <[email protected]>
---
drivers/cpufreq/acpi-cpufreq.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index b0c18ed..2b7ffc1 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from irqchip/irq-armada-370-xp.
Signed-off-by: Chen, Gong <[email protected]>
---
drivers/irqchip/irq-armada-370-xp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 574aba0..1c46257 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from scsi/bnx2i_init.
Signed-off-by: Chen, Gong <[email protected]>
---
drivers/scsi/bnx2i/bnx2i_init.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
index 80c03b4..bd71179 100644
--- a/drivers/scsi/bnx2i/bnx2i_init.c
+++ b/drivers/scsi/bnx2i/bnx2i_init.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from cpuidle/cpuidle-pseries.
Signed-off-by: Chen, Gong <[email protected]>
---
drivers/cpuidle/cpuidle-pseries.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c
index 6f7b019..11902eb 100644
--- a/drivers/cpuidle/cpuidle-pseries.c
+++ b/drivers/cpuidle/cpuidle-pseries.c
@@ -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();
--
2.0.0.rc2
Remove XXX_FROZEN state from scsi/fcoe.
Signed-off-by: Chen, Gong <[email protected]>
---
drivers/scsi/fcoe/fcoe.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 00ee0ed..f1d3f6a 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from scsi/virtio_scsi.
Signed-off-by: Chen, Gong <[email protected]>
---
drivers/scsi/virtio_scsi.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 308256b..22f4a6e5 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -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:
--
2.0.0.rc2
Remove XXX_FROZEN state from kvm/arm/arch_timer.
Signed-off-by: Chen, Gong <[email protected]>
---
virt/kvm/arm/arch_timer.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
index 22fa819..169512d 100644
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from trace/ring_buffer.
Signed-off-by: Chen, Gong <[email protected]>
---
kernel/trace/ring_buffer.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index ff70271..1cd5793 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -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
--
2.0.0.rc2
Remove XXX_FROZEN state from lib/percpu_counter.
Signed-off-by: Chen, Gong <[email protected]>
---
lib/percpu_counter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c
index 7dd33577..9a833ea 100644
--- a/lib/percpu_counter.c
+++ b/lib/percpu_counter.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from lib/radix-tree.
Signed-off-by: Chen, Gong <[email protected]>
---
lib/radix-tree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 3291a8e..5f7231c 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -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,
--
2.0.0.rc2
Remove XXX_FROZEN state from lib/cpu-notifier-error-inject.
Signed-off-by: Chen, Gong <[email protected]>
---
lib/cpu-notifier-error-inject.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/cpu-notifier-error-inject.c b/lib/cpu-notifier-error-inject.c
index 707ca24..78c28db 100644
--- a/lib/cpu-notifier-error-inject.c
+++ b/lib/cpu-notifier-error-inject.c
@@ -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)},
{}
}
};
--
2.0.0.rc2
Remove XXX_FROZEN state from lustre/linux-cpu.
Signed-off-by: Chen, Gong <[email protected]>
---
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
index fc21210..0e061ca 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
@@ -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;
--
2.0.0.rc2
By now all usages of XXX_FROZEN have been removed. It can
be deleted safely.
Signed-off-by: Chen, Gong <[email protected]>
---
include/linux/cpu.h | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 95978ad..9de61cc 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -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? */
--
2.0.0.rc2
Remove XXX_FROZEN state from kvm/arm/vgic.
Signed-off-by: Chen, Gong <[email protected]>
---
virt/kvm/arm/vgic.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
index 56ff9be..f93b8c5 100644
--- a/virt/kvm/arm/vgic.c
+++ b/virt/kvm/arm/vgic.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from oprofile/timer_int.
Signed-off-by: Chen, Gong <[email protected]>
---
drivers/oprofile/timer_int.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/oprofile/timer_int.c b/drivers/oprofile/timer_int.c
index 61be1d9..ab5a0a9 100644
--- a/drivers/oprofile/timer_int.c
+++ b/drivers/oprofile/timer_int.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from md/raid5.
Signed-off-by: Chen, Gong <[email protected]>
---
drivers/md/raid5.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 6234b2e..3d76235 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -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:
--
2.0.0.rc2
Remove XXX_FROZEN state from scsi/bnx2fc_fcoe.
Signed-off-by: Chen, Gong <[email protected]>
---
drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 785d0d7..c56281d 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from irqchip/irq-gic.
Signed-off-by: Chen, Gong <[email protected]>
---
drivers/irqchip/irq-gic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 7c131cf..a8df097 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from cpuidle/cpuidle-powernv.
Signed-off-by: Chen, Gong <[email protected]>
---
drivers/cpuidle/cpuidle-powernv.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c
index 74f5788..78575a8 100644
--- a/drivers/cpuidle/cpuidle-powernv.c
+++ b/drivers/cpuidle/cpuidle-powernv.c
@@ -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();
--
2.0.0.rc2
Remove XXX_FROZEN state from clocksource/metag_generic.
Signed-off-by: Chen, Gong <[email protected]>
---
drivers/clocksource/metag_generic.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/clocksource/metag_generic.c b/drivers/clocksource/metag_generic.c
index 9e4db41..eefa164 100644
--- a/drivers/clocksource/metag_generic.c
+++ b/drivers/clocksource/metag_generic.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from fs/buffer.
Signed-off-by: Chen, Gong <[email protected]>
---
fs/buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index eba6e4f..47960b7 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from mm/memcontrol.
Signed-off-by: Chen, Gong <[email protected]>
---
mm/memcontrol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index a2c7bcb..871667d 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -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)
--
2.0.0.rc2
Remove XXX_FROZEN state from kernel/hrtimer.
Signed-off-by: Chen, Gong <[email protected]>
---
kernel/hrtimer.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 3ab2899..a37958e 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -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;
}
--
2.0.0.rc2
Remove XXX_FROZEN state from sched/core.
Signed-off-by: Chen, Gong <[email protected]>
---
kernel/sched/core.c | 55 ++++++++++++++++++++++++-----------------------------
1 file changed, 25 insertions(+), 30 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index bc1638b..f0aff5f 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from powermac/smp.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/powerpc/platforms/powermac/smp.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index 5cbd4d6..980605f 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from powerpc/mm/numa.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/powerpc/mm/numa.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 3b181b2..080ef52 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -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;
--
2.0.0.rc2
Remove XXX_FROZEN state from x86/microcode/core.
Signed-off-by: Chen, Gong <[email protected]>
---
arch/x86/kernel/cpu/microcode/core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index dd9d619..27e47be 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -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;
}
--
2.0.0.rc2
On Tue, Jul 22, 2014 at 09:58:37PM -0400, Chen, Gong wrote:
> 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.
>
> Signed-off-by: Thomas Gleixner <[email protected]>
> Signed-off-by: Chen, Gong <[email protected]>
Acked-by: Borislav Petkov <[email protected]>
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
On Tue, Jul 22, 2014 at 09:58:43PM -0400, Chen, Gong wrote:
> Remove XXX_FROZEN state from x86/intel_cacheinfo.
>
> Signed-off-by: Chen, Gong <[email protected]>
Acked-by: Borislav Petkov <[email protected]>
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
On Tue, Jul 22, 2014 at 09:58:44PM -0400, Chen, Gong wrote:
> Remove XXX_FROZEN state from mce/therm_throt.
>
> Signed-off-by: Chen, Gong <[email protected]>
Acked-by: Borislav Petkov <[email protected]>
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
On Tue, Jul 22, 2014 at 09:58:45PM -0400, Chen, Gong wrote:
> Remove XXX_FROZEN state from x86/mce_amd.
>
> Signed-off-by: Chen, Gong <[email protected]>
Acked-by: Borislav Petkov <[email protected]>
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
On Tue, Jul 22, 2014 at 09:58:46PM -0400, Chen, Gong wrote:
> Remove XXX_FROZEN state from kvm.
>
> Signed-off-by: Chen, Gong <[email protected]>
> ---
> arch/x86/kernel/kvm.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> index 3dd8e2c..22d472b 100644
> --- a/arch/x86/kernel/kvm.c
> +++ b/arch/x86/kernel/kvm.c
> @@ -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 ...
> - 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.
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
On Tue, Jul 22, 2014 at 09:58:47PM -0400, Chen, Gong wrote:
> Remove XXX_FROZEN state from x86/vsyscall_64.
>
> Signed-off-by: Chen, Gong <[email protected]>
Acked-by: Borislav Petkov <[email protected]>
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
On Tue, Jul 22, 2014 at 09:58:48PM -0400, Chen, Gong wrote:
> Remove XXX_FROZEN state from x86/pci/amd_bus.
>
> Signed-off-by: Chen, Gong <[email protected]>
> ---
> arch/x86/pci/amd_bus.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
> index c20d2cc..30f0fca9 100644
> --- a/arch/x86/pci/amd_bus.c
> +++ b/arch/x86/pci/amd_bus.c
> @@ -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:
Index: b/arch/x86/pci/amd_bus.c
===================================================================
--- a/arch/x86/pci/amd_bus.c 2014-07-23 20:04:44.074436425 +0200
+++ b/arch/x86/pci/amd_bus.c 2014-07-23 20:05:14.282436087 +0200
@@ -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;
}
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
On Wed, Jul 23, 2014 at 06:23:57PM +0200, Borislav Petkov wrote:
> Just remove the _FROZEN stuff and don't touch anything else.
Bah, nevermind, patch is correct.
Acked-by: Borislav Petkov <[email protected]>
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
On Tue, Jul 22, 2014 at 09:58:49PM -0400, Chen, Gong wrote:
> Remove XXX_FROZEN state from x86/x2apic_cluster.
>
> Signed-off-by: Chen, Gong <[email protected]>
> ---
> arch/x86/kernel/apic/x2apic_cluster.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
> index e66766b..bfd2369 100644
> --- a/arch/x86/kernel/apic/x2apic_cluster.c
> +++ b/arch/x86/kernel/apic/x2apic_cluster.c
> @@ -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;
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:
---
Index: b/arch/x86/kernel/apic/x2apic_cluster.c
===================================================================
--- a/arch/x86/kernel/apic/x2apic_cluster.c 2014-07-23 22:21:27.574344741 +0200
+++ b/arch/x86/kernel/apic/x2apic_cluster.c 2014-07-23 22:30:58.638338359 +0200
@@ -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;
}
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
On Wed, Jul 23, 2014 at 08:07:18PM +0200, Borislav Petkov wrote:
> 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)
>
> On Tue, Jul 22, 2014 at 09:58:48PM -0400, Chen, Gong wrote:
> > Remove XXX_FROZEN state from x86/pci/amd_bus.
> >
> > Signed-off-by: Chen, Gong <[email protected]>
> > ---
> > arch/x86/pci/amd_bus.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
> > index c20d2cc..30f0fca9 100644
> > --- a/arch/x86/pci/amd_bus.c
> > +++ b/arch/x86/pci/amd_bus.c
> > @@ -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:
>
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.
On Wed, Jul 23, 2014 at 09:31:30PM -0400, Chen, Gong wrote:
> 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.
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
On Tue, Jul 22, 2014 at 09:58:50PM -0400, Chen, Gong wrote:
> Remove XXX_FROZEN state from x86/microcode/core.
>
> Signed-off-by: Chen, Gong <[email protected]>
> ---
> arch/x86/kernel/cpu/microcode/core.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
> index dd9d619..27e47be 100644
> --- a/arch/x86/kernel/cpu/microcode/core.c
> +++ b/arch/x86/kernel/cpu/microcode/core.c
> @@ -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.
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
On Tue, Jul 22, 2014 at 09:58:51PM -0400, Chen, Gong wrote:
> Remove XXX_FROZEN state from x86/kernel/cpuid.
>
> Signed-off-by: Chen, Gong <[email protected]>
Acked-by: Borislav Petkov <[email protected]>
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
On Tue, Jul 22, 2014 at 09:58:52PM -0400, Chen, Gong wrote:
> Remove XXX_FROZEN state from x86/kernel/msr.
>
> Signed-off-by: Chen, Gong <[email protected]>
Acked-by: Borislav Petkov <[email protected]>
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
On Tue, Jul 22, 2014 at 09:58:36PM -0400, Chen, Gong wrote:
> 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 :-(
>
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.
On Thu, Jul 24, 2014 at 09:35:12PM -0400, Chen, Gong wrote:
> 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.
:-)
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
On Fri, Jul 25, 2014 at 09:10:25AM +0200, Borislav Petkov wrote:
> On Thu, Jul 24, 2014 at 09:35:12PM -0400, Chen, Gong wrote:
> > 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.
>
> :-)
>
> --
> Regards/Gruss,
> Boris.
>
Oh, I see. So Sorry for that.
On 22.07.14 21:58:36, Chen, Gong wrote:
> 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
On Fri, Jul 25, 2014 at 05:00:02PM +0200, Robert Richter wrote:
> > 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!
On Sun, Jul 27, 2014 at 02:36:43AM -0400, Chen, Gong wrote:
> 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]
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
On Thu, Jul 24, 2014 at 10:28:47AM +0200, Borislav Petkov wrote:
> On Wed, Jul 23, 2014 at 09:31:30PM -0400, Chen, Gong wrote:
> > 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.
Signed-off-by: Chen, Gong <[email protected]>
Suggested-by: Borislav Petkov <[email protected]>
---
arch/x86/pci/amd_bus.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
index c20d2cc..2d7c6c6 100644
--- a/arch/x86/pci/amd_bus.c
+++ b/arch/x86/pci/amd_bus.c
@@ -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;
}
--
2.0.0.rc2
On Wed, Jul 23, 2014 at 10:36:28PM +0200, Borislav Petkov wrote:
> 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.
Signed-off-by: Chen, Gong <[email protected]>
Suggested-by: Borislav Petkov <[email protected]>
---
arch/x86/kernel/apic/x2apic_cluster.c | 37 +++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 13 deletions(-)
diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
index e66766b..b8a6ea8 100644
--- a/arch/x86/kernel/apic/x2apic_cluster.c
+++ b/arch/x86/kernel/apic/x2apic_cluster.c
@@ -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);
}
--
2.0.0.rc2
On Thu, Jul 24, 2014 at 11:03:03AM +0200, Borislav Petkov wrote:
>
> 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.
Signed-off-by: Chen, Gong <[email protected]>
Suggested-by: Borislav Petkov <[email protected]>
---
arch/x86/kernel/cpu/microcode/core.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index dd9d619..da3c2206 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -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;
}
--
2.0.0.rc2
On 27.07.14 02:36:43, Chen, Gong wrote:
> On Fri, Jul 25, 2014 at 05:00:02PM +0200, Robert Richter wrote:
> > > 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!
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
On 22.07.14 21:59:41, Chen, Gong wrote:
> Remove XXX_FROZEN state from oprofile/timer_int.
>
> Signed-off-by: Chen, Gong <[email protected]>
Acked-by: Robert Richter <[email protected]>
> ---
> drivers/oprofile/timer_int.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/oprofile/timer_int.c b/drivers/oprofile/timer_int.c
> index 61be1d9..ab5a0a9 100644
> --- a/drivers/oprofile/timer_int.c
> +++ b/drivers/oprofile/timer_int.c
> @@ -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;
> }
> --
> 2.0.0.rc2
>
On Tue, 22 Jul 2014, Chen, Gong wrote:
> Remove XXX_FROZEN state from mm/slab.
Acked-by: Christoph Lameter <[email protected]>
On Tue, 22 Jul 2014, Chen, Gong wrote:
> Remove XXX_FROZEN state from mm/vmstat.
Acked-by: Christoph Lameter <[email protected]>
On Tue, 22 Jul 2014, Chen, Gong wrote:
> Remove XXX_FROZEN state from mm/slub.
Acked-by: Christoph Lameter <[email protected]>
On Mon, Jul 28, 2014 at 02:04:55AM -0400, Chen, Gong wrote:
> On Wed, Jul 23, 2014 at 10:36:28PM +0200, Borislav Petkov wrote:
> > 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.
>
> Signed-off-by: Chen, Gong <[email protected]>
> Suggested-by: Borislav Petkov <[email protected]>
> ---
> arch/x86/kernel/apic/x2apic_cluster.c | 37 +++++++++++++++++++++++------------
> 1 file changed, 24 insertions(+), 13 deletions(-)
>
> diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
> index e66766b..b8a6ea8 100644
> --- a/arch/x86/kernel/apic/x2apic_cluster.c
> +++ b/arch/x86/kernel/apic/x2apic_cluster.c
> @@ -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;
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.
> }
> 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) &&
What.. why?
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
On Tue, Jul 29, 2014 at 10:44:33AM +0200, Borislav Petkov wrote:
> > 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.
>
> Go and reread Documentation/SubmittingPatches, section 3 in particular.
>
Copy that.
> > + if (test_and_clear_bit(CPU_TASKS_FROZEN, &action) &&
>
> What.. why?
>
Sorry for that.
On Wed, Jul 23, 2014 at 10:36:28PM +0200, Borislav Petkov wrote:
> /*
> * 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;
> + }
> +
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;
+ }
+
On Wed, Jul 30, 2014 at 02:24:15AM -0400, Chen, Gong wrote:
> On Wed, Jul 23, 2014 at 10:36:28PM +0200, Borislav Petkov wrote:
> > /*
> > * 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;
> > + }
> > +
> Hi, Boris
>
> 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.
> 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;
No, this is different now from the original logic.
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
On Wed, Jul 30, 2014 at 10:48:52AM +0200, Borislav Petkov wrote:
> 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.
>
> > 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;
>
> 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 :-)).
On Thu, Jul 31, 2014 at 03:52:34AM -0400, Chen, Gong wrote:
> 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.
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--