From owner-freebsd-current@FreeBSD.ORG Wed Mar 22 21:33:41 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 99A5716A401; Wed, 22 Mar 2006 21:33:41 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id E4DC243D78; Wed, 22 Mar 2006 21:33:40 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from localhost (john@localhost [127.0.0.1]) by server.baldwin.cx (8.13.4/8.13.4) with ESMTP id k2MLXdEa021888; Wed, 22 Mar 2006 16:33:40 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-current@freebsd.org Date: Wed, 22 Mar 2006 16:32:52 -0500 User-Agent: KMail/1.9.1 References: <11503.1143060087@critter.freebsd.dk> In-Reply-To: <11503.1143060087@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603221632.55795.jhb@freebsd.org> X-Virus-Scanned: ClamAV 0.87.1/1350/Wed Mar 22 05:12:47 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-3.7 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx Cc: Luigi Rizzo , Poul-Henning Kamp , current@freebsd.org Subject: Re: interesting(?) data on network interrupt servicing X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Mar 2006 21:33:41 -0000 On Wednesday 22 March 2006 15:41, Poul-Henning Kamp wrote: > In message <20060322122906.A41691@xorpc.icir.org>, Luigi Rizzo writes: > > > if (thread) > > isrc->is_pic->pic_disable_source(isrc, PIC_EOI); > > > >I have no idea, though, why the other pic_disable_source() > >is so expensive. The 4-5k TSC ticks are approx 3us > > > >Any clues ? > > ISA bus access. Not for APIC. Still, the I/O APIC for modern systems lives out on the PCI bus, so you are talking about PCI bus access. Here's one patch you can try (I've not got benchmarks to show if it helps at all). It cuts this function down from a PCI read and then a PCI write to just a PCI write: --- //depot/vendor/freebsd/src/sys/i386/i386/io_apic.c 2005/11/16 20:30:33 +++ //depot/user/jhb/acpipci/i386/i386/io_apic.c 2005/11/21 19:21:59 @@ -90,6 +90,7 @@ u_int io_masked:1; int io_dest:5; int io_bus:4; + uint32_t io_lowreg; }; struct ioapic { @@ -208,9 +209,7 @@ mtx_lock_spin(&icu_lock); if (intpin->io_masked) { - flags = ioapic_read(io->io_addr, - IOAPIC_REDTBL_LO(intpin->io_intpin)); - flags &= ~(IOART_INTMASK); + flags = intpin->io_lowreg & ~IOART_INTMASK; ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin), flags); intpin->io_masked = 0; @@ -227,9 +226,7 @@ mtx_lock_spin(&icu_lock); if (!intpin->io_masked && !intpin->io_edgetrigger) { - flags = ioapic_read(io->io_addr, - IOAPIC_REDTBL_LO(intpin->io_intpin)); - flags |= IOART_INTMSET; + flags = intpin->io_lowreg | IOART_INTMSET; ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin), flags); intpin->io_masked = 1; @@ -320,6 +317,7 @@ /* Write the values to the APIC. */ mtx_lock_spin(&icu_lock); + intpin->io_lowreg = low; ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin), low); value = ioapic_read(io->io_addr, IOAPIC_REDTBL_HI(intpin->io_intpin)); value &= ~IOART_DEST; -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org