public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Longpeng (Mike)" <longpeng2@huawei.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: David Hildenbrand <david@redhat.com>, <rkrcmar@redhat.com>,
	<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>
Subject: Re: [RFC] KVM: optimize the kvm_vcpu_on_spin
Date: Tue, 1 Aug 2017 11:26:06 +0800	[thread overview]
Message-ID: <597FF4CE.7050901@huawei.com> (raw)
In-Reply-To: <3572e95a-a5eb-748b-25c8-b7e128cbbe1b@redhat.com>



On 2017/7/31 21:20, Paolo Bonzini wrote:

> On 31/07/2017 14:27, David Hildenbrand wrote:
>>> I'm not sure whether the operation of get the vcpu's priority-level is
>>> expensive on all architectures, so I record it in kvm_sched_out() for
>>> minimal the extra cycles cost in kvm_vcpu_on_spin().
>>>
>> as you only care for x86 right now either way, you can directly optimize
>> here for the good (here: x86) case (keeping changes and therefore
>> possible bugs minimal).
> 
> I agree with Cornelia that this is inconsistent, so you shouldn't update
> me->in_kernmode in kvm_vcpu_on_spin.  However, get_cpl requires
> vcpu_load on Intel x86, so Mike's patch is necessary (vmx_get_cpl ->
> vmx_read_guest_seg_ar -> vmcs_read32).
> 

Hi Paolo,

It seems that other architectures(e.g. arm/s390) needn't to cache the result,
but x86 need, so I need to move 'in_kernmode' into kvm_vcpu_arch and only add
this field to x86, right?

> Alternatively, we can add a new callback kvm_x86_ops->sched_out to x86
> KVM, and call vmx_get_cpl from the Intel implementation (vmx_sched_out).


In this approach, vmx_sched_out would only call vmx_get_cpl, isn't too
redundant, because we can just call kvm_x86_ops->get_cpl instead at the right place?

>  This will cache the result until the next sched_in, so that


'until the next sched_in' --> Do we need to clear the result in sched in ?

> kvm_vcpu_on_spin can use it.
> 
> Paolo
> 
> .
> 


-- 
Regards,
Longpeng(Mike)

  reply	other threads:[~2017-08-01  3:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-29  6:22 [RFC] KVM: optimize the kvm_vcpu_on_spin Longpeng(Mike)
2017-07-31 11:31 ` David Hildenbrand
2017-07-31 12:08   ` Longpeng (Mike)
2017-07-31 12:27     ` David Hildenbrand
2017-07-31 13:20       ` Paolo Bonzini
2017-08-01  3:26         ` Longpeng (Mike) [this message]
2017-08-01  8:32           ` Paolo Bonzini
2017-07-31 12:31     ` Cornelia Huck
2017-07-31 13:01       ` Longpeng (Mike)
2017-07-31 13:22 ` Christoffer Dall
2017-07-31 17:32   ` David Hildenbrand
2017-08-01  6:51     ` Cornelia Huck
2017-08-01  2:24   ` Longpeng (Mike)
2017-07-31 13:42 ` Marc Zyngier
2017-07-31 14:23   ` Paolo Bonzini

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=597FF4CE.7050901@huawei.com \
    --to=longpeng2@huawei.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=marc.zyngier@arm.com \
    --cc=pbonzini@redhat.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