lkml.org 
[lkml]   [2017]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/3] KVM: X86: implement the logic for spinlock optimization
From
Date
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

\
 
 \ /
  Last update: 2017-08-07 12:47    [W:0.121 / U:0.944 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site