Re: interesting(?) data on network interrupt servicing

From: John Baldwin <jhb_at_freebsd.org>
Date: Wed, 22 Mar 2006 16:32:52 -0500
On Wednesday 22 March 2006 15:41, Poul-Henning Kamp wrote:
> In message <20060322122906.A41691_at_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
_at__at_ -90,6 +90,7 _at__at_
 	u_int io_masked:1;
 	int io_dest:5;
 	int io_bus:4;
+	uint32_t io_lowreg;
 };
 
 struct ioapic {
_at__at_ -208,9 +209,7 _at__at_
 
 	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;
_at__at_ -227,9 +226,7 _at__at_
 
 	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;
_at__at_ -320,6 +317,7 _at__at_
 
 	/* 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 <jhb_at_FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
Received on Wed Mar 22 2006 - 20:33:41 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:54 UTC