All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shivam Kumar <shivam.kumar1@nutanix.com>
To: pbonzini@redhat.com
Cc: kvm@vger.kernel.org, Shivam Kumar <shivam.kumar1@nutanix.com>,
	Anurag Madnawat <anurag.madnawat@nutanix.com>,
	Shaju Abraham <shaju.abraham@nutanix.com>,
	Manish Mishra <manish.mishra@nutanix.com>
Subject: [PATCH 4/6] Increment dirty counter for vmexit due to page write fault.
Date: Tue, 26 Oct 2021 16:35:09 +0000	[thread overview]
Message-ID: <20211026163511.90558-5-shivam.kumar1@nutanix.com> (raw)
In-Reply-To: <20211026163511.90558-1-shivam.kumar1@nutanix.com>

For a page write fault or "page dirty", the dirty counter of the
corresponding vCPU is incremented.

Co-developed-by: Anurag Madnawat <anurag.madnawat@nutanix.com>
Signed-off-by: Anurag Madnawat <anurag.madnawat@nutanix.com>
Signed-off-by: Shivam Kumar <shivam.kumar1@nutanix.com>
Signed-off-by: Shaju Abraham <shaju.abraham@nutanix.com>
Signed-off-by: Manish Mishra <manish.mishra@nutanix.com>
---
 virt/kvm/kvm_main.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 95f857c50bf2..c41b85af8682 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -3083,8 +3083,15 @@ void mark_page_dirty_in_slot(struct kvm *kvm,
 		if (kvm->dirty_ring_size)
 			kvm_dirty_ring_push(kvm_dirty_ring_get(kvm),
 					    slot, rel_gfn);
-		else
+		else {
+			struct kvm_vcpu *vcpu = kvm_get_running_vcpu();
+
+			if (vcpu && vcpu->kvm->dirty_quota_migration_enabled &&
+					vcpu->vCPUdqctx)
+				vcpu->vCPUdqctx->dirty_counter++;
+
 			set_bit_le(rel_gfn, memslot->dirty_bitmap);
+		}
 	}
 }
 EXPORT_SYMBOL_GPL(mark_page_dirty_in_slot);
-- 
2.22.3


  parent reply	other threads:[~2021-10-26 16:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-26 16:35 [PATCH 0/6] KVM: Dirty Quota-Based VM Live Migration Auto-Converge Shivam Kumar
2021-10-26 16:35 ` [PATCH 1/6] Define data structures needed for dirty quota migration Shivam Kumar
2021-10-26 16:35 ` [PATCH 2/6] Allocate memory for dirty quota context and initialize dirty quota migration flag Shivam Kumar
2021-10-27  4:50   ` kernel test robot
2021-10-27  4:50     ` kernel test robot
2021-10-27  7:31   ` kernel test robot
2021-10-27  7:31     ` kernel test robot
2021-10-26 16:35 ` [PATCH 3/6] Add dirty quota migration capability and handle vCPU page fault for dirty quota context Shivam Kumar
2021-10-27  7:19   ` kernel test robot
2021-10-27  7:19     ` kernel test robot
2021-10-26 16:35 ` Shivam Kumar [this message]
2021-10-26 16:35 ` [PATCH 5/6] Exit to userspace when dirty quota is full Shivam Kumar
2021-10-26 16:35 ` [PATCH 6/6] Free space allocated for the vCPU's dirty quota context upon destroy Shivam Kumar
2021-11-14 14:57 [PATCH 0/6] KVM: Dirty Quota-Based VM Live Migration Auto-Converge Shivam Kumar
2021-11-14 14:57 ` [PATCH 4/6] Increment dirty counter for vmexit due to page write fault Shivam Kumar
2021-11-18 17:48   ` Sean Christopherson
2021-11-19 19:54     ` Shivam Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211026163511.90558-5-shivam.kumar1@nutanix.com \
    --to=shivam.kumar1@nutanix.com \
    --cc=anurag.madnawat@nutanix.com \
    --cc=kvm@vger.kernel.org \
    --cc=manish.mishra@nutanix.com \
    --cc=pbonzini@redhat.com \
    --cc=shaju.abraham@nutanix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.