:It's too messy and unfinished (doesn't work right for SMP or irqs >= 16),
:and dificult to untangle from my other patches.  I posted these partial
:ones to attempt to inhibit() recomplication of the current critical*
:functions in directions that I don't want to go :-).
:...
:
:ipending here works much as in RELENG_4.  It is ORed into by sched_ithd()
:if curthread->td_critnest != 0.  Nothing special is needed for pci
:(the ICU masks pending interrupts).
:
:Bruce

    Ok, I have most of it coded up.  Could you explain what 'spending'
    was for?

    I am doing it slightly different then you.  To avoid having to use
    locked instructions I have placed ipending in the thread structure:

void
critical_enter(void)
{
        struct thread *td = curthread;
        ++td->td_critnest;
}

void
critical_exit(void)
{
        struct thread *td = curthread;
        KASSERT(td->td_critnest > 0, ("bad td_critnest value!"));
        if (--td->td_critnest == 0) {
                if (td->td_ipending)
                        unpend();
        }
}

    The apic and icu vector code will do a simple td_critnest test and
    OR the irq bit into td->td_ipending (it conveniently already has 
    the struct thread in %ebx).  And the vector code will also check and
    handle any non-zero td_ipending if critnest is 0, handling the 
    1->0 transition/preemption race.

    I'll post the patch when it gets a little further along.

    How should I deal with fast interrupts?

                                        -Matt
                                        Matthew Dillon 
                                        <[EMAIL PROTECTED]>

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to