From: Sean Christopherson <seanjc@google.com>
To: Shivam Kumar <shivam.kumar1@nutanix.com>
Cc: pbonzini@redhat.com, kvm@vger.kernel.org,
Shaju Abraham <shaju.abraham@nutanix.com>,
Manish Mishra <manish.mishra@nutanix.com>,
Anurag Madnawat <anurag.madnawat@nutanix.com>
Subject: Re: [PATCH v3 1/3] KVM: Implement dirty quota-based throttling of vcpus
Date: Thu, 31 Mar 2022 00:28:03 +0000 [thread overview]
Message-ID: <YkT1kzWidaRFdQQh@google.com> (raw)
In-Reply-To: <20220306220849.215358-2-shivam.kumar1@nutanix.com>
This whole series needs to be Cc'd to the arm64 and s390 folks. The easiest way
to that is to use scripts/get_maintainers.pl, which will grab the appropriate
people. There are a variety of options you can use to tailor it to your style.
E.g. for KVM I do
--nogit --nogit-fallback --norolestats --nofixes --pattern-depth=1
for To:, and then add
--nom
for Cc:. The --pattern-depth=1 tells it to not recurse up so that it doesn't
include the x86 maintainers for arch/x86/kvm patches.
I'd Cc them manually, but I think it'll be easier to just post v4.
On Sun, Mar 06, 2022, Shivam Kumar wrote:
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index eb4029660bd9..0b35b8cc0274 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -10257,6 +10257,10 @@ static int vcpu_run(struct kvm_vcpu *vcpu)
> vcpu->arch.l1tf_flush_l1d = true;
>
> for (;;) {
> + r = kvm_vcpu_check_dirty_quota(vcpu);
> + if (!r)
> + break;
> +
> if (kvm_vcpu_running(vcpu)) {
> r = vcpu_enter_guest(vcpu);
> } else {
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index f11039944c08..b1c599c78c42 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -530,6 +530,21 @@ static inline int kvm_vcpu_exiting_guest_mode(struct kvm_vcpu *vcpu)
> return cmpxchg(&vcpu->mode, IN_GUEST_MODE, EXITING_GUEST_MODE);
> }
>
> +static inline int kvm_vcpu_check_dirty_quota(struct kvm_vcpu *vcpu)
> +{
> + u64 dirty_quota = READ_ONCE(vcpu->run->dirty_quota);
> + u64 pages_dirtied = vcpu->stat.generic.pages_dirtied;
> + struct kvm_run *run = vcpu->run;
Might as well use "run" when reading the dirty quota.
> +
> + if (!dirty_quota || (pages_dirtied < dirty_quota))
> + return 1;
I don't love returning 0/1 from a function that suggests it returns a bool, but
I do agree it's better than actually returning a bool. I also don't have a better
name, so I'm just whining in the hope that Paolo or someone else has an idea :-)
> + run->exit_reason = KVM_EXIT_DIRTY_QUOTA_EXHAUSTED;
> + run->dirty_quota_exit.count = pages_dirtied;
> + run->dirty_quota_exit.quota = dirty_quota;
> + return 0;
> +}
next prev parent reply other threads:[~2022-03-31 0:28 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-06 22:08 [PATCH v3 0/3] KVM: Dirty quota-based throttling Shivam Kumar
2022-03-06 22:08 ` [PATCH v3 1/3] KVM: Implement dirty quota-based throttling of vcpus Shivam Kumar
2022-03-31 0:28 ` Sean Christopherson [this message]
2022-03-31 7:20 ` Shivam Kumar
2022-03-31 15:37 ` Sean Christopherson
2022-04-06 12:32 ` Shivam Kumar
2022-05-02 22:14 ` Peter Xu
2022-05-03 7:22 ` Shivam Kumar
2022-05-03 13:43 ` Peter Xu
2022-05-04 6:33 ` Shivam Kumar
2022-05-04 17:26 ` Peter Xu
2022-05-05 15:17 ` Shivam Kumar
2022-03-06 22:08 ` [PATCH v3 2/3] KVM: Documentation: Update kvm_run structure for dirty quota Shivam Kumar
2022-03-31 0:40 ` Sean Christopherson
2022-03-31 7:30 ` Shivam Kumar
2022-03-31 15:24 ` Sean Christopherson
2022-04-01 13:49 ` Sean Christopherson
2022-04-06 12:39 ` Shivam Kumar
2022-04-06 12:44 ` Shivam Kumar
2022-03-06 22:08 ` [PATCH v3 3/3] KVM: selftests: Add selftests for dirty quota throttling Shivam Kumar
2022-04-18 4:55 ` Shivam Kumar
2022-04-18 4:59 ` Shivam Kumar
2022-04-18 16:17 ` Sean Christopherson
2022-04-28 7:00 ` Shivam Kumar
2022-04-28 23:59 ` Sean Christopherson
2022-03-19 18:21 ` [PATCH v3 0/3] KVM: Dirty quota-based throttling 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=YkT1kzWidaRFdQQh@google.com \
--to=seanjc@google.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 \
--cc=shivam.kumar1@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).