On Tue, 1 Oct 2013 21:32:30 +0200 (CEST)
Mark Kettenis <mark.kette...@xs4all.nl> 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.
>

Works fine here too, on the slowest laptop in the history of the world.

re0 at pci4 dev 0 function 0 "Realtek 8101E" rev 0x05: RTL8105E (0x4080), msi, 
address 18:67:b0:37:09:63
rlphy0 at re0 phy 7: RTL8201E 10/100 PHY, rev. 2

I had lots of watchdog timeouts before this change.

OpenBSD 5.4-current (GENERIC.MP) #0: Tue Oct  8 11:38:27 CEST 2013
    tpf...@example.com:/usr/src/sys/arch/i386/compile/GENERIC.MP
cpu0: AMD E2-2000 APU with Radeon(tm) HD Graphics ("AuthenticAMD" 686-class, 
512KB L2 cache) 1.75 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,NXE,MMXX,FFXSR,LONG,SSE3,MWAIT,SSSE3,CX16,POPCNT,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,IBS,SKINIT,WDT,ITSC
real mem  = 2521894912 (2405MB)
avail mem = 2468945920 (2354MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 12/22/11, SMBIOS rev. 2.7 @ 0xeb430 (39 
entries)
bios0: vendor American Megatrends Inc. version "P03RBN.098.130409.KK" date 
04/09/2013
bios0: SAMSUNG ELECTRONICS CO., LTD. 275E4E/275E5E
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP APIC FPDT MCFG MSDM HPET BGRT SSDT SSDT
acpi0: wakeup devices SBAZ(S4) PE20(S4) PE21(S4) PE22(S4) PE23(S4) P0PC(S4) 
PCE6(S4) PWRB(S3)
acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: apic clock running at 199MHz
cpu1 at mainbus0: apid 1 (application processor)
cpu1: AMD E2-2000 APU with Radeon(tm) HD Graphics ("AuthenticAMD" 686-class, 
512KB L2 cache) 1.75 GHz
cpu1: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,NXE,MMXX,FFXSR,LONG,SSE3,MWAIT,SSSE3,CX16,POPCNT,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,IBS,SKINIT,WDT,ITSC
ioapic0 at mainbus0: apid 3 pa 0xfec00000, version 21, 24 pins
acpimcfg0 at acpi0 addr 0xe0000000, bus 0-255
acpihpet0 at acpi0: 14318180 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 3 (PE20)
acpiprt2 at acpi0: bus -1 (PE21)
acpiprt3 at acpi0: bus 6 (PE22)
acpiprt4 at acpi0: bus -1 (PE23)
acpiprt5 at acpi0: bus -1 (BR15)
acpiprt6 at acpi0: bus -1 (PCE7)
acpiprt7 at acpi0: bus -1 (PCE8)
acpiprt8 at acpi0: bus 1 (PCE4)
acpiprt9 at acpi0: bus -1 (PCE6)
acpiec0 at acpi0
acpicpu0 at acpi0: C2, PSS
acpicpu1 at acpi0: C2, PSS
acpibtn0 at acpi0: PWRB
acpiac0 at acpi0: AC unit offline
acpibat0 at acpi0: BAT1 not present
acpibtn1 at acpi0: LID_
acpivideo0 at acpi0: VGA_
acpivideo1 at acpi0: VGA_
acpivideo2 at acpi0: VGA_
bios0: ROM list: 0xc0000/0xee00
cpu0: 1747 MHz: speeds: 1750 1400 875 MHz
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "AMD AMD64 14h Host" rev 0x00
vga1 at pci0 dev 1 function 0 "ATI Radeon HD 7340" rev 0x00
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
azalia0 at pci0 dev 1 function 1 "ATI Radeon HD 6310 HD Audio" rev 0x00: msi
azalia0: no supported codecs
ppb0 at pci0 dev 4 function 0 "AMD AMD64 14h PCIE" rev 0x00: apic 3 int 16
pci1 at ppb0 bus 1
ahci0 at pci0 dev 17 function 0 "AMD Hudson-2 SATA" rev 0x40: msi, AHCI 1.3
scsibus0 at ahci0: 32 targets
sd0 at scsibus0 targ 0 lun 0: <ATA, HGST HTS545050A7, GG2O> SCSI3 0/direct 
fixed naa.5000cca73ae5305b
sd0: 476940MB, 512 bytes/sector, 976773168 sectors
cd0 at scsibus0 targ 1 lun 0: <Slimtype, DVD A DU8A5SH, NS21> ATAPI 5/cdrom 
removable
ohci0 at pci0 dev 18 function 0 "AMD Hudson-2 USB" rev 0x11: apic 3 int 18, 
version 1.0, legacy support
ehci0 at pci0 dev 18 function 2 "AMD Hudson-2 USB2" rev 0x11: apic 3 int 17
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "AMD EHCI root hub" rev 2.00/1.00 addr 1
ohci1 at pci0 dev 19 function 0 "AMD Hudson-2 USB" rev 0x11: apic 3 int 18, 
version 1.0, legacy support
ehci1 at pci0 dev 19 function 2 "AMD Hudson-2 USB2" rev 0x11: apic 3 int 17
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 "AMD EHCI root hub" rev 2.00/1.00 addr 1
piixpm0 at pci0 dev 20 function 0 "AMD Hudson-2 SMBus" rev 0x14: polling
iic0 at piixpm0
spdmem0 at iic0 addr 0x51: 4GB DDR3 SDRAM PC3-12800 SO-DIMM
azalia1 at pci0 dev 20 function 2 "AMD Hudson-2 HD Audio" rev 0x01: apic 3 int 
16
azalia1: codecs: Realtek ALC269
audio0 at azalia1
pcib0 at pci0 dev 20 function 3 "AMD Hudson-2 LPC" rev 0x11
ppb1 at pci0 dev 20 function 4 "AMD Hudson-2 PCI" rev 0x40
pci2 at ppb1 bus 2
ohci2 at pci0 dev 20 function 5 "AMD Hudson-2 USB" rev 0x11: apic 3 int 18, 
version 1.0, legacy support
sdhc0 at pci0 dev 20 function 7 "AMD Hudson-2 SD Host Controller" rev 0x00: 
apic 3 int 16
sdhc0 at 0x10: can't map registers
ppb2 at pci0 dev 21 function 0 "AMD Hudson-2 PCIE" rev 0x00: apic 3 int 16
pci3 at ppb2 bus 3
"Atheros AR9485" rev 0x01 at pci3 dev 0 function 0 not configured
ppb3 at pci0 dev 21 function 2 "AMD Hudson-2 PCIE" rev 0x00
pci4 at ppb3 bus 6
re0 at pci4 dev 0 function 0 "Realtek 8101E" rev 0x05: RTL8105E (0x4080), msi, 
address 18:67:b0:37:09:63
rlphy0 at re0 phy 7: RTL8201E 10/100 PHY, rev. 2
ohci3 at pci0 dev 22 function 0 "AMD Hudson-2 USB" rev 0x11: apic 3 int 18, 
version 1.0, legacy support
ehci2 at pci0 dev 22 function 2 "AMD Hudson-2 USB2" rev 0x11: apic 3 int 17
usb2 at ehci2: USB revision 2.0
uhub2 at usb2 "AMD EHCI root hub" rev 2.00/1.00 addr 1
pchb1 at pci0 dev 24 function 0 "AMD AMD64 14h Link Cfg" rev 0x43
pchb2 at pci0 dev 24 function 1 "AMD AMD64 14h Address Map" rev 0x00
pchb3 at pci0 dev 24 function 2 "AMD AMD64 14h DRAM Cfg" rev 0x00
km0 at pci0 dev 24 function 3 "AMD AMD64 14h Misc Cfg" rev 0x00
pchb4 at pci0 dev 24 function 4 "AMD AMD64 14h CPU Power" rev 0x00
pchb5 at pci0 dev 24 function 5 "AMD AMD64 14h Reserved" rev 0x00
pchb6 at pci0 dev 24 function 6 "AMD AMD64 14h NB Power" rev 0x00
pchb7 at pci0 dev 24 function 7 "AMD AMD64 14h Reserved" rev 0x00
usb3 at ohci0: USB revision 1.0
uhub3 at usb3 "AMD OHCI root hub" rev 1.00/1.00 addr 1
usb4 at ohci1: USB revision 1.0
uhub4 at usb4 "AMD OHCI root hub" rev 1.00/1.00 addr 1
isa0 at pcib0
isadma0 at isa0
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
pms0: Synaptics touchpad, firmware 7.5
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
usb5 at ohci2: USB revision 1.0
uhub5 at usb5 "AMD OHCI root hub" rev 1.00/1.00 addr 1
usb6 at ohci3: USB revision 1.0
uhub6 at usb6 "AMD OHCI root hub" rev 1.00/1.00 addr 1
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
uvideo0 at uhub1 port 4 configuration 1 interface 0 "Generic WebCam 
SC-10HDD12636N" rev 2.00/0.53 addr 2
video0 at uvideo0
ugen0 at uhub3 port 3 "Atheros Communications Bluetooth USB Host Controller" 
rev 1.10/0.01 addr 2
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
root on sd0a (9929eaaf0fe5efaf.a) swap on sd0b dump on sd0b

> 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 -0000       1.143
> +++ re.c      21 Aug 2013 19:50:39 -0000
> @@ -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 0xffff. */
> @@ -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);
>  }

Reply via email to