[patch] de(4) has not worked on 8-current since Feb 13

WATANABE Kazuhiro CQG00620 at nifty.ne.jp
Thu Dec 11 13:00:58 UTC 2008


Thanks for your quick reply.

First, I restored busdma_machdep.c and applied your patch. 
Then I re-compiled a kernel and rebooted the system.

Unfortunately it causes kernel panic when the system enters multi user
mode.  Here is an output of kgdb.


$ kgdb /boot/kernel/kernel.symbols /var/crash/vmcore.0
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...

Unread portion of the kernel message buffer:
Copyright (c) 1992-2008 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 8.0-CURRENT #6: Thu Dec 11 13:45:26 JST 2008
    nabe at capricorn:/FreeBSD/obj/i386/HEAD/FreeBSD/HEAD/src/sys/GENERIC
WARNING: WITNESS option enabled, expect reduced performance.
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: Intel Pentium III (751.71-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0x681  Stepping = 1
  Features=0x383f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE>
real memory  = 268435456 (256 MB)
avail memory = 243986432 (232 MB)
kbd1 at kbdmux0
ACPI Error (tbxfroot-0308): A valid RSDP was not found [20070320]
ACPI: Table initialisation failed: AE_NOT_FOUND
ACPI: Try disabling either ACPI or apic support.
pcib0: <Intel 82443BX (440 BX) host to PCI bridge> pcibus 0 on motherboard
pir0: <PCI Interrupt Routing Table: 7 Entries> on motherboard
pci0: <PCI bus> on pcib0
agp0: <Intel 82443BX (440 BX) host to PCI bridge> on hostb0
pcib1: <PCI-PCI bridge> at device 1.0 on pci0
pci1: <PCI bus> on pcib1
vgapci0: <VGA-compatible display> port 0xc000-0xc0ff mem 0xd4000000-0xd4ffffff,0xd6000000-0xd6000fff irq 11 at device 0.0 on pci1
isab0: <PCI-ISA bridge> at device 7.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <Intel PIIX4 UDMA33 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xf000-0xf00f at device 7.1 on pci0
ata0: <ATA channel 0> on atapci0
ata0: [ITHREAD]
ata1: <ATA channel 1> on atapci0
ata1: [ITHREAD]
uhci0: <Intel 82371AB/EB (PIIX4) USB controller> port 0xd000-0xd01f irq 12 at device 7.2 on pci0
uhci0: [GIANT-LOCKED]
uhci0: [ITHREAD]
usb0: <Intel 82371AB/EB (PIIX4) USB controller> on uhci0
usb0: USB revision 1.0
uhub0: <Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1> on usb0
uhub0: 2 ports with 2 removable, self powered
piix0: <PIIX Timecounter> port 0x5000-0x500f at device 7.3 on pci0
Timecounter "PIIX" frequency 3579545 Hz quality 0
pci0: <multimedia, audio> at device 9.0 (no driver attached)
xl0: <3Com 3c905C-TX Fast Etherlink XL> port 0xd800-0xd87f mem 0xd9000000-0xd900007f irq 12 at device 11.0 on pci0
miibus0: <MII bus> on xl0
xlphy0: <3c905C 10/100 internal PHY> PHY 24 on miibus0
xlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
xl0: Ethernet address: 00:50:04:xx:xx:xx
xl0: [ITHREAD]
pci0: <simple comms, generic modem> at device 13.0 (no driver attached)
de0: <Digital 21140A Fast Ethernet> port 0xe000-0xe07f mem 0xd9001000-0xd900107f irq 11 at device 15.0 on pci0
de0: 21140A [10-100Mb/s] pass 2.2
de0: WARNING: using obsoleted if_watchdog interface
de0: Ethernet address: 00:00:f4:xx:xx:xx
de0: [ITHREAD]
cpu0 on motherboard
smist0: <SpeedStep SMI> on cpu0
device_attach: smist0 attach returned 6
pmtimer0 on isa0
atrtc0: <AT realtime clock> at port 0x70-0x71 irq 8 pnpid PNP0b00 on isa0
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 irq 1 pnpid PNP0303 on isa0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
atkbd0: [ITHREAD]
unknown: <PNP0c01> can't assign resources (memory)
unknown: <PNP0a03> can't assign resources (port)
uart0: <16550 or compatible> at port 0x3f8-0x3ff irq 4 flags 0x10 pnpid PNP0501 on isa0
uart0: [FILTER]
uart0: console (9600,n,8,1)
fdc1: <Enhanced floppy controller> at port 0x3f2-0x3f5,0x3f7 irq 6 drq 2 pnpid PNP0700 on isa0
fdc1: [FILTER]
ppc0: <Standard parallel printer port> at port 0x378-0x37f irq 7 pnpid PNP0400 on isa0
ppc0: Generic chipset (NIBBLE-only) in COMPATIBLE mode
ppc0: [GIANT-LOCKED]
ppc0: [ITHREAD]
ppbus0: <Parallel port bus> on ppc0
plip0: <PLIP network interface> on ppbus0
plip0: WARNING: using obsoleted IFF_NEEDSGIANT flag
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
ppi0: <Parallel I/O> on ppbus0
uart1: <16550 or compatible> at port 0x2f8-0x2ff irq 3 pnpid PNP0501 on isa0
uart1: [FILTER]
orm0: <ISA Option ROMs> at iomem 0xc0000-0xc97ff,0xcc000-0xcc7ff pnpid ORM0000 on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x100>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
fdc0: No FDOUT register!
unknown: <PNP0c01> can't assign resources (memory)
unknown: <PNP0a03> can't assign resources (port)
Timecounter "TSC" frequency 751707385 Hz quality 800
Timecounters tick every 1.000 msec
ad0: 6194MB <TOSHIBA MK6411MAT J0.05 B> at ata0-master UDMA33
acd0: CDROM <LTN301/MM06> at ata0-slave PIO4
WARNING: WITNESS option enabled, expect reduced performance.
Trying to mount root from ufs:/dev/ad0s2a
lock order reversal:
 1st 0xc2951044 user map (user map) @ /FreeBSD/HEAD/src/sys/vm/vm_map.c:3115
 2nd 0xc2ac87ac ufs (ufs) @ /FreeBSD/HEAD/src/sys/kern/vfs_subr.c:2079
KDB: stack backtrace:
db_trace_self_wrapper(c0be23c3,c267b90c,c08729c5,4,c0bdd802,...) at db_trace_self_wrapper+0x26
kdb_backtrace(4,c0bdd802,c2905728,c2909f78,c267b968,...) at kdb_backtrace+0x29
_witness_debugger(c0be50ba,c2ac87ac,c0bd88ba,c2909f78,c0bebfa9,...) at _witness_debugger+0x25
witness_checkorder(c2ac87ac,1,c0bebfa9,81f,0,...) at witness_checkorder+0x839
__lockmgr_args(c2ac87ac,200501,c2ac87c8,0,0,...) at __lockmgr_args+0x237
ffs_lock(c267ba78,c087276b,c0c083c6,200501,c2ac8754,...) at ffs_lock+0x8a
VOP_LOCK1_APV(c0ce88e0,c267ba78,c294ce24,c0cfc9c0,c2ac8754,...) at VOP_LOCK1_APV+0xa5
_vn_lock(c2ac8754,200501,c0bebfa9,81f,4,...) at _vn_lock+0x5e
vget(c2ac8754,200501,c294cd80,4b4,0,...) at vget+0xc9
vnode_pager_lock(c187d744,0,c0c0592a,127,c267bc18,...) at vnode_pager_lock+0x1e0
vm_fault(c2951000,80db000,2,8,80db460,...) at vm_fault+0x1df
trap_pfault(5,0,c0c15785,2e7,c294ad34,...) at trap_pfault+0x118
trap(c267bd38) at trap+0x289
calltrap() at calltrap+0x6
--- trap 0xc, eip = 0x80480e5, esp = 0xbfbfeef0, ebp = 0xbfbfef10 ---
<118>Entropy harvesting:
<118> interrupts
<118> ethernet
<118> point_to_point
<118> kickstart
<118>.
<118>/dev/ad0s2a: FILE SYSTEM CLEAN; SKIPPING CHECKS
<118>/dev/ad0s2a: clean, 338407 free (4679 frags, 41716 blocks, 0.9% fragmentation)
Kernel page fault with the following non-sleepable locks held:
exclusive sleep mutex network driver (de0) r = 0 (0xc2a3ec40) locked @ /FreeBSD/HEAD/src/sys/dev/de/if_de.c:3880
KDB: stack backtrace:
db_trace_self_wrapper(c0be23c3,c2727a54,c08729c5,c0babaac,f28,...) at db_trace_self_wrapper+0x26
kdb_backtrace(c0babaac,f28,ffffffff,c0e71824,c2727a8c,...) at kdb_backtrace+0x29
_witness_debugger(c0be4685,c2727aa0,4,1,0,...) at _witness_debugger+0x25
witness_warn(5,0,c0c15785,c2a67480,c294a7ec,...) at witness_warn+0x1fd
trap(c2727b2c) at trap+0x152
calltrap() at calltrap+0x6
--- trap 0xc, eip = 0xc0b11bd8, esp = 0xc2727b6c, ebp = 0xc2727b88 ---
_bus_dmamap_count_pages(c2a46600,1533000,c2c2d000,7f0,1,...) at _bus_dmamap_count_pages+0x18
bus_dmamap_load_mbuf(c2a46600,1533000,c2beab00,c05ed570,c2720040,...) at bus_dmamap_load_mbuf+0xb4
tulip_rx_intr(c2a3ec40,4,c0babaac,e0f,0,...) at tulip_rx_intr+0x45c
tulip_tx_intr(c2a3ec40,4,c0babaac,eba,c2a3e800,...) at tulip_tx_intr+0xf9
tulip_intr_handler(c2a3ec40,0,c0babaac,f28,c2a38cc0,...) at tulip_intr_handler+0x2a4
tulip_intr_normal(c2a3e800,0,0,0,c2947bb8,...) at tulip_intr_normal+0x3c
intr_event_execute_handlers(c294a7ec,c2947b80,c0d35580,c2727cf8,c2947bf0,...) at intr_event_execute_handlers+0x125
ithread_loop(c2a615a0,c2727d38,c0bdaf6d,32d,c294a7ec,...) at ithread_loop+0x9f
fork_exit(c0813920,c2a615a0,c2727d38) at fork_exit+0xb8
fork_trampoline() at fork_trampoline+0x8
--- trap 0, eip = 0, esp = 0xc2727d70, ebp = 0 ---


Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address	= 0x1533008
fault code		= supervisor read, page not present
instruction pointer	= 0x20:0xc0b11bd8
stack pointer	        = 0x28:0xc2727b6c
frame pointer	        = 0x28:0xc2727b88
code segment		= base 0x0, limit 0xfffff, type 0x1b
			= DPL 0, pres 1, def32 1, gran 1
processor eflags	= interrupt enabled, resume, IOPL = 0
current process		= 12 (irq11: de0)
panic: from debugger
cpuid = 0
Uptime: 24s
Physical memory: 239 MB
Dumping 32 MB: 17 1

#0  doadump () at pcpu.h:246
246	pcpu.h: No such file or directory.
	in pcpu.h
(kgdb) bt
#0  doadump () at pcpu.h:246
#1  0xc08338ce in boot (howto=260)
    at /FreeBSD/HEAD/src/sys/kern/kern_shutdown.c:420
#2  0xc0833ba2 in panic (fmt=Variable "fmt" is not available.
)
    at /FreeBSD/HEAD/src/sys/kern/kern_shutdown.c:576
