Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 1880

kernel-2.6.18-238.el5.src.rpm

From: Eduardo Habkost <ehabkost@redhat.com>
Date: Thu, 24 Sep 2009 13:46:27 -0300
Subject: [misc] define CPU_DYING and CPU_DYING_FROZEN
Message-id: 1253810790-11195-2-git-send-email-ehabkost@redhat.com
O-Subject: [RHEL-5.5 PATCH 1/4] Define CPU_DYING and CPU_DYING_FROZEN
Bugzilla: 510814
RH-Acked-by: Juan Quintela <quintela@redhat.com>

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=510814

This patch adds the CPU_DYING and CPU_DYING_FROZEN defines, that
will be used to a new kind of CPU hotplug notifiers.

This is part of upstream commit dd91b132a2ee92db0d3d374cdb91c302fbab8f23, that
implements the CPU_DYING notifier. But this patch contains only the new
#defines, so we can make the existing callbacks ready to the new notifier
before implementing it, to keep the tree bisectable.

As we are adding a new CPU notifier that is called in atomic context, I have
checked all the existing CPU hotplug callbacks for code that can't be run on
atomic context, that is run before checking for the 'action' argument. The
result is below.

The following CPU hotplug callbacks need to be fixed to allow them to be called
from atomic context, and are fixed on this series:

  kernel/cpuset.c cpuset_handle_cpuhp()
  Uses: mutex_lock(), mutex_unlock()
  (mutex calls fixed on this series)

  arch/i386/kernel/cpu/mcheck/therm_throt.c thermal_throttle_cpu_callback()
  Uses: get_cpu_sysdev(), mutex_lock(), mutex_unlock()
  (mutex calls fixed on this series)

The following CPU hotplug callbacks use some macros and functions before
checking for the 'action' parameter, but they are safe to be called from atomic
context:

  arch/i386/kernel/cpu/intel_cacheinfo.c cacheinfo_cpu_callback()
  Uses: get_cpu_sysdev()

  arch/ia64/kernel/topology.c cache_cpu_callback()
  Uses: get_cpu_sysdev()

  arch/s390/kernel/smp.c smp_cpu_notify()
  Uses: per_cpu()

  drivers/base/topology.c topology_cpu_callback()
  Uses: get_cpu_sysdev()

  drivers/cpufreq/cpufreq.c cpufreq_cpu_callback()
  Uses: get_cpu_sysdev()

  fs/xfs/xfs_mount.c xfs_icsb_cpu_notify()
  Uses: container_of(), per_cpu_ptr()

  mm/page-writeback.c ratelimit_handler()
  Uses: set_ratelimit()

  mm/slab.c cpuup_callback()
  Uses: cpu_to_node()

  mm/swap.c cpu_swap_callback()
  Uses: per_cpu()

Finally, the following CPU hotplug callbacks don't use any macro or function
outside a check for the 'action' value:

  arch/i386/kernel/cpuid.c cpuid_class_cpu_callback()
  arch/i386/kernel/msr.c msr_class_cpu_callback()
  arch/ia64/kernel/irq_ia64.c unbind_evtchn_callback()
  arch/ia64/kernel/mca.c mca_cpu_callback()
  arch/ia64/kernel/palinfo.c palinfo_cpu_callback()
  arch/ia64/kernel/salinfo.c salinfo_cpu_callback()
  arch/ia64/xen/hypervisor.c p2m_expose_dtr_call()
  arch/powerpc/kernel/sysfs.c sysfs_cpu_notify()
  arch/powerpc/mm/numa.c cpu_numa_callback()
  arch/s390/appldata/appldata_base.c appldata_cpu_notify()
  arch/x86_64/kernel/mce.c mce_cpu_callback()
  arch/x86_64/kernel/mce_amd.c threshold_cpu_callback()
  arch/x86_64/kernel/time.c time_cpu_notifier()
  block/ll_rw_blk.c blk_cpu_notify()
  drivers/cpufreq/cpufreq_stats.c cpufreq_stat_cpu_callback()
  drivers/infiniband/hw/ehca/ehca_irq.c comp_pool_callback()
  drivers/scsi/fcoe/fcoe.c fcoe_cpu_callback()
  drivers/xen/core/cpu_hotplug.c smpboot_cpu_notify()
  fs/buffer.c buffer_cpu_notify()
  kernel/hrtimer.c hrtimer_cpu_notify()
  kernel/profile.c profile_cpu_callback()
  kernel/rcupdate.c rcu_cpu_notify()
  kernel/relay.c relay_hotcpu_callback()
  kernel/sched.c migration_call()
  kernel/sched.c update_sched_domains()
  kernel/softirq.c cpu_callback()
  kernel/softlockup.c cpu_callback()
  kernel/timer.c timer_cpu_notify()
  kernel/workqueue.c workqueue_cpu_callback()
  lib/radix-tree.c radix_tree_callback()
  mm/page_alloc.c pageset_cpuup_callback()
  mm/page_alloc.c page_alloc_cpu_notify()
  mm/vmscan.c cpu_callback()
  mm/vmstat.c vmstat_cpuup_callback()
  net/core/dev.c dev_cpu_callback()
  net/core/flow.c flow_cache_cpu()
  net/iucv/iucv.c iucv_cpu_notify()

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 1ec5e05..55a2c2f 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -154,6 +154,8 @@ extern int raw_notifier_call_chain(struct raw_notifier_head *,
 #define CPU_DOWN_PREPARE	0x0005 /* CPU (unsigned)v going down */
 #define CPU_DOWN_FAILED		0x0006 /* CPU (unsigned)v NOT going down */
 #define CPU_DEAD		0x0007 /* CPU (unsigned)v dead */
+#define CPU_DYING		0x000A /* CPU (unsigned)v not running any task,
+				        * not handling interrupts, soon dead */
 
 /* Used for CPU hotplug events occuring while tasks are frozen due to a suspend
  * operation in progress
@@ -162,6 +164,7 @@ extern int raw_notifier_call_chain(struct raw_notifier_head *,
 
 #define CPU_ONLINE_FROZEN	(CPU_ONLINE | CPU_TASKS_FROZEN)
 #define CPU_DEAD_FROZEN		(CPU_DEAD | CPU_TASKS_FROZEN)
+#define CPU_DYING_FROZEN	(CPU_DYING | CPU_TASKS_FROZEN)
 
 #endif /* __KERNEL__ */
 #endif /* _LINUX_NOTIFIER_H */