Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1700038 > unrolled thread
| Started by | Paolo Bonzini <pbonzini@redhat.com> |
|---|---|
| First post | 2017-07-31 15:30 +0200 |
| Last post | 2017-08-01 10:40 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [RFC] KVM: optimize the kvm_vcpu_on_spin Paolo Bonzini <pbonzini@redhat.com> - 2017-07-31 15:30 +0200
Re: [RFC] KVM: optimize the kvm_vcpu_on_spin "Longpeng (Mike)" <longpeng2@huawei.com> - 2017-08-01 05:30 +0200
Re: [RFC] KVM: optimize the kvm_vcpu_on_spin Paolo Bonzini <pbonzini@redhat.com> - 2017-08-01 10:40 +0200
| From | Paolo Bonzini <pbonzini@redhat.com> |
|---|---|
| Date | 2017-07-31 15:30 +0200 |
| Subject | Re: [RFC] KVM: optimize the kvm_vcpu_on_spin |
| Message-ID | <u9iVH-6No-5@gated-at.bofh.it> |
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). 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). This will cache the result until the next sched_in, so that kvm_vcpu_on_spin can use it. Paolo
[toc] | [next] | [standalone]
| From | "Longpeng (Mike)" <longpeng2@huawei.com> |
|---|---|
| Date | 2017-08-01 05:30 +0200 |
| Message-ID | <u9w2B-6pU-3@gated-at.bofh.it> |
| In reply to | #1700038 |
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)
[toc] | [prev] | [next] | [standalone]
| From | Paolo Bonzini <pbonzini@redhat.com> |
|---|---|
| Date | 2017-08-01 10:40 +0200 |
| Message-ID | <u9ASC-TK-27@gated-at.bofh.it> |
| In reply to | #1700601 |
On 01/08/2017 05:26, Longpeng (Mike) wrote: > > > 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? That's another way to do it, and I like it. >> 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 ? No, thanks. Paolo
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web