Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Abel Gordon <ABELG@il.ibm.com>
Cc: gleb@redhat.com, kvm@vger.kernel.org, kvm-owner@vger.kernel.org,
	pbonzini@redhat.com,
	"\"李春奇 <Arthur Chunqi Li>\"" <yzt356@gmail.com>
Subject: Re: [PATCH] KVM: nVMX: Fully support of nested VMX preemption timer
Date: Sun, 25 Aug 2013 09:43:12 +0200	[thread overview]
Message-ID: <5219B590.7040304@web.de> (raw)
In-Reply-To: <OF9CB7F4EC.699F4154-ONC2257BD2.00291A6C-C2257BD2.0029DC65@il.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 2617 bytes --]

On 2013-08-25 09:37, Abel Gordon wrote:
> 
> 
>> From: Jan Kiszka <jan.kiszka@web.de>
>> To: "李春奇 <Arthur Chunqi Li>"  <yzt356@gmail.com>,
>> Cc: kvm@vger.kernel.org, gleb@redhat.com, pbonzini@redhat.com
>> Date: 25/08/2013 09:44 AM
>> Subject: Re: [PATCH] KVM: nVMX: Fully support of nested VMX preemption
> timer
>> Sent by: kvm-owner@vger.kernel.org
>>
>> On 2013-08-24 20:44, root wrote:
>>> This patch contains the following two changes:
>>> 1. Fix the bug in nested preemption timer support. If vmexit L2->L0
>>> with some reasons not emulated by L1, preemption timer value should
>>> be save in such exits.
>>> 2. Add support of "Save VMX-preemption timer value" VM-Exit controls
>>> to nVMX.
>>>
>>> With this patch, nested VMX preemption timer features are fully
>>> supported.
>>>
>>> Signed-off-by: Arthur Chunqi Li <yzt356@gmail.com>
>>> ---
> 
>>>
>>> @@ -7578,9 +7579,14 @@ static void prepare_vmcs02(struct kvm_vcpu
>> *vcpu, struct vmcs12 *vmcs12)
>>>        (vmcs_config.pin_based_exec_ctrl |
>>>         vmcs12->pin_based_vm_exec_control));
>>>
>>> -   if (vmcs12->pin_based_vm_exec_control &
> PIN_BASED_VMX_PREEMPTION_TIMER)
>>> -      vmcs_write32(VMX_PREEMPTION_TIMER_VALUE,
>>> -              vmcs12->vmx_preemption_timer_value);
>>> +   if (vmcs12->pin_based_vm_exec_control &
>> PIN_BASED_VMX_PREEMPTION_TIMER) {
>>> +      if (vmcs12->vm_exit_controls &
> VM_EXIT_SAVE_VMX_PREEMPTION_TIMER)
>>> +         vmcs12->vmx_preemption_timer_value =
>>> +            vmcs_read32(VMX_PREEMPTION_TIMER_VALUE);
>>> +      else
>>> +         vmcs_write32(VMX_PREEMPTION_TIMER_VALUE,
>>> +               vmcs12->vmx_preemption_timer_value);
>>> +   }
>>
>> This is not correct. We still need to set the vmcs to
>> vmx_preemption_timer_value. The difference is that, on exit from L2,
>> vmx_preemption_timer_value has to be updated according to the saved
>> hardware state. The corresponding code is missing in your patch so far.
> 
> I think something else maybe be missing here: assuming L0 handles exits
> for L2 without involving L1 (e.g. external interrupts or ept violations),
> then, we may spend some cycles in L0 handling these exits. Note L1 is not
> aware of these exits and from L1 perspective L2 was running on the CPU.
> That means that we may need to reduce these cycles spent at
> L0 from the preemtion timer or emulate a preemption timer exit to
> force a transition to L1 instead of resuming L2.

That's precisely what the logic I described should achieve: reload the
value we saved on L2 exit on reentry.

Jan



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

  parent reply	other threads:[~2013-08-25  7:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-24 18:44 [PATCH] KVM: nVMX: Fully support of nested VMX preemption timer root
2013-08-25  6:44 ` Jan Kiszka
2013-08-25  7:24   ` Arthur Chunqi Li
2013-08-25  7:28     ` Jan Kiszka
2013-08-25  7:37       ` Arthur Chunqi Li
2013-08-25  7:44         ` Jan Kiszka
2013-08-25  7:49           ` Arthur Chunqi Li
2013-08-25  7:37   ` Abel Gordon
2013-08-25  7:42     ` Arthur Chunqi Li
2013-08-25  7:43     ` Jan Kiszka [this message]
2013-08-25  7:50       ` Abel Gordon
2013-08-25  7:54         ` Jan Kiszka
2013-08-25  8:18           ` Abel Gordon
2013-08-25  8:25             ` Jan Kiszka
2013-08-25  8:27               ` Jan Kiszka
2013-08-25  8:39                 ` Abel Gordon
2013-08-25  8:41             ` Arthur Chunqi Li
2013-08-25  8:53               ` Jan Kiszka
2013-08-25  9:07                 ` Arthur Chunqi Li
2013-08-25  9:08                   ` Jan Kiszka
2013-08-25  7:55         ` Arthur Chunqi Li
2013-08-25  8:04           ` Abel Gordon
2013-08-25  8:13             ` Jan Kiszka

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=5219B590.7040304@web.de \
    --to=jan.kiszka@web.de \
    --cc=ABELG@il.ibm.com \
    --cc=gleb@redhat.com \
    --cc=kvm-owner@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=yzt356@gmail.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