#3  0xc04bd387 in db_panic (addr=Could not find the frame base for "db_panic".
)
    at /FreeBSD/HEAD/src/sys/ddb/db_command.c:478
#4  0xc04bd9b1 in db_command (last_cmdp=0xc0cfe0dc, cmd_table=0x0, dopager=1)
    at /FreeBSD/HEAD/src/sys/ddb/db_command.c:445
#5  0xc04bdb0a in db_command_loop ()
    at /FreeBSD/HEAD/src/sys/ddb/db_command.c:498
#6  0xc04bf96d in db_trap (type=12, code=0)
    at /FreeBSD/HEAD/src/sys/ddb/db_main.c:229
#7  0xc08611b6 in kdb_trap (type=12, code=0, tf=0xc2727b2c)
    at /FreeBSD/HEAD/src/sys/kern/subr_kdb.c:534
#8  0xc0b3152f in trap_fatal (frame=0xc2727b2c, eva=22229000)
    at /FreeBSD/HEAD/src/sys/i386/i386/trap.c:920
#9  0xc0b31e70 in trap (frame=0xc2727b2c)
    at /FreeBSD/HEAD/src/sys/i386/i386/trap.c:318
#10 0xc0b162ab in calltrap ()
    at /FreeBSD/HEAD/src/sys/i386/i386/exception.s:165
