diff mbox series

[2/5] KVM: Bail from the dirty ring reset flow if a signal is pending

Message ID 20250111010409.1252942-3-seanjc@google.com (mailing list archive)
State New
Headers show
Series KVM: Dirty ring fixes and cleanups | expand

Commit Message

Sean Christopherson Jan. 11, 2025, 1:04 a.m. UTC
Abort a dirty ring reset if the current task has a pending signal, as the
hard limit of INT_MAX entries doesn't ensure KVM will respond to a signal
in a timely fashion.

Fixes: fb04a1eddb1a ("KVM: X86: Implement ring-based dirty memory tracking")
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 virt/kvm/dirty_ring.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/virt/kvm/dirty_ring.c b/virt/kvm/dirty_ring.c
index 2faf894dec5a..a81ad17d5eef 100644
--- a/virt/kvm/dirty_ring.c
+++ b/virt/kvm/dirty_ring.c
@@ -117,6 +117,9 @@  int kvm_dirty_ring_reset(struct kvm *kvm, struct kvm_dirty_ring *ring,
 	cur_slot = cur_offset = mask = 0;
 
 	while (likely((*nr_entries_reset) < INT_MAX)) {
+		if (signal_pending(current))
+			return -EINTR;
+
 		entry = &ring->dirty_gfns[ring->reset_index & (ring->size - 1)];
 
 		if (!kvm_dirty_gfn_harvested(entry))