[PATCH v9 3/3] KVM: arm64: Dirty quota-based throttling of vcpus

Marc Zyngier maz at kernel.org
Thu May 4 08:08:41 PDT 2023


On Thu, 04 May 2023 15:43:31 +0100,
Shivam Kumar <shivam.kumar1 at nutanix.com> wrote:
> 
> Call update_dirty_quota whenever a page is marked dirty with
> appropriate arch-specific page size. Process the KVM request
> KVM_REQ_DIRTY_QUOTA_EXIT (raised by update_dirty_quota) to exit to
> userspace with exit reason KVM_EXIT_DIRTY_QUOTA_EXHAUSTED.
> 
> Suggested-by: Shaju Abraham <shaju.abraham at nutanix.com>
> Suggested-by: Manish Mishra <manish.mishra at nutanix.com>
> Co-developed-by: Anurag Madnawat <anurag.madnawat at nutanix.com>
> Signed-off-by: Anurag Madnawat <anurag.madnawat at nutanix.com>
> Signed-off-by: Shivam Kumar <shivam.kumar1 at nutanix.com>
> ---
>  arch/arm64/kvm/Kconfig | 1 +
>  arch/arm64/kvm/arm.c   | 5 +++++
>  arch/arm64/kvm/mmu.c   | 1 +
>  3 files changed, 7 insertions(+)
> 
> diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig
> index f531da6b362e..06144ad3cfae 100644
> --- a/arch/arm64/kvm/Kconfig
> +++ b/arch/arm64/kvm/Kconfig
> @@ -43,6 +43,7 @@ menuconfig KVM
>  	select SCHED_INFO
>  	select GUEST_PERF_EVENTS if PERF_EVENTS
>  	select INTERVAL_TREE
> +	select HAVE_KVM_DIRTY_QUOTA
>  	help
>  	  Support hosting virtualized guest machines.
>  
> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> index 14391826241c..f0280c1c1c06 100644
> --- a/arch/arm64/kvm/arm.c
> +++ b/arch/arm64/kvm/arm.c
> @@ -792,6 +792,11 @@ static int check_vcpu_requests(struct kvm_vcpu *vcpu)
>  
>  		if (kvm_dirty_ring_check_request(vcpu))
>  			return 0;
> +
> +		if (kvm_check_request(KVM_REQ_DIRTY_QUOTA_EXIT, vcpu)) {
> +			vcpu->run->exit_reason = KVM_EXIT_DIRTY_QUOTA_EXHAUSTED;
> +			return 0;
> +		}
>  	}
>  
>  	return 1;
> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> index 3b9d4d24c361..93c52f7464c9 100644
> --- a/arch/arm64/kvm/mmu.c
> +++ b/arch/arm64/kvm/mmu.c
> @@ -1419,6 +1419,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
>  	/* Mark the page dirty only if the fault is handled successfully */
>  	if (writable && !ret) {
>  		kvm_set_pfn_dirty(pfn);
> +		update_dirty_quota(kvm, fault_granule);
>  		mark_page_dirty_in_slot(kvm, memslot, gfn);
>  	}
>  

I already raised this against the previous version of series:
fault_granule isn't the amount of memory that gets mapped. I urge you
to actually read the code you're modifying. Ignoring reviewer comments
is not going to help merging this series. And yes, I ignored your
reply because it didn't make any sense...

It is also basic courtesy to Cc the maintainers and reviewers of that
code, as well as the relevant MLs (get_maintainers.pl is, as usual,
your friend).

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list