Commit 6889125
committed
cpufreq/powernow-k8: workqueue user shouldn't migrate the kworker to another CPU
powernowk8_target() runs off a per-cpu work item and if the
cpufreq_policy->cpu is different from the current one, it migrates the
kworker to the target CPU by manipulating current->cpus_allowed. The
function migrates the kworker back to the original CPU but this is
still broken. Workqueue concurrency management requires the kworkers
to stay on the same CPU and powernowk8_target() ends up triggerring
BUG_ON(rq != this_rq()) in try_to_wake_up_local() if it contends on
fidvid_mutex and sleeps.
It is unclear why this bug is being reported now. Duncan says it
appeared to be a regression of 3.6-rc1 and couldn't reproduce it on
3.5. Bisection seemed to point to 63d95a9 "workqueue: use @pool
instead of @gcwq or @cpu where applicable" which is an non-functional
change. Given that the reproduce case sometimes took upto days to
trigger, it's easy to be misled while bisecting. Maybe something made
contention on fidvid_mutex more likely? I don't know.
This patch fixes the bug by using work_on_cpu() instead if @pol->cpu
isn't the same as the current one. The code assumes that
cpufreq_policy->cpu is kept online by the caller, which Rafael tells
me is the case.
stable: ed48ece ("workqueue: reimplement work_on_cpu() using
system_wq") should be applied before this; otherwise, the
behavior could be horrible.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Duncan <1i5t5.duncan@cox.net>
Tested-by: Duncan <1i5t5.duncan@cox.net>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: stable@vger.kernel.org
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=473011 parent ed48ece commit 6889125
1 file changed
Lines changed: 34 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
| |||
1139 | 1138 | | |
1140 | 1139 | | |
1141 | 1140 | | |
1142 | | - | |
1143 | | - | |
1144 | | - | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
1145 | 1148 | | |
1146 | | - | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
1147 | 1153 | | |
1148 | 1154 | | |
1149 | 1155 | | |
1150 | 1156 | | |
1151 | | - | |
| 1157 | + | |
1152 | 1158 | | |
1153 | 1159 | | |
1154 | 1160 | | |
1155 | 1161 | | |
1156 | 1162 | | |
1157 | 1163 | | |
1158 | 1164 | | |
1159 | | - | |
1160 | | - | |
1161 | | - | |
1162 | | - | |
1163 | | - | |
1164 | | - | |
1165 | | - | |
1166 | | - | |
1167 | | - | |
1168 | | - | |
1169 | | - | |
1170 | | - | |
1171 | | - | |
1172 | 1165 | | |
1173 | 1166 | | |
1174 | | - | |
| 1167 | + | |
1175 | 1168 | | |
1176 | 1169 | | |
1177 | 1170 | | |
1178 | 1171 | | |
1179 | 1172 | | |
1180 | 1173 | | |
1181 | | - | |
| 1174 | + | |
1182 | 1175 | | |
1183 | 1176 | | |
1184 | 1177 | | |
| |||
1196 | 1189 | | |
1197 | 1190 | | |
1198 | 1191 | | |
1199 | | - | |
| 1192 | + | |
1200 | 1193 | | |
1201 | 1194 | | |
1202 | 1195 | | |
| |||
1209 | 1202 | | |
1210 | 1203 | | |
1211 | 1204 | | |
1212 | | - | |
1213 | 1205 | | |
1214 | | - | |
| 1206 | + | |
1215 | 1207 | | |
1216 | 1208 | | |
1217 | 1209 | | |
| |||
1220 | 1212 | | |
1221 | 1213 | | |
1222 | 1214 | | |
1223 | | - | |
1224 | 1215 | | |
1225 | | - | |
1226 | | - | |
1227 | | - | |
1228 | | - | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
1229 | 1234 | | |
1230 | 1235 | | |
1231 | 1236 | | |
| |||
0 commit comments