lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <fe86608e-7c1b-b21d-2a63-812cc07970a6@redhat.com>
Date:   Mon, 7 Aug 2017 15:16:15 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     "Longpeng(Mike)" <longpeng.mike@...il.com>
Cc:     "Longpeng(Mike)" <longpeng2@...wei.com>, rkrcmar@...hat.com,
        agraf@...e.com, borntraeger@...ibm.com, cohuck@...hat.com,
        christoffer.dall@...aro.org, marc.zyngier@....com,
        james.hogan@...tec.com, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, weidong.huang@...wei.com,
        arei.gonglei@...wei.com, wangxinxin.wang@...wei.com,
        david@...hat.com
Subject: Re: [PATCH 2/3] KVM: X86: implement the logic for spinlock
 optimization

On 07/08/2017 14:28, Longpeng(Mike) wrote:
> * kvm_arch_spin_in_kernel() returns whether the vcpu (which exits due to
> spinlock) is CPL=0. It only be called by kvm_vcpu_on_spin(), and the
> input vcpu is 'me' which get a PAUSE exit now. *
> 
> I split kvm_arch_vcpu_in_kernel(in RFC) into two functions:
> kvm_arch_spin_in_kernel and kvm_arch_preempt_in_kernel
> 
> Because of KVM/VMX L1 never set CPU_BASED_PAUSE_EXITING and only set
> SECONDARY_EXEC_PAUSE_LOOP_EXITING if supported, so for L1:

I understand better now.  I think vmx.c should just return true from
vmx_spin_in_kernel.  However, kvm_arch_vcpu_spin_in_kernel is not
necessary.  Instead you should make "in_kern" an argument to
kvm_vcpu_on_spin (maybe renamed to "yield_to_kernel_mode_vcpu").

Then vmx.c can just call "kvm_vcpu_on_spin(vcpu, true)".

> 1. get a PAUSE exit with CPL=0 if PLE is supported
> 2. never get a PAUSE exit if don't support PLE
> 
> So, I think it can direct return true(CPL=0) if supports PLE.
> 
> But for nested KVM/VMX(I'm not familiar with nested), it could set
> CPU_BASED_PAUSE_EXITING, so I think get_cpl() is also needed.

If the nested hypervisor sets CPU_BASED_PAUSE_EXITING, a PAUSE vmexit
while running a nested guest would be reflected to the nested
hypervisor.  So you wouldn't get to handle_pause and thus to
kvm_vcpu_on_spin.

Thanks,

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