On Mon, Sep 05, 2005 at 08:44:25AM +0100, Russell King wrote:
> Exactly where it is. It's there because of the problem you allude to
> above - it's there to catch up system time. Any generic code can't
> answer the question "how much time has passed since we disabled the
> timer" without additional information.
>
> However, we could change "handler" to be a function pointer which
> returns the number of missed ticks instead, and then updates the
> kernels time and tick keeping. That would probably be more efficient.
This is precisely what I have done. I have made cur_timer->mark-offset() to
return the lost ticks and update wall-time from the callee, which
can be either timer_interrupt handler or in dyn-tick case the dyn-tick
code (I have called it dyn_tick_interrupt) which is called before processing
_any_ interrupt. If ARM had a timer_opts equivalent we could have followed
the same approach i.e remove 'handler' member and call dyn_tick_interrupt
as first step in __do_irq/do_IRQ to process whatever it wants (recover wall
time, start PIT timer in case of x86 etc). This is the definition of
dyn_tick_interrupt that I have in my patch:
~~~~~~~~~~~~~
asm-i386/dyn-tick.h:
#ifdef CONFIG_NO_IDLE_HZ
extern void dyn_tick_interrupt(int irq, struct pt_regs *regs);
#else
static inline void dyn_tick_interrupt(int irq, struct pt_regs *regs)
{
}
#endif
And dyn_tick_interrupt is coded as:
arch/i386/kernel/dyn-tick.c:
void dyn_tick_interrupt(int irq, struct pt_regs *regs)
{
int all_were_sleeping = 0;
int cpu = smp_processor_id();
if (!cpu_isset(cpu, nohz_cpu_mask))
return;
spin_lock(&dyn_tick_lock);
if (cpus_equal(nohz_cpu_mask, cpu_online_map))
all_were_sleeping = 1;
cpu_clear(cpu, nohz_cpu_mask);
if (all_were_sleeping) {
/* Recover jiffies */
if (irq) {
int lost;
lost = cur_timer->mark_offset();
if (lost)
do_timer(regs);
}
if (cpu_has_local_apic())
enable_pit_timer();
}
spin_unlock(&dyn_tick_lock);
if (cpu_has_local_apic())
/* Fixme: Needs to be more accurate */
reprogram_apic_timer(1);
else
reprogram_pit_timer(1);
conditional_run_local_timers();
/* Fixme: Enable NMI watchdog */
}
~~~~~~~~~~~
Considering that ARM does not have any of that timer_opts structure,
could you call into INT_OS_TIMER handler from dyn_tick_interrupt? AFAICS,
INT_OS_TIMER handler and dyn_tick->handler is same ..
--
Thanks and Regards,
Srivatsa Vaddagiri,
Linux Technology Center,
IBM Software Labs,
Bangalore, INDIA - 560017
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|