Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Sep 2005 17:38:26 +0300
From:      Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
To:        Zlatan Ibrahimovic <razzorback2005@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: clock software interrupt
Message-ID:  <20050912143826.GA401@pm514-9.comsys.ntu-kpi.kiev.ua>
In-Reply-To: <e53d4aed05091012343a4b4882@mail.gmail.com>
References:  <e53d4aed05091012343a4b4882@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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().



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050912143826.GA401>