In X86, there is 100HZ 8254 PIT timer interrupt (xen/arch/x86/time.c
timer_interrupt). This interrupt set a 10ms theoretical upper limit for
C state residency. Every 10ms, processor must wake up from C state to
service this interrupt. Since ACPI Cx support feature is under
development, it is time to condider removing this upper limit. This
email present a proposal to address this issue and allow xen to stay in
C state for longer time, and thus make xen more power friendly.
This proposal firstly exam the functionality of PIT timer interrupt, and
then discuss the way to replace these functionality.
* PIT timer interrupt handler in xen/arch/x86/time.c timer_interrupt()
has three functionalities
- increase jiffies: jiffies++
- if CPU has no APIC support, raise TIMER_SOFTIRQ
- if platform timer counter overflow, call plt_overflow() to fold
platform timer to 64 bit.
* How to handle jiffies
Since there are only several places using jiffies (see below), so it is
easy to replace jiffies by NOW() API
xen\drivers\passthrough\vtd\intremap.c
xen\drivers\passthrough\vtd\iommu.c
xen\arch\x86\io_apic.c
* How to raise TIMER_SOFTIRQ if CPU has no APIC
Since it rare that CPU has no APIC, so this case will not be optimized.
If CPU has no APIC support, we will still use PIT timer to raise
TIMER_SOFTIRQ
* How to handle platform timer counter overflow
Since IBM cyclone timer/HPET timer/ACPI PM timer has large overflow
period (> 1s), so it is safe to use AC timer to handle the overflow. For
PIT timer counter, it has pretty small overflow period (0.055s), so
still use PIT timer interrupt to handle PIT timer counter overflow, to
guarantee its accuracy.
P.S. the platform timer counter overflow period is as follow
- IBM cyclone timer 32bit counter overflows every 42.9s
- HPET timer 32bit counter overflows every ~300s (in ICH7/8/9)
- ACPI PM timer 24bit counter overflows every 4.6s
- PIT timer 16bit counter overflows every 0.055s
In summary, to remove the PIT timer interrupt, we can
- replace jiffies usage by NOW()
- if Cyclone/HPET/ACPI is used as platform timer souce, use AC timer to
handle overflow.
- if CPU has no APIC support, or PIT is used as platform timer source,
still enable and setup PIT timer interrupt. And the timer_interrupt()
will look like this:
if ( !cpu_has_apic )
raise_softirq(TIMER_SOFTIRQ);
if ( using_pit && --plt_overflow_jiffies == 0 )
plt_overflow();
Any comment is welcome.
Best Regards
Ke
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|