Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Dec 2001 09:19:57 -0800
From:      Luigi Rizzo <rizzo@aciri.org>
To:        arch@freebsd.org
Subject:   swi_net
Message-ID:  <20011213091957.B39991@iguana.aciri.org>

next in thread | raw e-mail | index | archive | help
Hi,
we have 2 slightly different versions of swi_net in -current and
-stable, listed below (STABLE/Alpha is approximately the same as
CURRENT).

I like a lot the semantics of the version in -stable, because it
enforces a strict priority in the execution of soft handlers
(remember they are not preemptable), even when schednetisr(FOO) is
called within one of the handlers.

I understand that in the SMP case it is not simple to achieve the
same semantics without using a spinlock to implement an
"atomic_ffs_and_clear()" type of function (which would still be
cheap in the non-SMP case).

However I was wondering if there are objections in changing the
first line of the CURRENT version in

        for (; bits = atomic_readandclear_int(&netisr); )

so that we process all pending handlers without exiting from the
function and have a closer approximation of what STABLE does.

comments ?

        cheers
        luigi

--------- u2/HEAD/src/sys/kern/kern_intr.c -----------------
static void
swi_net(void *dummy)
{
        u_int bits;
        int i;

        bits = atomic_readandclear_int(&netisr);
        while ((i = ffs(bits)) != 0) {
                i--;
                if (netisrs[i] != NULL)
                        netisrs[i]();
                else
                        printf("swi_net: unregistered isr number: %d.\n", i);
                bits &= ~(1 << i);
        }
}

 
----- STABLE/src/sys/i386/isa/ipl.s -----
 
swi_net:
        MCOUNT
        bsfl    _netisr,%eax
        je      swi_net_done
swi_net_more:
        btrl    %eax,_netisr
        jnc     swi_net_next
        call    *_netisrs(,%eax,4)
swi_net_next:
        bsfl    _netisr,%eax
        jne     swi_net_more
swi_net_done:
        ret
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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