From: "Li,Rongqing" <lirongqing@baidu.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: "seanjc@google.com" <seanjc@google.com>,
"wanpengli@tencent.com" <wanpengli@tencent.com>,
"jmattson@google.com" <jmattson@google.com>,
"joro@8bytes.org" <joro@8bytes.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"mingo@redhat.com" <mingo@redhat.com>,
"bp@alien8.de" <bp@alien8.de>, "x86@kernel.org" <x86@kernel.org>,
"hpa@zytor.com" <hpa@zytor.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: 答复: [PATCH] KVM: Clear pv eoi pending bit only when it is set
Date: Wed, 20 Oct 2021 03:36:26 +0000 [thread overview]
Message-ID: <1b9c965dfbac457e8407f00e930f6449@baidu.com> (raw)
In-Reply-To: <876df534-a280-dc26-6a70-a1464bacad5f@redhat.com>
> -----邮件原件-----
> 发件人: Paolo Bonzini <pbonzini@redhat.com>
> 发送时间: 2021年10月19日 15:29
> 收件人: Vitaly Kuznetsov <vkuznets@redhat.com>; Li,Rongqing
> <lirongqing@baidu.com>
> 抄送: seanjc@google.com; wanpengli@tencent.com; jmattson@google.com;
> joro@8bytes.org; tglx@linutronix.de; mingo@redhat.com; bp@alien8.de;
> x86@kernel.org; hpa@zytor.com; kvm@vger.kernel.org
> 主题: Re: [PATCH] KVM: Clear pv eoi pending bit only when it is set
>
> On 19/10/21 09:23, Vitaly Kuznetsov wrote:
> >>
> >> -static void pv_eoi_clr_pending(struct kvm_vcpu *vcpu)
> >> +static void pv_eoi_clr_pending(struct kvm_vcpu *vcpu, bool pending)
> > Nitpick (and probably a matter of personal taste):
> > pv_eoi_clr_pending() has only one user and the change doesn't make its
> > interface much nicer, I'd suggest we just inline in instead. (we can
> > probably do the same to
> > pv_eoi_get_pending()/pv_eoi_set_pending() too).
>
> Alternatively, merge pv_eoi_get_pending and pv_eoi_clr_pending into a single
> function pv_eoi_test_and_clear_pending, which returns the value of the
> pending bit.
>
> So the caller can do essentially:
>
> - pending = pv_eoi_get_pending(vcpu);
> - pv_eoi_clr_pending(vcpu);
> - if (pending)
> + if (pv_eoi_test_and_clear_pending(vcpu))
> return;
>
>
It is better to implement pv_eoi_test_and_clear_pending(), and it can fix the race that Vitaly suggested
And I will write a new function kvm_test_and_clear_bit_guest_cached, to be called in pv_eoi_test_and_clear_pending
Bool kvm_test_and_clear_bit_guest_cached(struct kvm_vcpu *vcpu, struct gfn_to_hva_cache * ghc, long nr)
-Li
> Paolo
next prev parent reply other threads:[~2021-10-20 3:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-19 2:05 [PATCH] KVM: Clear pv eoi pending bit only when it is set Li RongQing
2021-10-19 7:23 ` Vitaly Kuznetsov
2021-10-19 7:29 ` Paolo Bonzini
2021-10-20 3:36 ` Li,Rongqing [this message]
2021-10-20 11:15 ` 答复: " Li,Rongqing
2021-10-20 3:43 ` Li,Rongqing
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=1b9c965dfbac457e8407f00e930f6449@baidu.com \
--to=lirongqing@baidu.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=x86@kernel.org \
/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