Re: How to Fix Kernel Panic When Lock Held During Page Fault for Command-Line Loaded bce Module?

From: Kip Macy <kip.macy_at_gmail.com>
Date: Thu, 3 May 2007 12:03:28 -0700
Red herring - you dereferenced a bad pointer at rip =
0xffffffffb07a79c3 and happened to be holding a lock at the time. You
may have a resource allocation failure that doesn't occur when it is
loaded early in boot.

 -Kip



On 5/3/07, David Christensen <davidch_at_broadcom.com> wrote:
> I'm building the "bce" driver as a module and loading/unloading
> it from the command-line to do some work on the driver.  A recent
> change to the driver on -CURRENT (v1.25) has introduced the
> following kernel panic:
>
> ------------------------------------------------------------------
>
> ===[root] /usr/src/sys/modules/bce # make load
> /sbin/kldload -v /usr/src/sys/modules/bce/if_bce.ko
> bce0: <Broadcom NetXtreme II BCM5708 1000Base-T (B1), v0.9.6> mem
> 0xdc000000-0xddffffff irq 16 at device 0.0 on pci2
> bce0: ASIC ID 0x57081010; Revision (B1); PCI-X 64-bit 133MHz
> bce0: Ethernet address: 00:10:18:15:f3:e0
> bce0: [ITHREAD]
> Kernel page fault with the following non-sleepable locks held:
> exclusive sleep mutex bce0 (network driver) r = 0 (0xffffffff8133e068)
> locked _at_ /usr/src/sys/modules/bce/../../dev/bce/if_bce.c:774
> KDB: stack backtrace:
> db_trace_self_wrapper() at db_trace_self_wrapper+0x2a
> kdb_backtrace() at kdb_backtrace+0x37
> witness_warn() at witness_warn+0x2c1
> trap() at trap+0x13f
> calltrap() at calltrap+0x8
> --- trap 0xc, rip = 0xffffffffb07a79c3, rsp = 0xffffffffb079d840, rbp =
> 0xffffffffb079d860 ---
> bce_ifmedia_upd_locked() at bce_ifmedia_upd_locked+0x23
> bce_mgmt_init_locked() at bce_mgmt_init_locked+0x99
> bce_attach() at bce_attach+0x90f
> device_attach() at device_attach+0x5a
> device_probe_and_attach() at device_probe_and_attach+0xfe
> pci_driver_added() at pci_driver_added+0xf3
> devclass_add_driver() at devclass_add_driver+0xfb
> driver_module_handler() at driver_module_handler+0x8e
> module_register_init() at module_register_init+0x99
> linker_file_sysinit() at linker_file_sysinit+0xaf
> linker_load_file() at linker_load_file+0x134
> linker_load_module() at linker_load_module+0x110
> kern_kldload() at kern_kldload+0xb9
> kldload() at kldload+0x68
> syscall() at syscall+0x307
> Xfast_syscall() at Xfast_syscall+0xab
> --- syscall (304, FreeBSD ELF64, kldload), rip = 0x80068d24c, rsp =
> 0x7fffffffeb78, rbp = 0x7fffffffebf0 ---
>
>
> Fatal trap 12: page fault while in kernel mode
> cpuid = 0; apic id = 00
> fault virtual address   = 0x38
> fault code              = supervisor read data, page not present
> instruction pointer     = 0x8:0xffffffffb07a79c3
> stack pointer           = 0x10:0xffffffffb079d840
> frame pointer           = 0x10:0xffffffffb079d860
> code segment            = base 0x0, limit 0xfffff, type 0x1b
>                         = DPL 0, pres 1, long 1, def32 0, gran 1
> processor eflags        = interrupt enabled, resume, IOPL = 0
> current process         = 672 (kldload)
> [thread pid 672 tid 100071 ]
> Stopped at      bce_ifmedia_upd_locked+0x23:    cmpl    $0,0x38(%rax)
>
> ------------------------------------------------------------------
>
> The important lines being:
>
> Kernel page fault with the following non-sleepable locks held:
> exclusive sleep mutex bce0 (network driver) r = 0 (0xffffffff8133e068)
> locked _at_ /usr/src/sys/modules/bce/../../dev/bce/if_bce.c:774
>
> Why does this problem only occur when loading a module from the
> command-line and what's the right way to fix it?
>
> David Christensen
>
> _______________________________________________
> freebsd-current_at_freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
>
Received on Thu May 03 2007 - 17:03:30 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:09 UTC