From: Paolo Bonzini <pbonzini@redhat.com>
To: lihaiwei.kernel@gmail.com, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org
Cc: seanjc@google.com, vkuznets@redhat.com, wanpengli@tencent.com,
jmattson@google.com, joro@8bytes.org,
Haiwei Li <lihaiwei@tencent.com>
Subject: Re: [PATCH] KVM: x86: Take advantage of kvm_arch_dy_has_pending_interrupt()
Date: Thu, 22 Apr 2021 12:35:58 +0200 [thread overview]
Message-ID: <2c1c0771-5ff7-03e9-53e3-ee7b2cfe63a6@redhat.com> (raw)
In-Reply-To: <20210421032513.1921-1-lihaiwei.kernel@gmail.com>
On 21/04/21 05:25, lihaiwei.kernel@gmail.com wrote:
> From: Haiwei Li <lihaiwei@tencent.com>
>
> `kvm_arch_dy_runnable` checks the pending_interrupt as the code in
> `kvm_arch_dy_has_pending_interrupt`. So take advantage of it.
>
> Signed-off-by: Haiwei Li <lihaiwei@tencent.com>
> ---
> arch/x86/kvm/x86.c | 21 +++++++++------------
> 1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index d696a9f..08bd616 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -11125,28 +11125,25 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
> return kvm_vcpu_running(vcpu) || kvm_vcpu_has_events(vcpu);
> }
>
> -bool kvm_arch_dy_runnable(struct kvm_vcpu *vcpu)
> +bool kvm_arch_dy_has_pending_interrupt(struct kvm_vcpu *vcpu)
> {
> - if (READ_ONCE(vcpu->arch.pv.pv_unhalted))
> - return true;
> -
> - if (kvm_test_request(KVM_REQ_NMI, vcpu) ||
> - kvm_test_request(KVM_REQ_SMI, vcpu) ||
> - kvm_test_request(KVM_REQ_EVENT, vcpu))
> - return true;
> -
> if (vcpu->arch.apicv_active && static_call(kvm_x86_dy_apicv_has_pending_interrupt)(vcpu))
> return true;
>
> return false;
> }
>
> -bool kvm_arch_dy_has_pending_interrupt(struct kvm_vcpu *vcpu)
> +bool kvm_arch_dy_runnable(struct kvm_vcpu *vcpu)
> {
> - if (vcpu->arch.apicv_active && static_call(kvm_x86_dy_apicv_has_pending_interrupt)(vcpu))
> + if (READ_ONCE(vcpu->arch.pv.pv_unhalted))
> return true;
>
> - return false;
> + if (kvm_test_request(KVM_REQ_NMI, vcpu) ||
> + kvm_test_request(KVM_REQ_SMI, vcpu) ||
> + kvm_test_request(KVM_REQ_EVENT, vcpu))
> + return true;
> +
> + return kvm_arch_dy_has_pending_interrupt(vcpu);
> }
>
> bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu)
>
Looks good, but I'd like to take a look at the other patches for
directed yield first. Thanks!
Paolo
prev parent reply other threads:[~2021-04-22 10:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-21 3:25 [PATCH] KVM: x86: Take advantage of kvm_arch_dy_has_pending_interrupt() lihaiwei.kernel
2021-04-22 9:21 ` Wanpeng Li
2021-04-22 10:35 ` Paolo Bonzini [this message]
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=2c1c0771-5ff7-03e9-53e3-ee7b2cfe63a6@redhat.com \
--to=pbonzini@redhat.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=lihaiwei.kernel@gmail.com \
--cc=lihaiwei@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=seanjc@google.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.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).