Re: Firing timers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hrtimer, is triggered based on softirq mechanism.   and it can be
triggered whether interrupt is enabled or disabled - two different
modes.

checkout kernel/hrtimer.c.   within u can find the function
enqueue_hrtimer(), which shows how the hrtimer can be enqueued into a
red black tree.   so similarly if u want to enumerate all the
hrtimer....use these rb_xxxx API.

and to identify the timer, inside the hrtimer structure
(include/linux/hrtimer.h) there is a field "start_pid" or
"start_comm", which gave info about the pid or process name which
started the timer.

struct hrtimer {
        struct rb_node                  node;
        ktime_t                         _expires;
        ktime_t                         _softexpires;
        enum hrtimer_restart            (*function)(struct hrtimer *);
        struct hrtimer_clock_base       *base;
        unsigned long                   state;
        struct list_head                cb_entry;
#ifdef CONFIG_TIMER_STATS
        int                             start_pid;
        void                            *start_site;
        char                            start_comm[16];
#endif
};

The callback function "function" in the structure above is called when
timer expired.   The caller is hrtimer_interrupt(), called by
hrtimer_peek_ahead_timers(), called by run_hrtimer_softirq() etc.

On Thu, Jun 25, 2009 at 5:09 PM, Nicola Manica<nicola.manica@xxxxxxxxx> wrote:
> Hi, I'm a student that want to study the kernel code.
> I have a simple question:
> If I set an hrtimer, I think that when it expires it raise a timer
> interrupt. What is the sequence of functions called at this point (in a
> recent kernel for example 2.6.29)?
> How I can know which is the timer expired?
> Thanks for the reply, and maybe sorry for the stupid question.
> Nicola
>



-- 
Regards,
Peter Teoh

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux