Commit 1760537b authored by Gerald Schaefer's avatar Gerald Schaefer Committed by Martin Schwidefsky

[S390] appldata: prevent cpu hotplug when walking cpu_online_map.

Use get_online_cpus() to prevent cpu hotplug in situations where
for_each_online_cpu() is called.
Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 67060d9c
...@@ -130,6 +130,7 @@ static void appldata_work_fn(struct work_struct *work) ...@@ -130,6 +130,7 @@ static void appldata_work_fn(struct work_struct *work)
P_DEBUG(" -= Work Queue =-\n"); P_DEBUG(" -= Work Queue =-\n");
i = 0; i = 0;
get_online_cpus();
spin_lock(&appldata_ops_lock); spin_lock(&appldata_ops_lock);
list_for_each(lh, &appldata_ops_list) { list_for_each(lh, &appldata_ops_list) {
ops = list_entry(lh, struct appldata_ops, list); ops = list_entry(lh, struct appldata_ops, list);
...@@ -140,6 +141,7 @@ static void appldata_work_fn(struct work_struct *work) ...@@ -140,6 +141,7 @@ static void appldata_work_fn(struct work_struct *work)
} }
} }
spin_unlock(&appldata_ops_lock); spin_unlock(&appldata_ops_lock);
put_online_cpus();
} }
/* /*
...@@ -266,12 +268,14 @@ appldata_timer_handler(ctl_table *ctl, int write, struct file *filp, ...@@ -266,12 +268,14 @@ appldata_timer_handler(ctl_table *ctl, int write, struct file *filp,
len = *lenp; len = *lenp;
if (copy_from_user(buf, buffer, len > sizeof(buf) ? sizeof(buf) : len)) if (copy_from_user(buf, buffer, len > sizeof(buf) ? sizeof(buf) : len))
return -EFAULT; return -EFAULT;
get_online_cpus();
spin_lock(&appldata_timer_lock); spin_lock(&appldata_timer_lock);
if (buf[0] == '1') if (buf[0] == '1')
__appldata_vtimer_setup(APPLDATA_ADD_TIMER); __appldata_vtimer_setup(APPLDATA_ADD_TIMER);
else if (buf[0] == '0') else if (buf[0] == '0')
__appldata_vtimer_setup(APPLDATA_DEL_TIMER); __appldata_vtimer_setup(APPLDATA_DEL_TIMER);
spin_unlock(&appldata_timer_lock); spin_unlock(&appldata_timer_lock);
put_online_cpus();
out: out:
*lenp = len; *lenp = len;
*ppos += len; *ppos += len;
...@@ -314,10 +318,12 @@ appldata_interval_handler(ctl_table *ctl, int write, struct file *filp, ...@@ -314,10 +318,12 @@ appldata_interval_handler(ctl_table *ctl, int write, struct file *filp,
return -EINVAL; return -EINVAL;
} }
get_online_cpus();
spin_lock(&appldata_timer_lock); spin_lock(&appldata_timer_lock);
appldata_interval = interval; appldata_interval = interval;
__appldata_vtimer_setup(APPLDATA_MOD_TIMER); __appldata_vtimer_setup(APPLDATA_MOD_TIMER);
spin_unlock(&appldata_timer_lock); spin_unlock(&appldata_timer_lock);
put_online_cpus();
P_INFO("Monitoring CPU interval set to %u milliseconds.\n", P_INFO("Monitoring CPU interval set to %u milliseconds.\n",
interval); interval);
...@@ -556,8 +562,10 @@ static int __init appldata_init(void) ...@@ -556,8 +562,10 @@ static int __init appldata_init(void)
return -ENOMEM; return -ENOMEM;
} }
get_online_cpus();
for_each_online_cpu(i) for_each_online_cpu(i)
appldata_online_cpu(i); appldata_online_cpu(i);
put_online_cpus();
/* Register cpu hotplug notifier */ /* Register cpu hotplug notifier */
register_hotcpu_notifier(&appldata_nb); register_hotcpu_notifier(&appldata_nb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment