WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [RFC] Remove the x86 Periodic 100HZ PIT Timer Interrupt

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [RFC] Remove the x86 Periodic 100HZ PIT Timer Interrupt
From: "Yu, Ke" <ke.yu@xxxxxxxxx>
Date: Mon, 7 Apr 2008 17:18:23 +0800
Delivery-date: Mon, 07 Apr 2008 02:19:05 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AciYkFQNYmyqI0NSRKuabH1qVznbFQ==
Thread-topic: [RFC] Remove the x86 Periodic 100HZ PIT Timer Interrupt
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