Hi I was looking at Thomas' "CPU hotplug rework - episode I" series [1] and noted the CPU_*_FROZEN bits in there.
In 2007 CPU_TASK_FROZEN was introduced to allow subsystem to distinguish between normal CPU hotplug events and CPU hotplug events under system-wide suspend or resume operations [2]. As it turns out almost no subsystem is interested in this information. So this begs the question why having the additional complexity in the CPU state handling instead of having an explicit function for retrieving this information. Here and attempt to rip out CPU_TASKS_FROZEN bits. Overall I think it is worth doing so but you might see it differently. FWIW, the image size is slightly smaller too in my sample configuration. text data bss dec hex filename 16794542 4462208 14954496 36211246 2288a2e vmlinux 16794267 4462208 14954496 36210971 228891b vmlinux-wo-frozen Patch 1: I think this patch fixes a real bug. Even Paul agreed during a chat at LinuxCon. He needed an addition state to and grabbed just one of the FROZEN ones. Patch 2: Adds a new freeze_active() call which tells if PM is active or not. Patch 3, 4 and 5: Update the only users of FROZEN. Patch 6: Is the refactoring patch from Thomas hotplug rework [1]. Patch 7: Remove all FROZEN references. It should contain only simple changes. I did that manually. Probably some scripting could be done to ensure the changes are more correct. This patch could be spitted and the pieces could be applied one after the other. Patch 8: Get rid of the definitions of FROZEN. Patch 9: And finally update the documentation. I starred at this code for while and compiled it for different architectures (x86, ARM, S390, powerpc). I also tested by executing Steven's stress-cpu-hotplug script and then do suspend-resume cycles. Nothing exploded but that is not a real proof all is okay. So please have a close look at the changes on the FROZEN users. Thanks, Daniel [1] https://lwn.net/Articles/535764/ [2] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=8bb7844286fb8c9fce6f65d8288aeb09d03a5e0d "H. Peter Anvin" <[email protected]> "Paul E. McKenney" <[email protected]> "Rafael J. Wysocki" <[email protected]> Akinobu Mita <[email protected]> Andrew Morton <[email protected]> Boris Ostrovsky <[email protected]> Borislav Petkov <[email protected]> Chris Metcalf <[email protected]> Daniel Wagner <[email protected]> David Hildenbrand <[email protected]> David Vrabel <[email protected]> Don Zickus <[email protected]> Greg Kroah-Hartman <[email protected]> Ingo Molnar <[email protected]> John Hubbard <[email protected]> Jonathan Corbet <[email protected]> Konrad Rzeszutek Wilk <[email protected]> Lai Jiangshan <[email protected]> Len Brown <[email protected]> Luis R. Rodriguez <[email protected]> Mathias Krause <[email protected]> Nicolas Iooss <[email protected]> Paul Gortmaker <[email protected]> Pavel Machek <[email protected]> Peter Zijlstra <[email protected]> Sudeep Holla <[email protected]> Thomas Gleixner <[email protected]> Tony Luck <[email protected]> Vitaly Kuznetsov <[email protected]> Daniel Wagner (8): smpboot: Add a separate CPU state when a surviving CPU times out suspend: Add getter function to report if freezing is active x86: Use freeze_active() instead of CPU_*_FROZEN smpboot: Use freeze_active() instead CPU_DEAD_FROZEN state information sched: Use freeze_active() instead CPU_*_FROZEN state information cpu: Remove unused CPU_*_FROZEN states cpu: Do not set CPU_TASKS_FROZEN anymore doc: Update cpu-hotplug documents on removal of CPU_TASKS_FROZEN Thomas Gleixner (1): cpu: Restructure FROZEN state handling Documentation/cpu-hotplug.txt | 12 ++-- .../fault-injection/notifier-error-inject.txt | 2 - Documentation/power/suspend-and-cpuhotplug.txt | 13 +--- arch/arm/kernel/hw_breakpoint.c | 2 +- arch/arm/kernel/perf_event.c | 2 +- arch/arm/kernel/smp_twd.c | 2 +- arch/arm/kvm/arm.c | 1 - arch/arm/mm/cache-l2x0.c | 2 +- arch/arm/vfp/vfpmodule.c | 4 +- arch/arm64/kernel/armv8_deprecated.c | 2 +- arch/arm64/kernel/fpsimd.c | 1 - arch/blackfin/kernel/perf_event.c | 2 +- arch/ia64/kernel/err_inject.c | 2 - arch/ia64/kernel/mca.c | 1 - arch/ia64/kernel/palinfo.c | 2 - arch/ia64/kernel/salinfo.c | 2 - arch/ia64/kernel/topology.c | 2 - arch/metag/kernel/perf/perf_event.c | 2 +- arch/mips/loongson64/loongson-3/smp.c | 3 - arch/mips/oprofile/op_model_loongson3.c | 2 - arch/powerpc/kernel/sysfs.c | 2 - arch/powerpc/mm/mmu_context_nohash.c | 3 - arch/powerpc/mm/numa.c | 3 - arch/powerpc/perf/core-book3s.c | 2 +- arch/powerpc/platforms/powermac/smp.c | 2 - arch/s390/kernel/perf_cpum_cf.c | 2 +- arch/s390/kernel/perf_cpum_sf.c | 3 +- arch/s390/kernel/smp.c | 2 +- arch/s390/mm/fault.c | 2 +- arch/sh/kernel/perf_event.c | 2 +- arch/sparc/kernel/sysfs.c | 2 - arch/x86/entry/vdso/vma.c | 2 +- arch/x86/kernel/apic/x2apic_cluster.c | 1 - arch/x86/kernel/cpu/mcheck/mce.c | 15 ++--- arch/x86/kernel/cpu/mcheck/mce_amd.c | 2 - arch/x86/kernel/cpu/mcheck/therm_throt.c | 3 - arch/x86/kernel/cpu/microcode/core.c | 12 ++-- arch/x86/kernel/cpu/perf_event.c | 2 +- arch/x86/kernel/cpu/perf_event_amd_ibs.c | 2 +- arch/x86/kernel/cpu/perf_event_amd_uncore.c | 2 +- arch/x86/kernel/cpu/perf_event_intel_cqm.c | 2 +- arch/x86/kernel/cpu/perf_event_intel_rapl.c | 2 +- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 4 +- arch/x86/kernel/cpuid.c | 1 - arch/x86/kernel/kvm.c | 2 - arch/x86/kernel/msr.c | 1 - arch/x86/pci/amd_bus.c | 1 - arch/x86/xen/smp.c | 2 +- arch/xtensa/kernel/perf_event.c | 2 +- block/blk-iopoll.c | 2 +- block/blk-mq.c | 5 +- block/blk-softirq.c | 2 +- drivers/acpi/processor_driver.c | 1 - drivers/base/cacheinfo.c | 2 +- drivers/base/topology.c | 3 - drivers/bus/arm-cci.c | 2 +- drivers/bus/arm-ccn.c | 2 +- drivers/bus/mips_cdmm.c | 2 +- drivers/clocksource/arm_arch_timer.c | 2 +- drivers/clocksource/arm_global_timer.c | 2 +- drivers/clocksource/dummy_timer.c | 2 +- drivers/clocksource/exynos_mct.c | 2 +- drivers/clocksource/metag_generic.c | 1 - drivers/clocksource/mips-gic-timer.c | 2 +- drivers/clocksource/qcom-timer.c | 2 +- drivers/clocksource/time-armada-370-xp.c | 2 +- drivers/clocksource/timer-atlas7.c | 2 +- drivers/cpufreq/acpi-cpufreq.c | 2 - drivers/cpufreq/cpufreq.c | 2 +- drivers/cpuidle/coupled.c | 4 +- drivers/cpuidle/cpuidle-powernv.c | 2 - drivers/cpuidle/cpuidle-pseries.c | 2 - drivers/hwtracing/coresight/coresight-etm3x.c | 2 +- drivers/hwtracing/coresight/coresight-etm4x.c | 2 +- drivers/idle/intel_idle.c | 2 +- drivers/irqchip/irq-armada-370-xp.c | 4 +- drivers/irqchip/irq-gic-v3.c | 2 +- drivers/irqchip/irq-gic.c | 2 +- drivers/irqchip/irq-hip04.c | 2 +- drivers/leds/trigger/ledtrig-cpu.c | 2 +- drivers/md/raid5.c | 2 - drivers/net/virtio_net.c | 2 +- drivers/oprofile/timer_int.c | 2 - drivers/pci/host/pci-xgene-msi.c | 2 - drivers/powercap/intel_rapl.c | 3 - drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 2 - drivers/scsi/bnx2i/bnx2i_init.c | 2 - drivers/scsi/fcoe/fcoe.c | 2 - drivers/scsi/virtio_scsi.c | 2 - .../staging/lustre/lustre/libcfs/linux/linux-cpu.c | 4 +- fs/buffer.c | 2 +- include/linux/cpu.h | 17 +---- include/linux/suspend.h | 6 ++ kernel/cpu.c | 74 ++++++++-------------- kernel/events/core.c | 2 +- kernel/padata.c | 4 -- kernel/profile.c | 4 -- kernel/rcu/tree.c | 5 -- kernel/relay.c | 2 - kernel/sched/core.c | 59 +++++++++-------- kernel/sched/fair.c | 2 +- kernel/smp.c | 6 +- kernel/smpboot.c | 34 +++++----- kernel/softirq.c | 1 - kernel/time/hrtimer.c | 2 - kernel/time/tick-sched.c | 2 +- kernel/time/timer.c | 1 - kernel/trace/ring_buffer.c | 2 - kernel/workqueue.c | 4 +- lib/cpu-notifier-error-inject.c | 2 - lib/percpu_counter.c | 2 +- lib/radix-tree.c | 2 +- mm/memcontrol.c | 2 +- mm/page-writeback.c | 2 +- mm/page_alloc.c | 2 +- mm/slab.c | 6 -- mm/slub.c | 2 - mm/vmscan.c | 2 +- mm/vmstat.c | 4 -- net/core/dev.c | 2 +- net/core/flow.c | 2 - net/iucv/iucv.c | 6 -- virt/kvm/arm/arch_timer.c | 2 - virt/kvm/arm/vgic.c | 2 - virt/kvm/kvm_main.c | 1 - 125 files changed, 172 insertions(+), 333 deletions(-) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

