Re: High vm-exit latencies during kvm boot-up/shutdown

Avi Kivity
2007-10-24T16:52:53Z

Jan Kiszka wrote:
> Avi Kivity wrote:
>
>> Jan Kiszka wrote:
>>
>>> Avi Kivity wrote:
>>>
>>>
>>>> Jan Kiszka wrote:
>>>>
>>>>
>>>>> I ran
>>>>>
>>>>> user/kvmctl user/test/bootstrap user/test/smp.flat
>>>>>
>>>>> with the busy loop hacked into bootstrap, but I got no latency spots
>>>>> this time. And what should I look for in the output of kvm_stat?
>>>>>
>>>>>
>>>>>
>>>>>
>>>> The first numeric column is the total number of exits; the second is the
>>>> rate of change (per second). For a spinning workload, both irq_exits
>>>> and exits rate should equal the timer frequency.
>>>>
>>>>
>>> It matches roughly, but this isn't surprising given the lack of latency
>>> peaks in this scenario.
>>>
>>>
>>>
>> Okay, that's expected. But I really can't think what causes the latency
>> spike you see running the bios code. 300 microseconds is enough for 3000
>> cache misses. No instruction can cause so many except rep movs and
>> friends, and these are supposed to be preemptible.
>>
>> You might try isolating it by adding code to output markers to some I/O
>> port and scattering it throughout the bios. A binary search should find
>> the problem spot quickly.
>>
>>
>
> Got it! It's wbinvd from smm_init in rombios32.c! Anyone any comments on
> this?
>

Ha! A real life 300usec instruction!

Unfortunately, it cannot be trapped on Intel (it can be trapped on
AMD). Looks like a minor hole in VT, as a guest can generate very high
latencies this way.

For our bios, we can remove it, but there's no way to ensure an
untrusted guest doesn't use it.

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