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/
Home Products Support Community News


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

To: "Keir Fraser" <keir.fraser@xxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: RE: [Xen-devel] [RFC] Remove the x86 Periodic 100HZ PIT Timer Interrupt
From: "Yu, Ke" <ke.yu@xxxxxxxxx>
Date: Tue, 8 Apr 2008 09:29:05 +0800
Delivery-date: Mon, 07 Apr 2008 18:35:35 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C41FB012.1ED2B%keir.fraser@xxxxxxxxxxxxx>
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>
References: <1104166E0B63A341805FDB977862AAD2015A4DE0@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <C41FB012.1ED2B%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AciYkFQNYmyqI0NSRKuabH1qVznbFQABlbckAB8ySAA=
Thread-topic: [Xen-devel] [RFC] Remove the x86 Periodic 100HZ PIT Timer Interrupt
Thanks for the comments. 

Keir Fraser wrote:
> On 7/4/08 10:18, "Yu, Ke" <ke.yu@xxxxxxxxx> wrote:
>> xen\arch\x86\io_apic.c
> No, since the whole point of using jiffies is to check that irq0 is
> working. My advice is to leave PIT (irq0) setup as-is during boot,
> and then disable PIT channel 0 at end of boot if you detect that it
> is not required (i.e., you have local APIC, and you are not using PIT
> as platform time source). 

Agree. Will do this way.

>> 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
> Well, bear in mind that we actually schedule the overflow handler
> when the counter is halfway to being wrapped. So actually we schedule
> overflow handling for the above timers every 21.5s, 150s, 2.3s and
> 0.028s, respectively.
> It is okay to use ac_timer logic, triggered off softirq, if we are
> sure that softirq work is guaranteed to be done often enough that the
> overflow handler will run before the counter actually overflows.
> Ignoring the PIT, this means we need a worst-case softirq
> schedule-to-execute latency of 2.3s, which seems pretty reasonable to
> expect! 

Yes. AC timer expire period will be half of the actual overflow period.
Thanks for reminder.

>> 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();
> Yep, something like that. However, you should always do PIT setup,
> and then *disable* it if you don't need it after boot.
> Also, I'd handle PIT overflow a bit differently. The generic overflow
> handling we have in time.c can be changed to use ac timers. I would
> then disable that (effectively) for PIT by having init_pit() expose a
> 32-bit counter, then have the overflow handling for turning a 16-bit
> counter into a 32-bit counter happening behind the scenes. Don't
> worry about this aspect too much though: I'm happy to clean up this
> part myself if you handle the rest of the patch.
>  -- Keir

Not quite understand this point, could you please elaborate more?  And
surely I am happy to leave this for you to clean up :)

The logic in my mind is as follow, just want to make sure it leave
enough space for you to refine PIT handling logic.
1. when xen is booting, setup PIT timer interrupt
2. if Cyclone/HPET/ACPI PM timer is clock source, setup AC timer for the
overflow handling
3. if not using PIT and CPU has APIC, then disable PIT timer interrupt.

Best Regards

Xen-devel mailing list