Am 15.09.22 um 15:21 schrieb Christian Borntraeger:
Am 15.09.22 um 12:10 schrieb Shivam Kumar:
Define variables to track and throttle memory dirtying for every vcpu.
dirty_count: Number of pages the vcpu has dirtied since its creation,
while dirty logging is enabled.
dirty_quota: Number of pages the vcpu is allowed to dirty. To dirty
more, it needs to request more quota by exiting to
userspace.
Implement the flow for throttling based on dirty quota.
i) Increment dirty_count for the vcpu whenever it dirties a page.
ii) 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>
[...]
I am wondering if this will work on s390. On s390 we only call
mark_page_dirty_in_slot for the kvm_read/write functions but not
for those done by the guest on fault. We do account those lazily in
kvm_arch_sync_dirty_log (like x96 in the past).
I think we need to rework the page fault handling on s390 to actually make
use of this. This has to happen anyway somewhen (as indicated by the guest
enter/exit rework from Mark). Right now we handle KVM page faults directly
in the normal system fault handler. It seems we need to make a side turn
into KVM for page faults on guests in the long run.
Until this is done the dirty logging is really not per CPU on s390 so we
need to defer this feature for now. CC other s390 maintainers.
The other use case for a page fault handler rework was Mark Rutlands
"kvm: fix latent guest entry/exit bugs" series which did not work on s390.