From owner-freebsd-arch Thu Dec 13 9:20: 0 2001 Delivered-To: freebsd-arch@freebsd.org Received: from iguana.aciri.org (iguana.aciri.org [192.150.187.36]) by hub.freebsd.org (Postfix) with ESMTP id D98CB37B416 for ; Thu, 13 Dec 2001 09:19:57 -0800 (PST) Received: (from rizzo@localhost) by iguana.aciri.org (8.11.3/8.11.1) id fBDHJvf40251; Thu, 13 Dec 2001 09:19:57 -0800 (PST) (envelope-from rizzo) Date: Thu, 13 Dec 2001 09:19:57 -0800 From: Luigi Rizzo To: arch@freebsd.org Subject: swi_net Message-ID: <20011213091957.B39991@iguana.aciri.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.23i Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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