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

Anthony Liguori
2010-12-04T13:48:54Z

On 12/04/2010 02:16 AM, Avi Kivity wrote:
> On 12/04/2010 12:42 AM, Anthony Liguori wrote:
>>
>> In v3, I set the activity state to ACTIVE if the state is currently
>> HLT when injecting an exception into a guest.
>>
>> The effect is that after the exception is handled, if iret is
>> executed, the hlt instruction will be restarted. The seems like the
>> correct semantics to me.
>
> No, an interrupt causes the HLT to be executed, and rip advanced past
> it. You need to preserve this (both for interrupts and for the apf
> completion exception).

Yeah, I see in the architecture manual it specifically calls out the rip
advancing after NMI. It doesn't say anything about debug exceptions
though. It's not clear to me if some exceptions cause hlt to be skipped
and others not.

But then again, skipping hlt seems to be the most conservative thing to
do for all exceptions because it's always going to be run in a loop.

Regards,

Anthony Liguori