Re: re(4) diff that needs testing

2013-10-02 Thread Kenneth R Westerback
On Tue, Oct 01, 2013 at 09:32:30PM +0200, Mark Kettenis wrote:
 Some re(4) variants now use msi.  Unfortunately the interrupt handler
 isn't careful enough, and we might miss an interrupt.  The diff below
 seems to fix that by disabling the interrupts while processing an
 interrupt.  This is what FreeBSD  Linux seem to do.
 
 Needs testing on a wide variety of re(4), especially on thoe that
 don't use msi yet.
 
 
 Index: re.c
 ===
 RCS file: /cvs/src/sys/dev/ic/re.c,v
 retrieving revision 1.143
 diff -u -p -r1.143 re.c
 --- re.c  7 Aug 2013 01:06:30 -   1.143
 +++ re.c  21 Aug 2013 19:50:39 -
 @@ -1650,6 +1650,9 @@ re_intr(void *arg)
   if (!(ifp-if_flags  IFF_RUNNING))
   return (0);
  
 + /* Disable interrupts. */
 + CSR_WRITE_2(sc, RL_IMR, 0);
 +
   rx = tx = 0;
   status = CSR_READ_2(sc, RL_ISR);
   /* If the card has gone away the read returns 0x. */
 @@ -1715,6 +1718,8 @@ re_intr(void *arg)
  
   if (tx  !IFQ_IS_EMPTY(ifp-if_snd))
   re_start(ifp);
 +
 + CSR_WRITE_2(sc, RL_IMR, sc-rl_intrs);
  
   return (claimed);
  }
 

Also working fine on amd64 with

re0 at pci3 dev 0 function 0 Realtek 8101E rev 0x02: RTL8102EL (0x2480), msi,
address 3c:4a:92:54:1b:cf
rlphy0 at re0 phy 7: RTL8201L 10/100 PHY, rev. 1

In this case the diff seems to have significantly improved performance and
latency.

 Ken



re(4) diff that needs testing

2013-10-01 Thread Mark Kettenis
Some re(4) variants now use msi.  Unfortunately the interrupt handler
isn't careful enough, and we might miss an interrupt.  The diff below
seems to fix that by disabling the interrupts while processing an
interrupt.  This is what FreeBSD  Linux seem to do.

Needs testing on a wide variety of re(4), especially on thoe that
don't use msi yet.


Index: re.c
===
RCS file: /cvs/src/sys/dev/ic/re.c,v
retrieving revision 1.143
diff -u -p -r1.143 re.c
--- re.c7 Aug 2013 01:06:30 -   1.143
+++ re.c21 Aug 2013 19:50:39 -
@@ -1650,6 +1650,9 @@ re_intr(void *arg)
if (!(ifp-if_flags  IFF_RUNNING))
return (0);
 
+   /* Disable interrupts. */
+   CSR_WRITE_2(sc, RL_IMR, 0);
+
rx = tx = 0;
status = CSR_READ_2(sc, RL_ISR);
/* If the card has gone away the read returns 0x. */
@@ -1715,6 +1718,8 @@ re_intr(void *arg)
 
if (tx  !IFQ_IS_EMPTY(ifp-if_snd))
re_start(ifp);
+
+   CSR_WRITE_2(sc, RL_IMR, sc-rl_intrs);
 
return (claimed);
 }



Re: re(4) diff that needs testing

2009-07-23 Thread Anathae Townsend
(Mark wrote)
 
 This diff switches re(4) over to MCLGETI, bringing goodies like lower
 memory usage and livelock mitigation.  Getting this right usually
 takes some effort.  So please help me with getting this tested if you
 have any machines with re(4).
 
 Thanks,
 
 Mark
 
 
(patch snipped)

no apparent problems here, other than the watchdog timeout at the end of
the dmesg

OpenBSD 4.6-current (GENERIC) #3: Wed Jul 22 16:01:56 MDT 2009
 
