Commit 548f87f
committed
KVM: x86/mmu: Honor NEED_RESCHED when zapping rmaps and blocking is allowed
Convert kvm_unmap_gfn_range(), which is the helper that zaps rmap SPTEs in
response to an mmu_notifier invalidation, to use __kvm_rmap_zap_gfn_range()
and feed in range->may_block. In other words, honor NEED_RESCHED by way of
cond_resched() when zapping rmaps. This fixes a long-standing issue where
KVM could process an absurd number of rmap entries without ever yielding,
e.g. if an mmu_notifier fired on a PUD (or larger) range.
Opportunistically rename __kvm_zap_rmap() to kvm_zap_rmap(), and drop the
old kvm_zap_rmap(). Ideally, the shuffling would be done in a different
patch, but that just makes the compiler unhappy, e.g.
arch/x86/kvm/mmu/mmu.c:1462:13: error: ‘kvm_zap_rmap’ defined but not used
Reported-by: Peter Xu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sean Christopherson <[email protected]>1 parent dd9eaad commit 548f87f
1 file changed
+6
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1435 | 1435 | | |
1436 | 1436 | | |
1437 | 1437 | | |
1438 | | - | |
1439 | | - | |
1440 | | - | |
1441 | | - | |
1442 | | - | |
1443 | | - | |
1444 | 1438 | | |
1445 | | - | |
| 1439 | + | |
1446 | 1440 | | |
1447 | | - | |
| 1441 | + | |
1448 | 1442 | | |
1449 | 1443 | | |
1450 | 1444 | | |
| |||
1578 | 1572 | | |
1579 | 1573 | | |
1580 | 1574 | | |
1581 | | - | |
| 1575 | + | |
1582 | 1576 | | |
1583 | 1577 | | |
1584 | 1578 | | |
| |||
1607 | 1601 | | |
1608 | 1602 | | |
1609 | 1603 | | |
1610 | | - | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
1611 | 1607 | | |
1612 | 1608 | | |
1613 | 1609 | | |
| |||
0 commit comments