From owner-freebsd-current@FreeBSD.ORG Thu May 3 19:03:30 2007 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7636816A400 for ; Thu, 3 May 2007 19:03:30 +0000 (UTC) (envelope-from kip.macy@gmail.com) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.228]) by mx1.freebsd.org (Postfix) with ESMTP id 1EB2013C45D for ; Thu, 3 May 2007 19:03:30 +0000 (UTC) (envelope-from kip.macy@gmail.com) Received: by wr-out-0506.google.com with SMTP id 70so613696wra for ; Thu, 03 May 2007 12:03:29 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=SztkPIdlpVurwfeKK9lZkLU717gSClxVQ7/u4vSuqqWSgANsBaY/KbCgfGrJU8OtJdbjt83v3A0VuQq/a8sGwmo3u1cbHhCcLc0u283q8BgU2vTyj+0sJH2Zce4kQsYbJmdcQi7J9BK/3rpUQ6e/JQ/04hc39bYSj9JK+tiBJgE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=tGpCO4PWejZ+aX2bMaaMPyGSFZPD1xbsvhTHw0Ifend9FPY3fOv5e0j/qxoGv0sFv49OVeLhk2MnHYXcaFkcBzDalFHD+JUnlGa6Pebl9bLurhr7PO9wUStwgzfu2ilE+fa721H2B0qkob3K32X4+gjT2jN1AV+gTDR3mDMhIsQ= Received: by 10.78.17.1 with SMTP id 1mr1078852huq.1178219008706; Thu, 03 May 2007 12:03:28 -0700 (PDT) Received: by 10.78.162.15 with HTTP; Thu, 3 May 2007 12:03:28 -0700 (PDT) Message-ID: Date: Thu, 3 May 2007 12:03:28 -0700 From: "Kip Macy" To: "David Christensen" In-Reply-To: <09BFF2FA5EAB4A45B6655E151BBDD90303D507DF@NT-IRVA-0750.brcm.ad.broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <09BFF2FA5EAB4A45B6655E151BBDD90303D507DF@NT-IRVA-0750.brcm.ad.broadcom.com> Cc: freebsd-current@freebsd.org Subject: Re: How to Fix Kernel Panic When Lock Held During Page Fault for Command-Line Loaded bce Module? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2007 19:03:30 -0000 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 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: 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 @ /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 @ /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@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" >