r...@rowena.sunnydale.davric.ab.ca:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel(R) Pentium(R) 4 CPU 2.66GHz (GenuineIntel 686-class) 2.67 GHz
cpu0:
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLU
SH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,CNXT-ID,xTPR
real mem  = 1072984064 (1023MB)
avail mem = 1028718592 (981MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 06/15/06, BIOS32 rev. 0 @ 0xf0010,
SMBIOS rev. 2.3 @ 0xf0500 (62 entries)
bios0: vendor American Megatrends Inc. version 1006.002 date 06/15/2006
bios0: ASUSTeK Computer INC. P4S800D-X
acpi0 at bios0: rev 2
acpi0: tables DSDT FACP APIC OEMB
acpi0: wakeup devices PS2K(S4) PS2M(S4) UAR1(S4) EUSB(S3) USB_(S3) USB2(S3)
USB3(S3) AC97(S4) MC97(S4) MAC_(S4) PCI1(S4) PCI2(S4) PCI3(S4) PCI4(S4)
PCI5(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: apic clock running at 133MHz
ioapic0 at mainbus0: apid 1 pa 0xfec0, version 11, 24 pins
ioapic0: misconfigured as apic 0, remapped to apid 1
acpiprt0 at acpi0: bus 0 (PCI0)
acpicpu0 at acpi0
acpibtn0 at acpi0: PWRB
bios0: ROM list: 0xc/0x9800 0xc9800/0x5000
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 SiS 655 PCI rev 0x50
sisagp0 at pchb0
agp0 at sisagp0: aperture at 0xe000, size 0x1000
ppb0 at pci0 dev 1 function 0 SiS 648FX AGP rev 0x00
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 NVIDIA Vanta rev 0x15
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
pcib0 at pci0 dev 2 function 0 SiS 964 ISA rev 0x36
pciide0 at pci0 dev 2 function 5 SiS 5513 EIDE rev 0x01: 655: DMA, channel
0 configured to compatibility, channel 1 configured to compatibility
wd0 at pciide0 channel 0 drive 0: ST3250620A
wd0: 16-sector PIO, LBA48, 238475MB, 488397168 sectors
wd1 at pciide0 channel 0 drive 1: ST3200827A
wd1: 16-sector PIO, LBA48, 190782MB, 390721968 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
wd1(pciide0:0:1): using PIO mode 4, Ultra-DMA mode 5
atapiscsi0 at pciide0 channel 1 drive 1
scsibus0 at atapiscsi0: 2 targets
cd0 at scsibus0 targ 0 lun 0: HL-DT-ST, DVD-RAM GSA-H50L, 1.00 ATAPI
5/cdrom removable
cd0(pciide0:1:1): using PIO mode 4, Ultra-DMA mode 4
auich0 at pci0 dev 2 function 7 SiS 7012 AC97 rev 0xa0: apic 1 int 18 (irq
5), SiS7012 AC97
ac97: codec id 0x41445368 (Analog Devices AD1888)
ac97: codec features headphone, 20 bit DAC, No 3D Stereo
audio0 at auich0
ohci0 at pci0 dev 3 function 0 SiS 5597/5598 USB rev 0x0f: apic 1 int 20
(irq 5), version 1.0, legacy support
ohci1 at pci0 dev 3 function 1 SiS 5597/5598 USB rev 0x0f: apic 1 int 21
(irq 5), version 1.0, legacy support
ohci2 at pci0 dev 3 function 2 SiS 5597/5598 USB rev 0x0f: apic 1 int 22
(irq 10), version 1.0, legacy support
ehci0 at pci0 dev 3 function 3 SiS 7002 USB rev 0x00: apic 1 int 23 (irq
3)
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 SiS EHCI root hub rev 2.00/1.00 addr 1
sis0 at pci0 dev 4 function 0 SiS 900 10/100BaseTX rev 0x91: apic 1 int 19
(irq 5), address 00:18:f3:18:72:66
rlphy0 at sis0 phy 1: RTL8201L 10/100 PHY, rev. 1
pciide1 at pci0 dev 5 function 0 SiS 180 SATA rev 0x01: DMA
pciide1: using apic 1 int 17 (irq 10) for native-PCI interrupt
re0 at pci0 dev 8 function 0 Realtek 8169 rev 0x10: RTL8110S (0x0400),
apic 1 int 16 (irq 11), address 00:14:6c:8e:b6:e6
rgephy0 at re0 phy 7: RTL8169S/8110S PHY, rev. 0
pciide2 at pci0 dev 10 function 0 Promise PDC40718 rev 0x02: DMA
wd2 at pciide2 channel 1 drive 0: ST3500320AS
wd2: 16-sector PIO, LBA48, 476940MB, 976773168 sectors
wd2(pciide2:1:0): using BIOS timings, Ultra-DMA mode 6
wd3 at pciide2 channel 3 drive 0: ST3500320AS
wd3: 16-sector PIO, LBA48, 476940MB, 976773168 sectors
wd3(pciide2:3:0): using BIOS timings, Ultra-DMA mode 6
pciide2: using apic 1 int 18 (irq 5) for native-PCI interrupt
isa0 at pcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pmsi0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at pmsi0 mux 0
pcppi0 at isa0 port 0x61
midi0 at pcppi0: PC speaker
spkr0 at pcppi0
lpt0 at isa0 port 0x378/4 irq 7
wbsio0 at isa0 port 0x2e/2: W83627THF rev 0x84
lm1 at wbsio0 port 0x290/8: W83627THF
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
fd0 at fdc0 

Re: re(4) diff that needs testing

2009-07-23 Thread Bryan Linton
On 2009-07-22 23:18:18, Mark Kettenis mark.kette...@xs4all.nl wrote:
 This diff switches re(4) over to MCLGETI, bringing goodies like lower
 memory usage and livelock mitigation.  Getting this right usually
 takes some effort.  So please help me with getting this tested if you
 have any machines with re(4).
 
 Thanks,
 
 Mark


Been running it for a day with no problems.

re0 at pci0 dev 11 function 0 Realtek 8169 rev 0x10: RTL8110S (0x0400), irq 
10, address 00:e0:4c:77:5a:88
rgephy0 at re0 phy 7: RTL8169S/8110S PHY, rev. 0


OpenBSD 4.6-current (SHOSHONI) #25: Thu Jul 23 05:34:25 PDT 2009
r...@shoshoni.shoshoni.info:/usr/src/sys/arch/i386/compile/SHOSHONI
cpu0: AMD Athlon(tm) Processor (AuthenticAMD 686-class, 256KB L2 cache) 1.01 
GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR
real mem  = 804786176 (767MB)
avail mem = 768827392 (733MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 04/23/02, BIOS32 rev. 0 @ 0xf0f80, SMBIOS 
rev. 2.3 @ 0xf2940 (49 entries)
bios0: vendor Award Software, Inc. version ASUS A7V ACPI BIOS Revision 1011 
date 04/23/2002
bios0: ASUSTeK Computer INC. A7V
apm0 at bios0: Power Management spec V1.2
apm0: AC on, battery charge unknown
acpi at bios0 function 0x0 not configured
pcibios0 at bios0: rev 2.1 @ 0xf/0x1802
pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xf1750/176 (9 entries)
pcibios0: PCI Interrupt Router at 000:04:0 (VIA VT82C686 ISA rev 0x00)
pcibios0: PCI bus #1 is the last bus
bios0: ROM list: 0xc/0xf400 0xd/0x4000!
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 VIA VT8363 Host rev 0x02
viaagp0 at pchb0: v2
agp0 at viaagp0: aperture at 0xe000, size 0x1000
ppb0 at pci0 dev 1 function 0 VIA VT8363 AGP rev 0x00
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 ATI Radeon X1300/X1550 rev 0x00
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
radeondrm0 at vga1: irq 11
drm0 at radeondrm0
ATI Radeon X1300/X1550 Sec rev 0x00 at pci1 dev 0 function 1 not configured
pcib0 at pci0 dev 4 function 0 VIA VT82C686 ISA rev 0x22
pciide0 at pci0 dev 4 function 1 VIA VT82C571 IDE rev 0x10: ATA66, channel 0 
configured to compatibility, channel 1 configured to compatibility
wd0 at pciide0 channel 0 drive 0: ST3500641A
wd0: 16-sector PIO, LBA48, 476940MB, 976773168 sectors
wd1 at pciide0 channel 0 drive 1: Maxtor 6B200P0
wd1: 16-sector PIO, LBA48, 194481MB, 398297088 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 4
wd1(pciide0:0:1): using PIO mode 4, Ultra-DMA mode 4
atapiscsi0 at pciide0 channel 1 drive 0
scsibus0 at atapiscsi0: 2 targets
cd0 at scsibus0 targ 0 lun 0: PLEXTOR, DVDR PX-708A, 1.03 ATAPI 5/cdrom 
removable
atapiscsi1 at pciide0 channel 1 drive 1
scsibus1 at atapiscsi1: 2 targets
cd1 at scsibus1 targ 0 lun 0: ASUS, DVD-ROM E608, 1.40 ATAPI 5/cdrom removable
cd0(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 2
cd1(pciide0:1:1): using PIO mode 4, Ultra-DMA mode 2
uhci0 at pci0 dev 4 function 2 VIA VT83C572 USB rev 0x10: irq 9
uhci1 at pci0 dev 4 function 3 VIA VT83C572 USB rev 0x10: irq 9
viaenv0 at pci0 dev 4 function 4 VIA VT82C686 SMBus rev 0x30: HWM disabled: 
24-bit timer at 3579545Hz
rl0 at pci0 dev 9 function 0 Accton MPX 5030/5038 rev 0x10: irq 9, address 
00:e0:29:6b:73:e3
rlphy0 at rl0 phy 0: RTL internal PHY
emu0 at pci0 dev 10 function 0 Creative Labs SoundBlaster Live rev 0x07: irq 5
ac97: codec id 0x54524123 (TriTech Microelectronics TR28602)
audio0 at emu0
Creative Labs PCI Gameport Joystick rev 0x07 at pci0 dev 10 function 1 not 
configured
re0 at pci0 dev 11 function 0 Realtek 8169 rev 0x10: RTL8110S (0x0400), irq 
10, address 00:e0:4c:77:5a:88
rgephy0 at re0 phy 7: RTL8169S/8110S PHY, rev. 0
sili0 at pci0 dev 12 function 0 CMD Technology SiI3124 SATA rev 0x02: irq 11
scsibus2 at sili0: 4 targets
sd0 at scsibus2 targ 3 lun 0: ATA, WDC WD7500AAKS-0, 30.0 SCSI3 0/direct fixed
sd0: 715404MB, 512 bytes/sec, 1465149168 sec total
uhci2 at pci0 dev 13 function 0 VIA VT83C572 USB rev 0x61: irq 9
uhci3 at pci0 dev 13 function 1 VIA VT83C572 USB rev 0x61: irq 11
ehci0 at pci0 dev 13 function 2 VIA VT6202 USB rev 0x63, applying VIA VT6202 
workaround: irq 10
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 VIA EHCI root hub rev 2.00/1.00 addr 1
pciide1 at pci0 dev 17 function 0 Promise PDC20265 rev 0x02: DMA, channel 0 
configured to native-PCI, channel 1 configured to native-PCI
pciide1: using irq 10 for native-PCI interrupt
pciide1: channel 0 disabled (no drives)
pciide1: channel 1 disabled (no drives)
isa0 at pcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pms0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at pms0 mux 0