diff options
Diffstat (limited to 'arch/s390/kernel/smp.c')
-rw-r--r-- | arch/s390/kernel/smp.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 0dfa988c1b26..0aeb290060d9 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -505,7 +505,7 @@ out: | |||
505 | return rc; | 505 | return rc; |
506 | } | 506 | } |
507 | 507 | ||
508 | static int smp_rescan_cpus(void) | 508 | static int __smp_rescan_cpus(void) |
509 | { | 509 | { |
510 | cpumask_t avail; | 510 | cpumask_t avail; |
511 | 511 | ||
@@ -570,7 +570,7 @@ out: | |||
570 | kfree(info); | 570 | kfree(info); |
571 | printk(KERN_INFO "CPUs: %d configured, %d standby\n", c_cpus, s_cpus); | 571 | printk(KERN_INFO "CPUs: %d configured, %d standby\n", c_cpus, s_cpus); |
572 | get_online_cpus(); | 572 | get_online_cpus(); |
573 | smp_rescan_cpus(); | 573 | __smp_rescan_cpus(); |
574 | put_online_cpus(); | 574 | put_online_cpus(); |
575 | } | 575 | } |
576 | 576 | ||
@@ -890,8 +890,8 @@ static ssize_t cpu_configure_store(struct sys_device *dev, const char *buf, | |||
890 | if (val != 0 && val != 1) | 890 | if (val != 0 && val != 1) |
891 | return -EINVAL; | 891 | return -EINVAL; |
892 | 892 | ||
893 | mutex_lock(&smp_cpu_state_mutex); | ||
894 | get_online_cpus(); | 893 | get_online_cpus(); |
894 | mutex_lock(&smp_cpu_state_mutex); | ||
895 | rc = -EBUSY; | 895 | rc = -EBUSY; |
896 | if (cpu_online(cpu)) | 896 | if (cpu_online(cpu)) |
897 | goto out; | 897 | goto out; |
@@ -919,8 +919,8 @@ static ssize_t cpu_configure_store(struct sys_device *dev, const char *buf, | |||
919 | break; | 919 | break; |
920 | } | 920 | } |
921 | out: | 921 | out: |
922 | put_online_cpus(); | ||
923 | mutex_unlock(&smp_cpu_state_mutex); | 922 | mutex_unlock(&smp_cpu_state_mutex); |
923 | put_online_cpus(); | ||
924 | return rc ? rc : count; | 924 | return rc ? rc : count; |
925 | } | 925 | } |
926 | static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store); | 926 | static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store); |
@@ -1088,17 +1088,17 @@ out: | |||
1088 | } | 1088 | } |
1089 | 1089 | ||
1090 | #ifdef CONFIG_HOTPLUG_CPU | 1090 | #ifdef CONFIG_HOTPLUG_CPU |
1091 | static ssize_t __ref rescan_store(struct sys_device *dev, | 1091 | |
1092 | const char *buf, size_t count) | 1092 | int smp_rescan_cpus(void) |
1093 | { | 1093 | { |
1094 | cpumask_t newcpus; | 1094 | cpumask_t newcpus; |
1095 | int cpu; | 1095 | int cpu; |
1096 | int rc; | 1096 | int rc; |
1097 | 1097 | ||
1098 | mutex_lock(&smp_cpu_state_mutex); | ||
1099 | get_online_cpus(); | 1098 | get_online_cpus(); |
1099 | mutex_lock(&smp_cpu_state_mutex); | ||
1100 | newcpus = cpu_present_map; | 1100 | newcpus = cpu_present_map; |
1101 | rc = smp_rescan_cpus(); | 1101 | rc = __smp_rescan_cpus(); |
1102 | if (rc) | 1102 | if (rc) |
1103 | goto out; | 1103 | goto out; |
1104 | cpus_andnot(newcpus, cpu_present_map, newcpus); | 1104 | cpus_andnot(newcpus, cpu_present_map, newcpus); |
@@ -1109,10 +1109,19 @@ static ssize_t __ref rescan_store(struct sys_device *dev, | |||
1109 | } | 1109 | } |
1110 | rc = 0; | 1110 | rc = 0; |
1111 | out: | 1111 | out: |
1112 | put_online_cpus(); | ||
1113 | mutex_unlock(&smp_cpu_state_mutex); | 1112 | mutex_unlock(&smp_cpu_state_mutex); |
1113 | put_online_cpus(); | ||
1114 | if (!cpus_empty(newcpus)) | 1114 | if (!cpus_empty(newcpus)) |
1115 | topology_schedule_update(); | 1115 | topology_schedule_update(); |
1116 | return rc; | ||
1117 | } | ||
1118 | |||
1119 | static ssize_t __ref rescan_store(struct sys_device *dev, const char *buf, | ||
1120 | size_t count) | ||
1121 | { | ||
1122 | int rc; | ||
1123 | |||
1124 | rc = smp_rescan_cpus(); | ||
1116 | return rc ? rc : count; | 1125 | return rc ? rc : count; |
1117 | } | 1126 | } |
1118 | static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store); | 1127 | static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store); |
@@ -1139,16 +1148,16 @@ static ssize_t dispatching_store(struct sys_device *dev, const char *buf, | |||
1139 | if (val != 0 && val != 1) | 1148 | if (val != 0 && val != 1) |
1140 | return -EINVAL; | 1149 | return -EINVAL; |
1141 | rc = 0; | 1150 | rc = 0; |
1142 | mutex_lock(&smp_cpu_state_mutex); | ||
1143 | get_online_cpus(); | 1151 | get_online_cpus(); |
1152 | mutex_lock(&smp_cpu_state_mutex); | ||
1144 | if (cpu_management == val) | 1153 | if (cpu_management == val) |
1145 | goto out; | 1154 | goto out; |
1146 | rc = topology_set_cpu_management(val); | 1155 | rc = topology_set_cpu_management(val); |
1147 | if (!rc) | 1156 | if (!rc) |
1148 | cpu_management = val; | 1157 | cpu_management = val; |
1149 | out: | 1158 | out: |
1150 | put_online_cpus(); | ||
1151 | mutex_unlock(&smp_cpu_state_mutex); | 1159 | mutex_unlock(&smp_cpu_state_mutex); |
1160 | put_online_cpus(); | ||
1152 | return rc ? rc : count; | 1161 | return rc ? rc : count; |
1153 | } | 1162 | } |
1154 | static SYSDEV_ATTR(dispatching, 0644, dispatching_show, dispatching_store); | 1163 | static SYSDEV_ATTR(dispatching, 0644, dispatching_show, dispatching_store); |