Re: vtime accounting

Wanpeng Li
2017-03-27T12:29:37Z

2017-03-24 23:04 GMT+08:00 Rik van Riel <riel@redhat.com>:
> On Wed, 2017-03-15 at 09:43 +0100, Christoffer Dall wrote:
>
>> Yes, I think the key is whether you end up taking a timer interrupt
>> before or after switchign PF_VCPU. So you can spend X jiffies in the
>> guest, come back, change PF_VCPU (timer still hasen't expired), and
>> then
>> the timer expires immediately afterwards, and the whole block of
>> jiffies
>> that are incremented as a result of the timer gets accounted as
>> kernel
>> time.
>>
>> (Note that jiffies on clocksourced architectures is an arbitrary
>> number,
>> which somehow scales according to the clocksource frequency,
>> depending
>> on the CONFIG_HZ, so a single timer interrupt can increment jiffies
>> by
>> more than 1.
>>
>
> That really should not happen with nohz_full.
>
> The housekeeping CPU should get a timer interrupt
> every jiffy, unless something changed recently that
> I am not aware of.

Agreed, the timer interrupt of the housekeeping cpu will not stop w/ nohz_full.

__tick_nohz_idle_enter()
-> can_stop_idle_tick()
-> if (tick_nohz_full_enabled())
if (tick_do_timer_cpu == cpu)
return false;

Regards,
Wanpeng Li