On 15/11/22 5:57 am, Yunhong Jiang wrote:
On Sun, Nov 13, 2022 at 05:05:10PM +0000, Shivam Kumar wrote:
Exit to userspace whenever the dirty quota is exhausted (i.e. dirty count
equals/exceeds dirty quota) to request more dirty quota.
Suggested-by: Shaju Abraham <shaju.abraham@xxxxxxxxxxx>
Suggested-by: Manish Mishra <manish.mishra@xxxxxxxxxxx>
Co-developed-by: Anurag Madnawat <anurag.madnawat@xxxxxxxxxxx>
Signed-off-by: Anurag Madnawat <anurag.madnawat@xxxxxxxxxxx>
Signed-off-by: Shivam Kumar <shivam.kumar1@xxxxxxxxxxx>
---
arch/arm64/kvm/arm.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index 94d33e296e10..850024982dd9 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -746,6 +746,15 @@ static int check_vcpu_requests(struct kvm_vcpu *vcpu)
if (kvm_check_request(KVM_REQ_SUSPEND, vcpu))
return kvm_vcpu_suspend(vcpu);
+
+ if (kvm_check_request(KVM_REQ_DIRTY_QUOTA_EXIT, vcpu)) {
+ struct kvm_run *run = vcpu->run;
+
+ run->exit_reason = KVM_EXIT_DIRTY_QUOTA_EXHAUSTED;
+ run->dirty_quota_exit.count = vcpu->stat.generic.pages_dirtied;
+ run->dirty_quota_exit.quota = vcpu->dirty_quota;
+ return 0;
+ }
There is a recheck on x86 side, but not here. Any architecture specific reason?
Sorry if I missed anything.
BTW, not sure if the x86/arm code can be combined into a common function. I
don't see any architecture specific code here.
Yes, I think we may use a common function for x86/arm.
With that, this would look like:
if (kvm_check_dirty_quota_request(vcpu)) {
return 0;
}
Thanks,
Shivam