#11 0x01533008 in ?? ()
Previous frame inner to this frame (corrupt stack?)
(kgdb) list /FreeBSD/HEAD/src/sys/dev/de/if_de.c:3880
3875	static void
3876	tulip_intr_normal(void *arg)
3877	{
3878	    tulip_softc_t * sc = (tulip_softc_t *) arg;
3879	
3880	    TULIP_LOCK(sc);
3881	#if defined(TULIP_DEBUG)
3882	    sc->tulip_dbg.dbg_intrs++;
3883	#endif
3884	    tulip_intr_handler(sc);
(kgdb) 


At Wed, 10 Dec 2008 15:39:25 -0500,
John Baldwin wrote:
> On Wednesday 10 December 2008 07:56:25 am WATANABE Kazuhiro wrote:
> > Hi, all.
> > 
> > My de(4) NICs has not worked on 8-current since Feb 13.  
> 
> Try this patch to de(4) instead.  It removes the alignment requirement for TX
> buffers since the 4-byte alignment is only required for RX.
> 
> Index: if_de.c
> ===================================================================
> --- if_de.c	(revision 185867)
> +++ if_de.c	(working copy)
> @@ -4491,7 +4491,8 @@
>  /* Allocate memory for a single descriptor ring. */
>  static int
>  tulip_busdma_allocring(device_t dev, tulip_softc_t * const sc, size_t count,
> -    bus_size_t maxsize, int nsegs, tulip_ringinfo_t *ri, const char *name)
> +    bus_size_t alignment, bus_size_t maxsize, int nsegs, tulip_ringinfo_t *ri,
> +    const char *name)
>  {
>      size_t size;
>      int error, i;
> @@ -4527,7 +4528,7 @@
>      }
>  
>      /* Allocate a tag for the data buffers. */
> -    error = bus_dma_tag_create(NULL, 4, 0,
> +    error = bus_dma_tag_create(NULL, alignment, 0,
>  	BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
>  	maxsize, nsegs, TULIP_DATA_PER_DESC, 0, NULL, NULL, &ri->ri_data_tag);
>      if (error) {
> @@ -4586,8 +4587,8 @@
>      /*
>       * Allocate space and dmamap for transmit ring.
>       */
> -    error = tulip_busdma_allocring(dev, sc, TULIP_TXDESCS, TULIP_DATA_PER_DESC,
> -	TULIP_MAX_TXSEG, &sc->tulip_txinfo, "transmit");
> +    error = tulip_busdma_allocring(dev, sc, 1, TULIP_TXDESCS,
> +	TULIP_DATA_PER_DESC, TULIP_MAX_TXSEG, &sc->tulip_txinfo, "transmit");
>      if (error)
>  	return (error);
>  
> @@ -4598,7 +4599,7 @@
>       * a waste in practice though as an ethernet frame can easily fit
>       * in TULIP_RX_BUFLEN bytes.
>       */
> -    error = tulip_busdma_allocring(dev, sc, TULIP_RXDESCS, MCLBYTES, 1,
> +    error = tulip_busdma_allocring(dev, sc, 4, TULIP_RXDESCS, MCLBYTES, 1,
>  	&sc->tulip_rxinfo, "receive");
>      if (error)
>  	return (error);

---
WATANABE Kazuhiro (CQG00620 at nifty.ne.jp)


More information about the freebsd-current mailing list