clock software interrupt

Andrey Simonenko simon at comsys.ntu-kpi.kiev.ua
Mon Sep 12 07:41:56 PDT 2005


On Sat, Sep 10, 2005 at 09:34:48PM +0200, Zlatan Ibrahimovic wrote:
> Hi folks,
> I've seen clock software interrupt thread (referring to clk_ithd in
> kern/kern_intr.c); watching to manpages I read that priority is used
> as vector for that thread. My question is how can I call this software
> handler? There's no track in the IDT for the associated handler...
> (ia32, for better check see i386/i386/exception.s).

The softclock() function is registered as an another one handler
for SWI_CLOCK by calling the swi_add() function.  Since clk_ithd is
NULL at the moment when swi_add() for softclock() handler is called,
interrupt thread is created for SWI_CLOCK in swi_addr() by the
ithread_create() function.  An interrupt thread is a special kthread
and interrupt threads run ithread_loop() function as the main function
for kthread.  Interrupt handler for the softclock() function is returned
in softclock_ih.

The simplified idea of ithread_loop() is the following: if there is
the request for some handler, then process this request by requested
handler else voluntary switch context.

Another one handler for SWI_CLOCK is siopoll().  If you run
"ps auxw | grep clock" you will see two handlers for swi5
(SWI_CLOCK).

When hardclock() decides that softclock() should be called
is schedules clk_ithd ithread via handler softclock_ih by
calling swi_sched().


More information about the freebsd-hackers mailing list