Commit e4aa7f8
KVM: Disable CPU hotplug during hardware enabling/disabling
Disable CPU hotplug when enabling/disabling hardware to prevent the
corner case where if the following sequence occurs:
1. A hotplugged CPU marks itself online in cpu_online_mask
2. The hotplugged CPU enables interrupt before invoking KVM's ONLINE
callback
3 hardware_{en,dis}able_all() is invoked on another CPU
the hotplugged CPU will be included in on_each_cpu() and thus get sent
through hardware_{en,dis}able_nolock() before kvm_online_cpu() is called.
start_secondary { ...
set_cpu_online(smp_processor_id(), true); <- 1
...
local_irq_enable(); <- 2
...
cpu_startup_entry(CPUHP_AP_ONLINE_IDLE); <- 3
}
KVM currently fudges around this race by keeping track of which CPUs have
done hardware enabling (see commit 1b6c016 "KVM: Keep track of which
cpus have virtualization enabled"), but that's an inefficient, convoluted,
and hacky solution.
Signed-off-by: Chao Gao <[email protected]>
[sean: split to separate patch, write changelog]
Signed-off-by: Sean Christopherson <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>1 parent aaf12a7 commit e4aa7f8
2 files changed
+22
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9296 | 9296 | | |
9297 | 9297 | | |
9298 | 9298 | | |
9299 | | - | |
| 9299 | + | |
| 9300 | + | |
| 9301 | + | |
| 9302 | + | |
| 9303 | + | |
| 9304 | + | |
| 9305 | + | |
| 9306 | + | |
| 9307 | + | |
| 9308 | + | |
9300 | 9309 | | |
9301 | 9310 | | |
9302 | 9311 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5167 | 5167 | | |
5168 | 5168 | | |
5169 | 5169 | | |
| 5170 | + | |
5170 | 5171 | | |
5171 | 5172 | | |
5172 | 5173 | | |
| 5174 | + | |
5173 | 5175 | | |
5174 | 5176 | | |
5175 | 5177 | | |
5176 | 5178 | | |
5177 | 5179 | | |
5178 | 5180 | | |
| 5181 | + | |
| 5182 | + | |
| 5183 | + | |
| 5184 | + | |
| 5185 | + | |
| 5186 | + | |
| 5187 | + | |
| 5188 | + | |
| 5189 | + | |
5179 | 5190 | | |
5180 | 5191 | | |
5181 | 5192 | | |
| |||
5190 | 5201 | | |
5191 | 5202 | | |
5192 | 5203 | | |
| 5204 | + | |
5193 | 5205 | | |
5194 | 5206 | | |
5195 | 5207 | | |
| |||
0 commit comments