Commit f5238c2
committed
KVM: x86/mmu: Check for usable TDP MMU root while holding mmu_lock for read
When allocating a new TDP MMU root, check for a usable root while holding
mmu_lock for read and only acquire mmu_lock for write if a new root needs
to be created. There is no need to serialize other MMU operations if a
vCPU is simply grabbing a reference to an existing root, holding mmu_lock
for write is "necessary" (spoiler alert, it's not strictly necessary) only
to ensure KVM doesn't end up with duplicate roots.
Allowing vCPUs to get "new" roots in parallel is beneficial to VM boot and
to setups that frequently delete memslots, i.e. which force all vCPUs to
reload all roots.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sean Christopherson <[email protected]>1 parent d746182 commit f5238c2
3 files changed
+55
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3693 | 3693 | | |
3694 | 3694 | | |
3695 | 3695 | | |
| 3696 | + | |
| 3697 | + | |
| 3698 | + | |
3696 | 3699 | | |
3697 | 3700 | | |
3698 | 3701 | | |
3699 | 3702 | | |
3700 | 3703 | | |
3701 | | - | |
3702 | | - | |
3703 | | - | |
3704 | | - | |
| 3704 | + | |
3705 | 3705 | | |
3706 | 3706 | | |
3707 | 3707 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
| 226 | + | |
227 | 227 | | |
228 | 228 | | |
| 229 | + | |
229 | 230 | | |
230 | 231 | | |
231 | 232 | | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
239 | 236 | | |
240 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
241 | 272 | | |
242 | 273 | | |
243 | 274 | | |
| |||
254 | 285 | | |
255 | 286 | | |
256 | 287 | | |
| 288 | + | |
| 289 | + | |
257 | 290 | | |
258 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
259 | 299 | | |
260 | 300 | | |
261 | 301 | | |
| |||
917 | 957 | | |
918 | 958 | | |
919 | 959 | | |
920 | | - | |
| 960 | + | |
921 | 961 | | |
922 | 962 | | |
923 | 963 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
0 commit comments