cpu-hotplug: introduce cpu_notify(), __cpu_notify(), cpu_notify_nofail()
Subsystems (14)
PATCH 1/12 cpu-hotplug: introduce cpu_notify(), __cpu_notify(), cpu_notify_nofail()
No functional change.
These are just wrappers of raw_cpu_notifier_call_chain.
--- kernel/cpu.c | 55 ++++++++++++++++++++++++++++++++----------------------- 1 files changed, 32 insertions(+), 23 deletions(-)
kernel/cpu.c +32 -23
@@ -133,6 +133,26 @@ int __ref register_cpu_notifier(struct notifier_block *nb)return ret; } +static int __cpu_notify (unsigned long val,void *v,int nr_to_call, +int *nr_calls) +{ +return __raw_notifier_call_chain (&cpu_chain, val, v, nr_to_call, + nr_calls); +} + +static int cpu_notify (unsigned long val,void *v) +{ +return __cpu_notify (val, v,-1 ,NULL ); +} + +static void cpu_notify_nofail (unsigned long val,void *v) +{ +int err; + + err =cpu_notify (val, v); +BUG_ON (err ==NOTIFY_BAD ); +} +#ifdef CONFIG_HOTPLUG_CPU EXPORT_SYMBOL (register_cpu_notifier);
@@ -178,8 +198,7 @@ static int __ref take_cpu_down(void *_param)if (err <0 )return err; -raw_notifier_call_chain (&cpu_chain,CPU_DYING | param->mod, - param->hcpu); +cpu_notify (CPU_DYING | param->mod, param->hcpu);/* Force idle task to run as soon as we yield: it should immediately notice cpu is offline and die quickly. */
@@ -210,14 +229,12 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)cpu_hotplug_begin ();set_cpu_active (cpu, false); - err =__raw_notifier_call_chain (&cpu_chain,CPU_DOWN_PREPARE | mod, - hcpu,-1 , &nr_calls); + err =__cpu_notify (CPU_DOWN_PREPARE | mod, hcpu,-1 , &nr_calls);if (err ==NOTIFY_BAD ) {set_cpu_active (cpu, true); nr_calls--; -__raw_notifier_call_chain (&cpu_chain,CPU_DOWN_FAILED | mod, - hcpu, nr_calls,NULL ); +__cpu_notify (CPU_DOWN_FAILED | mod, hcpu, nr_calls,NULL );printk ("%s: attempt to take down CPU %u failed\n" , __func__, cpu); err = -EINVAL ;
@@ -232,9 +249,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)if (err) {set_cpu_active (cpu, true);/* CPU didn't die: tell everyone. Can't complain. */ -if (raw_notifier_call_chain (&cpu_chain,CPU_DOWN_FAILED | mod, - hcpu) ==NOTIFY_BAD ) -BUG (); +cpu_notify_nofail (CPU_DOWN_FAILED | mod, hcpu); goto out_allowed; }
@@ -248,9 +263,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)__cpu_die (cpu);/* CPU is completely dead: tell everyone. Too late to complain. */ -if (raw_notifier_call_chain (&cpu_chain,CPU_DEAD | mod, - hcpu) ==NOTIFY_BAD ) -BUG (); +cpu_notify_nofail (CPU_DEAD | mod, hcpu);check_for_tasks (cpu);
@@ -258,11 +271,9 @@ out_allowed:set_cpus_allowed_ptr (current, old_allowed); out_release:cpu_hotplug_done (); -if (!err) { -if (raw_notifier_call_chain (&cpu_chain,CPU_POST_DEAD | mod, - hcpu) ==NOTIFY_BAD ) -BUG (); - } +if (!err) +cpu_notify_nofail (CPU_POST_DEAD | mod, hcpu); +free_cpumask_var (old_allowed);return err; }
@@ -302,8 +313,7 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)return -EINVAL ;cpu_hotplug_begin (); - ret =__raw_notifier_call_chain (&cpu_chain,CPU_UP_PREPARE | mod, hcpu, --1 , &nr_calls); + ret =__cpu_notify (CPU_UP_PREPARE | mod, hcpu,-1 , &nr_calls);if (ret ==NOTIFY_BAD ) { nr_calls--; printk("%s: attempt to bring up CPU %u failed\n",
@@ -321,12 +331,11 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)set_cpu_active (cpu, true);/* Now call notifier in preparation. */ -raw_notifier_call_chain (&cpu_chain,CPU_ONLINE | mod, hcpu); +cpu_notify (CPU_ONLINE | mod, hcpu); out_notify:if (ret !=0 ) -__raw_notifier_call_chain (&cpu_chain, -CPU_UP_CANCELED | mod, hcpu, nr_calls,NULL ); +__cpu_notify (CPU_UP_CANCELED | mod, hcpu, nr_calls,NULL );cpu_hotplug_done ();return ret;
@@ -466,7 +475,7 @@ void __cpuinit notify_cpu_starting(unsigned int cpu)if (frozen_cpus !=NULL &&cpumask_test_cpu (cpu, frozen_cpus)) val =CPU_STARTING_FROZEN ;#endif /* CONFIG_PM_SLEEP_SMP */ - raw_notifier_call_chain(&cpu_chain, val, (void *)(long)cpu); + cpu_notify(val, (void *)(long)cpu); }#endif /* CONFIG_SMP */
Signature · 1 line
1.6.0.6
PATCH 2/12 cpu-hotplug: return better errno on cpu hotplug failure
Currently, onlining or offlining a CPU failure by one of the cpu notifiers error always cause -EINVAL error.
(i.e. writing 0 or 1 to /sys/devices/system/cpu/cpuX/online gets EINVAL)
To get better error reporting rather than always getting -EINVAL, This changes cpu_notify() to return -errno value with notifier_to_errno() and fix the callers. Now that cpu notifiers can return encapsulate errno value.
Currently, all cpu hotplug notifiers return NOTIFY_OK, NOTIFY_BAD, or NOTIFY_DONE. So cpu_notify() can returns 0 or -EPERM with this change for now.
(notifier_to_errno(NOTIFY_OK) == 0, notifier_to_errno(NOTIFY_DONE) == 0, notifier_to_errno(NOTIFY_BAD) == -EPERM)
Forthcoming patches convert several cpu notifiers to return encapsulate errno value with notifier_from_errno().
--- kernel/cpu.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
kernel/cpu.c +8 -6
@@ -136,8 +136,12 @@ int __ref register_cpu_notifier(struct notifier_block *nb)static int __cpu_notify (unsigned long val,void *v,int nr_to_call,int *nr_calls) { -return __raw_notifier_call_chain (&cpu_chain, val, v, nr_to_call, +int ret; + + ret =__raw_notifier_call_chain (&cpu_chain, val, v, nr_to_call, nr_calls); + +return notifier_to_errno (ret); }static int cpu_notify (unsigned long val,void *v)
@@ -150,7 +154,7 @@ static void cpu_notify_nofail(unsigned long val, void *v)int err; err =cpu_notify (val, v); -BUG_ON (err ==NOTIFY_BAD ); +BUG_ON (err); }#ifdef CONFIG_HOTPLUG_CPU
@@ -230,14 +234,13 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)cpu_hotplug_begin ();set_cpu_active (cpu, false); err =__cpu_notify (CPU_DOWN_PREPARE | mod, hcpu,-1 , &nr_calls); -if (err ==NOTIFY_BAD ) { +if (err) {set_cpu_active (cpu, true); nr_calls--;__cpu_notify (CPU_DOWN_FAILED | mod, hcpu, nr_calls,NULL );printk ("%s: attempt to take down CPU %u failed\n" , __func__, cpu); - err = -EINVAL ; goto out_release; }
@@ -314,11 +317,10 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)cpu_hotplug_begin (); ret =__cpu_notify (CPU_UP_PREPARE | mod, hcpu,-1 , &nr_calls); -if (ret ==NOTIFY_BAD ) { +if (ret) { nr_calls--;printk ("%s: attempt to bring up CPU %u failed\n" , __func__, cpu); - ret = -EINVAL ; goto out_notify; }
Signature · 1 line
1.6.0.6
PATCH 3/12 notifier: change notifier_from_errno(0) to return NOTIFY_OK
In reply to Akinobu MitaThis changes notifier_from_errno(0) to be NOTIFY_OK instead of NOTIFY_STOP_MASK | NOTIFY_OK.
Currently, the notifiers which return encapsulated errno value have to do something like this:
err = do_something(); // returns -errno if (err) return notifier_from_errno(err); else return NOTIFY_OK;
This change makes the above code simple:
err = do_something(); // returns -errno return return notifier_from_errno(err);
--- include/linux/notifier.h | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
include/linux/notifier.h +4 -1
@@ -164,7 +164,10 @@ extern int __srcu_notifier_call_chain(struct srcu_notifier_head *nh,/* Encapsulate (negative) errno value (in particular, NOTIFY_BAD <=> EPERM). */ static inline int notifier_from_errno (int err) { -return NOTIFY_STOP_MASK | (NOTIFY_OK - err); +if (err) +return NOTIFY_STOP_MASK | (NOTIFY_OK - err); + +return NOTIFY_OK ; }/* Restore (negative) errno value from notify return value. */
Signature · 1 line
1.6.0.6
PATCH 4/12 x86: convert cpu notifier to return encapsulate errno value
In reply to Akinobu MitaBy the previous modification, the cpu notifier can return encapsulate errno value. This converts the cpu notifiers for msr, cpuid, and therm_throt.
--- arch/x86/kernel/cpu/mcheck/therm_throt.c | 2 +- arch/x86/kernel/cpuid.c | 2 +- arch/x86/kernel/msr.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/mcheck/therm_throt.c +1 -1
@@ -190,7 +190,7 @@ thermal_throttle_cpu_callback(struct notifier_block *nfb,mutex_unlock (&therm_cpu_lock);break ; } -return err ?NOTIFY_BAD :NOTIFY_OK ; +return notifier_from_errno (err); } static struct notifier_block thermal_throttle_cpu_notifier __cpuinitdata =
arch/x86/kernel/cpuid.c +1 -1
@@ -169,7 +169,7 @@ static int __cpuinit cpuid_class_cpu_callback(struct notifier_block *nfb,cpuid_device_destroy (cpu);break ; } -return err ?NOTIFY_BAD :NOTIFY_OK ; +return notifier_from_errno (err); } static struct notifier_block __refdata cpuid_class_cpu_notifier =
arch/x86/kernel/msr.c +1 -1
@@ -229,7 +229,7 @@ static int __cpuinit msr_class_cpu_callback(struct notifier_block *nfb,msr_device_destroy (cpu);break ; } -return err ?NOTIFY_BAD :NOTIFY_OK ; +return notifier_from_errno (err); }static struct notifier_block __refdata msr_class_cpu_notifier = {
Signature · 1 line
1.6.0.6
PATCH 5/12 topology: convert cpu notifier to return encapsulate errno value
In reply to Akinobu MitaBy the previous modification, the cpu notifier can return encapsulate errno value. This converts the cpu notifiers for topology.
--- drivers/base/topology.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/base/topology.c +1 -1
@@ -162,7 +162,7 @@ static int __cpuinit topology_cpu_callback(struct notifier_block *nfb,topology_remove_dev (cpu);break ; } -return rc ?NOTIFY_BAD :NOTIFY_OK ; +return notifier_from_errno (rc); }static int __cpuinit topology_sysfs_init (void )
Signature · 1 line
1.6.0.6
PATCH 6/12 kernel/: convert cpu notifier to return encapsulate errno value
In reply to Akinobu MitaBy the previous modification, the cpu notifier can return encapsulate errno value. This converts the cpu notifiers for kernel/*.c
--- kernel/padata.c | 4 ++-- kernel/profile.c | 4 ++-- kernel/relay.c | 2 +- kernel/sched.c | 2 +- kernel/smp.c | 2 +- kernel/softirq.c | 2 +- kernel/softlockup.c | 2 +- kernel/timer.c | 7 +++++-- kernel/workqueue.c | 9 +++++---- 9 files changed, 19 insertions(+), 15 deletions(-)
kernel/padata.c +2 -2
@@ -587,7 +587,7 @@ static int __cpuinit padata_cpu_callback(struct notifier_block *nfb, err =__padata_add_cpu (pinst, cpu);mutex_unlock (&pinst->lock);if (err) -return NOTIFY_BAD ; +return notifier_from_errno (err);break ;case CPU_DOWN_PREPARE :
@@ -598,7 +598,7 @@ static int __cpuinit padata_cpu_callback(struct notifier_block *nfb, err =__padata_remove_cpu (pinst, cpu);mutex_unlock (&pinst->lock);if (err) -return NOTIFY_BAD ; +return notifier_from_errno (err);break ;case CPU_UP_CANCELED :
kernel/profile.c +2 -2
@@ -370,7 +370,7 @@ static int __cpuinit profile_cpu_callback(struct notifier_block *info,GFP_KERNEL | __GFP_ZERO, 0);if (!page) -return NOTIFY_BAD ; +return notifier_from_errno (-ENOMEM );per_cpu (cpu_profile_hits, cpu)[1 ] =page_address (page); }if (!per_cpu (cpu_profile_hits, cpu)[0 ]) {
@@ -386,7 +386,7 @@ out_free: page =virt_to_page (per_cpu (cpu_profile_hits, cpu)[1 ]);per_cpu (cpu_profile_hits, cpu)[1 ] =NULL ;__free_page (page); -return NOTIFY_BAD ; +return notifier_from_errno (-ENOMEM );case CPU_ONLINE :case CPU_ONLINE_FROZEN :if (prof_cpu_mask !=NULL )
kernel/relay.c +1 -1
@@ -539,7 +539,7 @@ static int __cpuinit relay_hotcpu_callback(struct notifier_block *nb,"relay_hotcpu_callback: cpu %d buffer " "creation failed\n", hotcpu);mutex_unlock (&relay_channels_mutex); -return NOTIFY_BAD ; +return notifier_from_errno (-ENOMEM ); } }mutex_unlock (&relay_channels_mutex);
kernel/sched.c +1 -1
@@ -5887,7 +5887,7 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)case CPU_UP_PREPARE_FROZEN : p =kthread_create (migration_thread, hcpu,"migration/%d" , cpu);if (IS_ERR (p)) -return NOTIFY_BAD ; +return notifier_from_errno (PTR_ERR (p));kthread_bind (p, cpu);/* Must be high prio: stop_machine expects to yield to it. */ rq =task_rq_lock (p, &flags);
kernel/smp.c +1 -1
@@ -51,7 +51,7 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)case CPU_UP_PREPARE_FROZEN :if (!zalloc_cpumask_var_node (&cfd->cpumask,GFP_KERNEL ,cpu_to_node (cpu))) -return NOTIFY_BAD ; +return notifier_from_errno (-ENOMEM );break ;#ifdef CONFIG_HOTPLUG_CPU
kernel/softirq.c +1 -1
@@ -808,7 +808,7 @@ static int __cpuinit cpu_callback(struct notifier_block *nfb, p =kthread_create (run_ksoftirqd, hcpu,"ksoftirqd/%d" , hotcpu);if (IS_ERR (p)) {printk ("ksoftirqd for %i failed\n" , hotcpu); -return NOTIFY_BAD ; +return notifier_from_errno (PTR_ERR (p)); }kthread_bind (p, hotcpu);per_cpu (ksoftirqd, hotcpu) = p;
kernel/softlockup.c +1 -1
@@ -228,7 +228,7 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) p =kthread_create (watchdog, hcpu,"watchdog/%d" , hotcpu);if (IS_ERR (p)) {printk (KERN_ERR "watchdog for %i failed\n" , hotcpu); -return NOTIFY_BAD ; +return notifier_from_errno (PTR_ERR (p)); }per_cpu (softlockup_touch_ts, hotcpu) =0 ;per_cpu (softlockup_watchdog, hotcpu) = p;
kernel/timer.c +5 -2
@@ -1618,11 +1618,14 @@ static int __cpuinit timer_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) { long cpu = (long)hcpu; +int err; +switch (action) {case CPU_UP_PREPARE :case CPU_UP_PREPARE_FROZEN : -if (init_timers_cpu (cpu) <0 ) -return NOTIFY_BAD ; + err =init_timers_cpu (cpu); +if (err <0 ) +return notifier_from_errno (err);break ;#ifdef CONFIG_HOTPLUG_CPU case CPU_DEAD :
kernel/workqueue.c +5 -4
@@ -1076,7 +1076,7 @@ static int __devinit workqueue_cpu_callback(struct notifier_block *nfb,unsigned int cpu = (unsigned long )hcpu;struct cpu_workqueue_struct *cwq;struct workqueue_struct *wq; -int ret =NOTIFY_OK ; +int err =0 ; action &= ~CPU_TASKS_FROZEN ;
@@ -1090,12 +1090,13 @@ undo:switch (action) {case CPU_UP_PREPARE : -if (!create_workqueue_thread (cwq, cpu)) + err =create_workqueue_thread (cwq, cpu); +if (!err)break ;printk (KERN_ERR "workqueue [%s] for %i failed\n" , wq->name, cpu); action =CPU_UP_CANCELED ; - ret =NOTIFY_BAD ; + err = -ENOMEM ; goto undo;case CPU_ONLINE :
@@ -1116,7 +1117,7 @@ undo:cpumask_clear_cpu (cpu, cpu_populated_map); } -return ret; +return notifier_from_errno (err); }#ifdef CONFIG_SMP
Signature · 1 line
1.6.0.6
PATCH 7/12 slab: convert cpu notifier to return encapsulate errno value
In reply to Akinobu MitaBy the previous modification, the cpu notifier can return encapsulate errno value. This converts the cpu notifiers for slab.
--- mm/slab.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
mm/slab.c +1 -1
@@ -1324,7 +1324,7 @@ static int __cpuinit cpuup_callback(struct notifier_block *nfb,mutex_unlock (&cache_chain_mutex);break ; } -return err ?NOTIFY_BAD :NOTIFY_OK ; +return notifier_from_errno (err); }static struct notifier_block __cpuinitdata cpucache_notifier = {
Signature · 7 lines
1.6.0.6 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 07/12] slab: convert cpu notifier to return encapsulate errno value
Quoted 5 lines · Akinobu Mita
By the previous modification, the cpu notifier can return encapsulate errno value. This converts the cpu notifiers for slab.
Signed-off-by Akinobu Mita <[email protected]>Cc Christoph Lameter <[email protected]>
Quoted 22 lines
Cc Matt Mackall <[email protected]>---
mm/slab.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)mm/slab.c +1
-2@@ -1324,7 +1324,7 @@ static int __cpuinit cpuup_callback(struct notifier_block *nfb, mutex_unlock(&cache_chain_mutex); break; } - return err ? NOTIFY_BAD : NOTIFY_OK; + return notifier_from_errno(err); } static struct notifier_block __cpuinitdata cpucache_notifier = { --1.6.0.6
Quoted 6 lines
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 8/12 iucv: convert cpu notifier to return encapsulate errno value
In reply to Akinobu MitaBy the previous modification, the cpu notifier can return encapsulate errno value. This converts the cpu notifiers for iucv.
--- net/iucv/iucv.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
net/iucv/iucv.c +5 -4
@@ -632,13 +632,14 @@ static int __cpuinit iucv_cpu_notify(struct notifier_block *self, iucv_irq_data[cpu] =kmalloc_node (sizeof (struct iucv_irq_data ),GFP_KERNEL |GFP_DMA ,cpu_to_node (cpu));if (!iucv_irq_data[cpu]) -return NOTIFY_BAD ; +return notifier_from_errno (-ENOMEM ); + iucv_param[cpu] =kmalloc_node (sizeof (union iucv_param ),GFP_KERNEL |GFP_DMA ,cpu_to_node (cpu));if (!iucv_param[cpu]) {kfree (iucv_irq_data[cpu]); iucv_irq_data[cpu] =NULL ; -return NOTIFY_BAD ; +return notifier_from_errno (-ENOMEM ); } iucv_param_irq[cpu] =kmalloc_node (sizeof (union iucv_param ),GFP_KERNEL |GFP_DMA ,cpu_to_node (cpu));
@@ -647,7 +648,7 @@ static int __cpuinit iucv_cpu_notify(struct notifier_block *self, iucv_param[cpu] =NULL ;kfree (iucv_irq_data[cpu]); iucv_irq_data[cpu] =NULL ; -return NOTIFY_BAD ; +return notifier_from_errno (-ENOMEM ); }break ;case CPU_UP_CANCELED :
@@ -677,7 +678,7 @@ static int __cpuinit iucv_cpu_notify(struct notifier_block *self,cpu_clear (cpu, cpumask);if (cpus_empty (cpumask))/* Can't offline last IUCV enabled cpu. */ -return NOTIFY_BAD ; +return notifier_from_errno (-EINVAL );smp_call_function_single (cpu, iucv_retrieve_cpu,NULL ,1 );if (cpus_empty (iucv_irq_cpumask)) smp_call_function_single(first_cpu(iucv_buffer_cpumask),
Signature · 1 line
1.6.0.6
PATCH 9/12 ehca: convert cpu notifier to return encapsulate errno value
In reply to Akinobu MitaBy the previous modification, the cpu notifier can return encapsulate errno value. This converts the cpu notifiers for ehca.
--- drivers/infiniband/hw/ehca/ehca_irq.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/infiniband/hw/ehca/ehca_irq.c +1 -1
@@ -845,7 +845,7 @@ static int __cpuinit comp_pool_callback(struct notifier_block *nfb,ehca_gen_dbg ("CPU: %x (CPU_PREPARE)" , cpu);if (!create_comp_task (pool, cpu)) {ehca_gen_err ("Can't create comp_task for cpu: %x" , cpu); -return NOTIFY_BAD ; +return notifier_from_errno (-ENOMEM ); }break ;case CPU_UP_CANCELED :
Signature · 1 line
1.6.0.6
Re: [PATCH 09/12] ehca: convert cpu notifier to return encapsulate errno value
Quoted 7 lines · On Thu, 18 Mar 2010 18:05:21 +0900 Akinobu Mita…
By the previous modification, the cpu notifier can return encapsulate errno value. This converts the cpu notifiers for ehca.
Signed-off-by Akinobu Mita <[email protected]>Cc Hoang-Nam Nguyen <[email protected]>Cc Christoph Raisch <[email protected]>
Quoted 9 lines
--- drivers/infiniband/hw/ehca/ehca_irq.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/infiniband/hw/ehca/ehca_irq.c +0
-0
drivers/infiniband/hw/ehca/ehca_irq.c static int __cpuinit comp_pool_callback(struct notifier_block *nfb, · line 851
Quoted 8 lines
drivers/infiniband/hw/ehca/ehca_irq.c +1
-1@@ -845,7 +845,7 @@ static int __cpuinit comp_pool_callback(struct notifier_block *nfb,ehca_gen_dbg ("CPU: %x (CPU_PREPARE)" , cpu);if (!create_comp_task (pool, cpu)) {ehca_gen_err ("Can't create comp_task for cpu: %x" , cpu); -return NOTIFY_BAD ; +return notifier_from_errno (-ENOMEM ); }break ;case CPU_UP_CANCELED :
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 10/12 s390: convert cpu notifier to return encapsulate errno value
In reply to Akinobu MitaBy the previous modification, the cpu notifier can return encapsulate errno value. This converts the cpu notifiers for s390.
--- arch/s390/kernel/smp.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
arch/s390/kernel/smp.c +3 -3
@@ -943,21 +943,21 @@ static int __cpuinit smp_cpu_notify(struct notifier_block *self,struct cpu *c = &per_cpu (cpu_devices, cpu);struct sys_device *s = &c->sysdev;struct s390_idle_data *idle; +int err =0 ;switch (action) {case CPU_ONLINE :case CPU_ONLINE_FROZEN : idle = &per_cpu (s390_idle, cpu);memset (idle,0 ,sizeof (struct s390_idle_data )); -if (sysfs_create_group (&s->kobj, &cpu_online_attr_group)) -return NOTIFY_BAD ; + err =sysfs_create_group (&s->kobj, &cpu_online_attr_group);break ;case CPU_DEAD :case CPU_DEAD_FROZEN :sysfs_remove_group (&s->kobj, &cpu_online_attr_group);break ; } -return NOTIFY_OK ; +return notifier_from_errno (err); }static struct notifier_block __cpuinitdata smp_cpu_nb = {
Signature · 1 line
1.6.0.6
PATCH 11/12 md: convert cpu notifier to return encapsulate errno value
In reply to Akinobu MitaBy the previous modification, the cpu notifier can return encapsulate errno value. This converts the cpu notifiers for raid5.
--- drivers/md/raid5.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/md/raid5.c +1 -1
@@ -4659,7 +4659,7 @@ static int raid456_cpu_notify(struct notifier_block *nfb, unsigned long action,kfree (percpu->scribble);pr_err ("%s: failed memory allocation for cpu%ld\n" , __func__, cpu); -return NOTIFY_BAD ; +return notifier_from_errno (-ENOMEM ); }break ;case CPU_DEAD :
Signature · 1 line
1.6.0.6
PATCH 12/12 add CPU notifier error injection module
In reply to Akinobu MitaI used this module to test the series of modification to the cpu notifiers code.
Example1: inject CPU offline error (-1 == -EPERM)
# modprobe cpu-notifier-error-inject cpu_down_prepare_error=-1 # echo 0 > /sys/devices/system/cpu/cpu1/online0 bash: echo: write error: Operation not permitted
Example2: inject CPU online error (-2 == -ENOENT)
# modprobe cpu-notifier-error-inject cpu_up_prepare_error=-2 # echo 1 > /sys/devices/system/cpu/cpu1/online0 bash: echo: write error: No such file or directory
--- lib/Kconfig.debug | 12 +++++++ lib/Makefile | 1 + lib/cpu-notifier-error-inject.c | 63 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 0 deletions(-) create mode 100644 lib/cpu-notifier-error-inject.c
lib/Kconfig.debug +12 -0
@@ -885,6 +885,18 @@ config LKDTM Documentation on how to use the module can be found in Documentation/fault-injection/provoke-crashes.txt +config CPU_NOTIFIER_ERROR_INJECT + tristate "CPU notifier error injection module" + depends on HOTPLUG_CPU && DEBUG_KERNEL + help + This option provides a kernel module that can be used to test + the error handling of the cpu notifiers + + To compile this code as a module, choose M here: the module will + be called cpu-notify-inject. + + If unsure, say N. + config FAULT_INJECTION bool "Fault-injection framework" depends on DEBUG_KERNEL
lib/Makefile +1 -0
@@ -82,6 +82,7 @@ obj-$(CONFIG_AUDIT_GENERIC) += audit.o obj-$(CONFIG_SWIOTLB) += swiotlb.o obj-$(CONFIG_IOMMU_HELPER) += iommu-helper.o obj-$(CONFIG_FAULT_INJECTION) += fault-inject.o +obj-$(CONFIG_CPU_NOTIFIER_ERROR_INJECT) += cpu-notifier-error-inject.o lib-$(CONFIG_GENERIC_BUG) += bug.o
lib/cpu-notifier-error-inject.c new file +63 -0
63 lines not on this page · raw message
Signature · 1 line
1.6.0.6
Andrew Morton
maintainerRe: [PATCH 12/12] add CPU notifier error injection module
Quoted 22 lines · On Thu, 18 Mar 2010 18:05:24 +0900 Akinobu Mita <[email protected]> wrote:
I used this module to test the series of modification to the cpu notifiers code.
Example1: inject CPU offline error (-1 ==
-EPERM)# modprobe cpu-notifier-error-inject cpu_down_prepare_error=-1 # echo 0 > /sys/devices/system/cpu/cpu1/online0 bash: echo: write error: Operation not permittedExample2: inject CPU online error (-2 ==
-ENOENT)# modprobe cpu-notifier-error-inject cpu_up_prepare_error=-2 # echo 1 > /sys/devices/system/cpu/cpu1/online0 bash: echo: write error: No such file or directory...
lib/Kconfig.debug +0
-0@@ -885,6 +885,18 @@ config LKDTM Documentation on how to use the module can be found in Documentation/fault-injection/provoke-crashes.txt
lib/Kconfig.debug config LKDTM · line 896
Quoted 10 lines
lib/Kconfig.debug +9
-0+config CPU_NOTIFIER_ERROR_INJECT + tristate "CPU notifier error injection module" + depends on HOTPLUG_CPU && DEBUG_KERNEL + help + This option provides a kernel module that can be used to test + the error handling of the cpu notifiers + + To compile this code as a module, choose M here: the module will + be called cpu-notify-inject.
Should be "cpu-notifier-error-inject", yes?
Quoted 5 lines
lib/Kconfig.debug +2
-0+ If unsure, say N. + config FAULT_INJECTION bool "Fault-injection framework" depends on DEBUG_KERNEL
Re: [PATCH 12/12] add CPU notifier error injection module
2010/3/23 Andrew Morton <[email protected]>:
Quoted 26 lines
Quoted 23 lines · On Thu, 18 Mar 2010 18:05:24 +0900 Akinobu Mita <[email protected]> wrote:
I used this module to test the series of modification to the cpu notifiers code.
Example1: inject CPU offline error (-1 ==
-EPERM)# modprobe cpu-notifier-error-inject cpu_down_prepare_error=-1 # echo 0 > /sys/devices/system/cpu/cpu1/online0 bash: echo: write error: Operation not permittedExample2: inject CPU online error (-2 ==
-ENOENT)# modprobe cpu-notifier-error-inject cpu_up_prepare_error=-2 # echo 1 > /sys/devices/system/cpu/cpu1/online0 bash: echo: write error: No such file or directory...
lib/Kconfig.debug +0
-0@@ -885,6 +885,18 @@ config LKDTMDocumentation on how to use the module can be found in
Documentation/fault-injection/provoke-crashes.txt
Quoted 11 lines
lib/Kconfig.debug config LKDTM · line 896
Quoted 9 lines
lib/Kconfig.debug +9
-0+config CPU_NOTIFIER_ERROR_INJECT + tristate "CPU notifier error injection module" + depends on HOTPLUG_CPU && DEBUG_KERNEL + help + This option provides a kernel module that can be used to test + the error handling of the cpu notifiers + + To compile this code as a module, choose M here: the module will + be called cpu-notify-inject.Should be "cpu-notifier-error-inject", yes?
Yes. Thanks for spotting and fixing.
And I had another typos in the above patch description:
Quoted 4 lines
Quoted 4 lines
Example1: inject CPU offline error (-1 ==
-EPERM)# modprobe cpu-notifier-error-inject cpu_down_prepare_error=-1 # echo 0 > /sys/devices/system/cpu/cpu1/online0
# echo 0 > /sys/devices/system/cpu/cpu1/online
(s/online0/online/)
Quoted 6 lines
Quoted 6 lines
bash: echo: write error: Operation not permitted
Example2: inject CPU online error (-2 ==
-ENOENT)# modprobe cpu-notifier-error-inject cpu_up_prepare_error=-2 # echo 1 > /sys/devices/system/cpu/cpu1/online0
Ditto.
Quoted 1 line
Quoted 1 line
bash: echo: write error: No such file or directory