Hi,

The call to preempt from sparc interrupt.s is to avoid interrupts running
endlessly on a cpu while pinning an interrupted thread (which could run
on another cpu if only we'd unpin it).  In sparc new interrupts can be
queued at the pil we're servicing even while we are serviving preexisting
requests (new requests come in at traplevel 1 via vec_interrupt).
x86 does not require this check.

The thing to remember regarding preemption "only" happening at the
points you mention is that poke_cpu may force a cpu to go through
the return-from-trap code.  poke_cpu is used from dispatcher code
when we decide that a cpu should stop running what it is doing (eg
lower priority than something else we have in hand, or out
of quantum) and the cpu running the dispatcher code "pokes at"
the other cpu to force it through rtt code where it will notice
a flag saying "get off".

That flag is t_astflag in the thread structure - you'll see it
checked in user_rtt for sparc and in lwp_rtt for x86.
Exactly how you get there is left as an exercise (ie it
is convoluted).

Hope that helps

Gavin

On 03/22/06 10:16, Oliver Yang wrote:
Hi ,

I have a question about user preemption in Solaris.

As I known, user preemptions are happened when the kernel returns from a trap, a interrupt handler or a system call.

Checking with openSolaris code, I can find preempt is called by post_syscall as below:


http://cvs.opensolaris.org/source/xref/on/usr/src/uts/intel/ia32/os/syscall.c#712

   438 /*
   439  * Post-syscall processing.  Perform abnormal system call completion
440 * actions such as /proc tracing, profiling, signals, preemption, etc.
   441  *
442 * This routine is called only if t_post_sys, t_sig_check, or t_astflag is set. 443 * Any condition requiring pre-syscall handling must set one of these. 444 * If the condition is persistent, this routine will repost t_post_sys.
   445  */
   446 void
   447 post_syscall(long rval1, long rval2)
   448 {

............................................................................... ...............................................................................

   712     if (CPU->cpu_runrun)
   713         preempt();


I also can find preempt is called by trap.c, but I couldn't find it from x86's interrupt.s :

http://cvs.opensolaris.org/source/xref/on/usr/src/uts/i86pc/ml/interrupt.s

Comparing with x86, I can find "call preempt" in interrupt.s code of sparc:

http://cvs.opensolaris.org/source/xref/on/usr/src/uts/sun4/ml/interrupt.s#753

So my question is, what's wrong with x86's interrupt.s? Is it a bug?




_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to