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

Avi Kivity
2010-12-06T08:32:25Z

On 12/04/2010 03:48 PM, Anthony Liguori wrote:
>> 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.

Instruction breakpoints are triggered before HLT executes; and HLT can't
trigger data breakpoints.

> It's not clear to me if some exceptions cause hlt to be skipped and
> others not.

Faults take place before HLT is executed (and thus don't advance RIP).
Interrupts take place during HLT execution and cause it to complete.

>
> 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.

There's no "all exceptions" here. Only interrupts can happen, and the
APF completion, which is wired to a fault vector, but we must treat it
as an interrupt.

--
error compiling committee.c: too many arguments to function