From: Paolo Bonzini <pbonzini@redhat.com>
To: "Longpeng(Mike)" <longpeng2@huawei.com>, rkrcmar@redhat.com
Cc: agraf@suse.com, borntraeger@de.ibm.com, cohuck@redhat.com,
christoffer.dall@linaro.org, marc.zyngier@arm.com,
james.hogan@imgtec.com, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, weidong.huang@huawei.com,
arei.gonglei@huawei.com, wangxinxin.wang@huawei.com,
longpeng.mike@gmail.com, david@redhat.com
Subject: Re: [PATCH 2/3] KVM: X86: implement the logic for spinlock optimization
Date: Mon, 7 Aug 2017 12:45:45 +0200 [thread overview]
Message-ID: <c997b792-567d-4b1e-ab12-22198d863ff5@redhat.com> (raw)
In-Reply-To: <1502095466-21312-3-git-send-email-longpeng2@huawei.com>
On 07/08/2017 10:44, Longpeng(Mike) wrote:
> +
> + /*
> + * Intel sdm vol3 ch-25.1.3 says: The “PAUSE-loop exiting”
> + * VM-execution control is ignored if CPL > 0. So the vcpu
> + * is always exiting with CPL=0 if it uses PLE.
This is not true (how can it be?). What 25.1.3 says is, the VCPU is
always at CPL=0 if you get a PAUSE exit (reason 40) and PAUSE exiting is
0 (it always is for KVM). But here you're looking for a VCPU that
didn't get a PAUSE exit, so the CPL can certainly be 3.
However, I understand that vmx_get_cpl can be a bit slow here. You can
actually read SS's access rights directly in this function and get the
DPL from there, that's going to be just a single VMREAD.
The only difference is when vmx->rmode.vm86_active=1. However,
pause-loop exiting is not working properly anyway if
vmx->rmode.vm86_active=1, because CPL=3 according to the processor.
Paolo
> + * The following block needs less cycles than vmx_get_cpl().
> + */
> + if (cpu_has_secondary_exec_ctrls())
> + secondary_exec_ctrl = vmcs_read32(SECONDARY_VM_EXEC_CONTROL);
> + if (secondary_exec_ctrl & SECONDARY_EXEC_PAUSE_LOOP_EXITING)
> + return true;
> +
Paolo
next prev parent reply other threads:[~2017-08-07 10:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-07 8:44 [PATCH 0/3] KVM: optimize the kvm_vcpu_on_spin Longpeng(Mike)
2017-08-07 8:44 ` [PATCH 1/3] KVM: add spinlock-exiting optimize framework Longpeng(Mike)
2017-08-07 8:55 ` David Hildenbrand
2017-08-07 9:04 ` Longpeng (Mike)
2017-08-07 8:44 ` [PATCH 2/3] KVM: X86: implement the logic for spinlock optimization Longpeng(Mike)
2017-08-07 10:45 ` Paolo Bonzini [this message]
2017-08-07 12:28 ` Longpeng(Mike)
2017-08-07 13:16 ` Paolo Bonzini
2017-08-07 8:44 ` [PATCH 3/3] KVM: implement spinlock optimization logic for arm/s390 Longpeng(Mike)
2017-08-07 8:52 ` David Hildenbrand
2017-08-07 8:54 ` Longpeng (Mike)
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=c997b792-567d-4b1e-ab12-22198d863ff5@redhat.com \
--to=pbonzini@redhat.com \
--cc=agraf@suse.com \
--cc=arei.gonglei@huawei.com \
--cc=borntraeger@de.ibm.com \
--cc=christoffer.dall@linaro.org \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=james.hogan@imgtec.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longpeng.mike@gmail.com \
--cc=longpeng2@huawei.com \
--cc=marc.zyngier@arm.com \
--cc=rkrcmar@redhat.com \
--cc=wangxinxin.wang@huawei.com \
--cc=weidong.huang@huawei.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
all inboxes | Powered by JetHome®