Re: [PATCH] kvm-vmx: add module parameter to avoid trapping HLT instructions (v2)

Anthony Liguori
2010-12-06T14:03:34Z

On 12/06/2010 08:01 AM, Avi Kivity wrote:
> On 12/06/2010 03:58 PM, Anthony Liguori wrote:
>> On 12/06/2010 02:35 AM, Avi Kivity wrote:
>>> On 12/06/2010 10:28 AM, Avi Kivity wrote:
>>>>> I wasn't sure about this. Don't you want EIP to point to the
>>>>> beginning of the instruction such that the exception will cause
>>>>> the instruction to restart?
>>>>
>>>>
>>>> An interrupt causes the HLT to complete execution. APF completion
>>>> counts as an interrupt in this case.
>>>>
>>>
>>> btw, it's possible a VMEXIT during HLT returns RIP already advanced
>>> past the HLT instruction. Please check if this is the case.
>>
>> It's not just possible, it appears to be exactly what happens.
>>
>> I guess it makes sense that RIP gets advanced before HLT begins to wait.
>>
>
> It does. Good, it simplifies the patch.

Any ideas if the unit test framework can be used to validate this? The
behavior makes perfect sense but I wanted an excuse to play around with
it :-)

Not sure if there's a way to validate VMCS state after a hand crafted exit.

Regards,

Anthony Liguori