Idle vcpu periodic timer is useless. It increased the lapic timer
interrupt number, which decreased the cpu idle residency. This patch
disables idle vcpu periodic timer via keeping v->periodic_period = 0.
The vcpu periodic timer may be expired 50us before expected time
because there is a 50us TIMER_SLOP used for soft timer (xen/common/timer.c,
timer_softirq_action()). This will cause vcpu_periodic_timer_work() be
continuously called tens of times in a single call of
timer_softirq_action() until (now > periodic_next_event). It brings
unnecessary overhead. This patch adds a similar time slop in vcpu
periodic timer to eliminate this overhead.
Signed-off-by: Wei Gang <gang.wei@intel.com>
else
{
/* PV guests by default have a 100Hz ticker. */
- v->periodic_period = MILLISECS(10);
+ if ( !is_idle_domain(d) )
+ v->periodic_period = MILLISECS(10);
/* PV guests get an emulated PIT too for video BIOSes to use. */
if ( !is_idle_domain(d) && (v->vcpu_id == 0) )
return;
periodic_next_event = v->periodic_last_event + v->periodic_period;
- if ( now > periodic_next_event )
+
+ /* The timer subsystem may call us up to TIME_SLOP ahead of deadline. */
+ if ( (now + TIME_SLOP) > periodic_next_event )
{
send_timer_event(v);
v->periodic_last_event = now;