Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1700253

Re: [RFC] KVM: optimize the kvm_vcpu_on_spin

From David Hildenbrand <david@redhat.com>
Newsgroups linux.kernel
Subject Re: [RFC] KVM: optimize the kvm_vcpu_on_spin
Date 2017-07-31 19:40 +0200
Message-ID <u9mPE-H2-17@gated-at.bofh.it> (permalink)
References <u8tqa-6KR-23@gated-at.bofh.it> <u9iVI-6No-19@gated-at.bofh.it>
Organization Red Hat GmbH

Show all headers | View raw


On 31.07.2017 15:22, Christoffer Dall wrote:
> On Sat, Jul 29, 2017 at 02:22:57PM +0800, Longpeng(Mike) wrote:
>> We had disscuss the idea here:
>> https://www.spinics.net/lists/kvm/msg140593.html
> 
> This is not a very nice way to start a commit description.
> 
> Please provide the necessary background to understand your change
> directly in the commit message.
> 
>>
>> I think it's also suitable for other architectures.
>>
> 
> I think this sentence can go in the end of the commit message together
> with your explanation of only doing this for x86.
> 
> By the way, the ARM solution should be pretty simple:
> 
> diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
> index a39a1e1..b9f68e4 100644
> --- a/virt/kvm/arm/arm.c
> +++ b/virt/kvm/arm/arm.c
> @@ -416,6 +416,11 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *v)
>  		&& !v->arch.power_off && !v->arch.pause);
>  }
>  
> +bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu)
> +{
> +	return vcpu_mode_priv(vcpu);
> +}
> +
>  /* Just ensure a guest exit from a particular CPU */
>  static void exit_vm_noop(void *info)
>  {
> 
> 


This one should work for s390x, no caching (or special access patterns
like on x86) needed:

+++ b/arch/s390/kvm/kvm-s390.c
@@ -2447,6 +2447,11 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
        return kvm_s390_vcpu_has_irq(vcpu, 0);
 }

+bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu)
+{
+       return !(vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE);
+}
+
 void kvm_s390_vcpu_block(struct kvm_vcpu *vcpu)
 {
        atomic_or(PROG_BLOCK_SIE, &vcpu->arch.sie_block->prog20);



-- 

Thanks,

David

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC] KVM: optimize the kvm_vcpu_on_spin "Longpeng(Mike)" <longpeng2@huawei.com> - 2017-07-29 08:30 +0200
  Re: [RFC] KVM: optimize the kvm_vcpu_on_spin David Hildenbrand <david@redhat.com> - 2017-07-31 13:40 +0200
    Re: [RFC] KVM: optimize the kvm_vcpu_on_spin "Longpeng (Mike)" <longpeng2@huawei.com> - 2017-07-31 14:20 +0200
      Re: [RFC] KVM: optimize the kvm_vcpu_on_spin David Hildenbrand <david@redhat.com> - 2017-07-31 14:30 +0200
        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
      Re: [RFC] KVM: optimize the kvm_vcpu_on_spin Cornelia Huck <cohuck@redhat.com> - 2017-07-31 14:40 +0200
        Re: [RFC] KVM: optimize the kvm_vcpu_on_spin "Longpeng (Mike)" <longpeng2@huawei.com> - 2017-07-31 15:10 +0200
  Re: [RFC] KVM: optimize the kvm_vcpu_on_spin Christoffer Dall <cdall@linaro.org> - 2017-07-31 15:30 +0200
    Re: [RFC] KVM: optimize the kvm_vcpu_on_spin David Hildenbrand <david@redhat.com> - 2017-07-31 19:40 +0200
      Re: [RFC] KVM: optimize the kvm_vcpu_on_spin Cornelia Huck <cohuck@redhat.com> - 2017-08-01 09:00 +0200
    Re: [RFC] KVM: optimize the kvm_vcpu_on_spin "Longpeng (Mike)" <longpeng2@huawei.com> - 2017-08-01 04:30 +0200
  Re: [RFC] KVM: optimize the kvm_vcpu_on_spin Marc Zyngier <marc.zyngier@arm.com> - 2017-07-31 15:50 +0200
    Re: [RFC] KVM: optimize the kvm_vcpu_on_spin Paolo Bonzini <pbonzini@redhat.com> - 2017-07-31 16:30 +0200

csiph-web