Commit ce5d244
KVM: arm64: Destroy mpidr_data for 'late' vCPU creation
A particularly annoying userspace could create a vCPU after KVM has
computed mpidr_data for the VM, either by racing against VGIC
initialization or having a userspace irqchip.
In any case, this means mpidr_data no longer fully describes the VM, and
attempts to find the new vCPU with kvm_mpidr_to_vcpu() will fail. The
fix is to discard mpidr_data altogether, as it is only a performance
optimization and not required for correctness. In all likelihood KVM
will recompute the mappings when KVM_RUN is called on the new vCPU.
Note that reads of mpidr_data are not guarded by a lock; promote to RCU
to cope with the possibility of mpidr_data being invalidated at runtime.
Fixes: 54a8006 ("KVM: arm64: Fast-track kvm_mpidr_to_vcpu() when mpidr_data is available")
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20240508071952.2035422-1-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org>1 parent 5053c3f commit ce5d244
1 file changed
Lines changed: 41 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
198 | 215 | | |
199 | 216 | | |
200 | 217 | | |
| |||
209 | 226 | | |
210 | 227 | | |
211 | 228 | | |
212 | | - | |
| 229 | + | |
| 230 | + | |
213 | 231 | | |
214 | 232 | | |
215 | 233 | | |
| |||
395 | 413 | | |
396 | 414 | | |
397 | 415 | | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
398 | 423 | | |
399 | 424 | | |
400 | 425 | | |
| |||
594 | 619 | | |
595 | 620 | | |
596 | 621 | | |
597 | | - | |
| 622 | + | |
| 623 | + | |
598 | 624 | | |
599 | 625 | | |
600 | 626 | | |
| |||
631 | 657 | | |
632 | 658 | | |
633 | 659 | | |
634 | | - | |
| 660 | + | |
635 | 661 | | |
636 | 662 | | |
637 | 663 | | |
| |||
2470 | 2496 | | |
2471 | 2497 | | |
2472 | 2498 | | |
2473 | | - | |
| 2499 | + | |
| 2500 | + | |
2474 | 2501 | | |
2475 | 2502 | | |
2476 | 2503 | | |
2477 | 2504 | | |
2478 | | - | |
2479 | | - | |
| 2505 | + | |
| 2506 | + | |
2480 | 2507 | | |
2481 | | - | |
2482 | | - | |
| 2508 | + | |
| 2509 | + | |
| 2510 | + | |
| 2511 | + | |
2483 | 2512 | | |
2484 | 2513 | | |
| 2514 | + | |
2485 | 2515 | | |
| 2516 | + | |
| 2517 | + | |
| 2518 | + | |
2486 | 2519 | | |
2487 | | - | |
2488 | 2520 | | |
2489 | 2521 | | |
2490 | 2522 | | |
| |||
0 commit comments