Commit b146a9b
committed
KVM: x86/mmu: Age TDP MMU SPTEs without holding mmu_lock
Walk the TDP MMU in an RCU read-side critical section without holding
mmu_lock when harvesting and potentially updating age information on
TDP MMU SPTEs. Add a new macro to do RCU-safe walking of TDP MMU roots,
and do all SPTE aging with atomic updates; while clobbering Accessed
information is ok, KVM must not corrupt other bits, e.g. must not drop
a Dirty or Writable bit when making a SPTE young..
If updating a SPTE to mark it for access tracking fails, leave it as is
and treat it as if it were young. If the spte is being actively modified,
it is most likely young.
Acquire and release mmu_lock for write when harvesting age information
from the shadow MMU, as the shadow MMU doesn't yet support aging outside
of mmu_lock.
Suggested-by: Yu Zhao <yuzhao@google.com>
Signed-off-by: James Houghton <jthoughton@google.com>
Reviewed-by: David Matlack <dmatlack@google.com>
Link: https://lore.kernel.org/r/20250204004038.1680123-5-jthoughton@google.com
[sean: massage changelog]
Signed-off-by: Sean Christopherson <seanjc@google.com>1 parent 928c54b commit b146a9b
4 files changed
Lines changed: 35 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1478 | 1478 | | |
1479 | 1479 | | |
1480 | 1480 | | |
| 1481 | + | |
1481 | 1482 | | |
1482 | 1483 | | |
1483 | 1484 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1592 | 1592 | | |
1593 | 1593 | | |
1594 | 1594 | | |
1595 | | - | |
| 1595 | + | |
| 1596 | + | |
1596 | 1597 | | |
| 1598 | + | |
| 1599 | + | |
1597 | 1600 | | |
1598 | 1601 | | |
1599 | 1602 | | |
| |||
1605 | 1608 | | |
1606 | 1609 | | |
1607 | 1610 | | |
1608 | | - | |
| 1611 | + | |
| 1612 | + | |
1609 | 1613 | | |
| 1614 | + | |
| 1615 | + | |
1610 | 1616 | | |
1611 | 1617 | | |
1612 | 1618 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
196 | 209 | | |
197 | 210 | | |
198 | 211 | | |
| |||
1332 | 1345 | | |
1333 | 1346 | | |
1334 | 1347 | | |
1335 | | - | |
| 1348 | + | |
1336 | 1349 | | |
1337 | 1350 | | |
1338 | 1351 | | |
1339 | 1352 | | |
1340 | | - | |
1341 | | - | |
1342 | | - | |
1343 | | - | |
| 1353 | + | |
| 1354 | + | |
1344 | 1355 | | |
1345 | 1356 | | |
1346 | 1357 | | |
1347 | | - | |
1348 | | - | |
1349 | | - | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
1350 | 1364 | | |
1351 | 1365 | | |
1352 | 1366 | | |
| |||
1371 | 1385 | | |
1372 | 1386 | | |
1373 | 1387 | | |
1374 | | - | |
1375 | | - | |
1376 | 1388 | | |
| 1389 | + | |
| 1390 | + | |
1377 | 1391 | | |
1378 | 1392 | | |
1379 | 1393 | | |
| |||
1382 | 1396 | | |
1383 | 1397 | | |
1384 | 1398 | | |
1385 | | - | |
| 1399 | + | |
1386 | 1400 | | |
1387 | 1401 | | |
1388 | 1402 | | |
| |||
0 commit comments