Fatal trap 12: page fault while in kernel mode

2005-12-25 Thread kamal kc
hello everybody,

i am recently troubled by kernel panics that occur as
soon as 
i run my modified kernel. the only modification i have
done
is i have added compression/decompression function in
the
bridge.c file. I am running 5.4 RELEASE. 

i am just a new beginner in programming the kernel and
may 
have insufficient knowledge regarding it.

things i have done in the function that could affect
the kernel operation are:
1. i frequently allocate memory using malloc() in
M_DEVBUF and 
M_TEMP with M_WAITOK flag
2. i allocate memory with malloc and construct tree.
the node count
can go up 350 so that i may call malloc about 600
times in the 
routine. i know that may sound pretty dumb but
right now i have 
no other choice now as i know so little.
3. the functions are pretty longer and contain loops
so they may consume time
since the bridge code may be called for all the
packets flowing 
through the network. 
4. i have used data structures like linked lists and
trees.

now the problem is as soon as i run my modified kernel
it panics with
fatal trap 12. the name of the process that crashed is
sometimes the cron,
sometimes ps, sometimes top, sometimes g_up, and
sometimes sendmail.

i don't know what to do because the i have tested the
function 
separately and it works fine. i used the dmalloc to
see whether 
the memory leak was present but i didnot find any. it
may be
posible that my tests with dmalloc were insufficient. 

So i have put the crash dumps here that may help 
some of you suggest me whether there is anything i 
can possibly do in order to solve this panic.

Is the problem related to memory leaks or sleeping 
on mutexes or some other causes. 

i have added my function just before the
IFQ_HANDOFF().

thanks,

kamal kc



Panic message:-->

kernel trap 12 with interrupts disabled

Fatal trap 12: page fault while in kernel mode
fault virtual address=0x6c
fault code =supervisor read, page not present
instruction pointer=0x8:0xc052eafd
stack pointer=0x10:0xd50349d0
frame pointer=0x10:0xd50349d4
code segment=base 0x0, limit 0xf, type 0x1b
=DPL 0, pres 1, def32 1, gran 1
processor eflags=resume, IOPL=0
current process=462 (sendmail)
trap number=12
panic: page fault


decomp# kgdb kernel.debug  /var/crash/vmcore.2


[GDB will not be able to debug user-mode threads:
/usr/lib/libthread_db.so: Undefined symbol
"ps_pglobal_lookup"]

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".

#0  doadump () at pcpu.h:159

159 __asm __volatile("movl %%fs:0,%0" : "=r" (td));

(kgdb) bt

#0  doadump () at pcpu.h:159

#1  0xc0510d86 in boot (howto=260) at
../../../kern/kern_shutdown.c:410

#2  0xc051101c in panic (fmt=0xc06b9b28 "%s")

at ../../../kern/kern_shutdown.c:566

#3  0xc0692820 in trap_fatal (frame=0xd5034990,
eva=108)

at ../../../i386/i386/trap.c:817

#4  0xc069200d in trap (frame=

  {tf_fs = 24, tf_es = 16, tf_ds = 16, tf_edi = 2,
tf_esi = -1049545216, tf_ebp = -721204780, tf_isp =
-721204804, tf_ebx = -1050635136, tf_edx =
-1050635136, tf_ecx = 0, tf_eax = -1049545184,
tf_trapno = 12, tf_err = 0, tf_eip = -1068307715,
tf_cs = 8, tf_eflags = 65539, tf_esp = -1049545216,
tf_ss = -721204748}) at ../../../i386/i386/trap.c:255

#5  0xc0682cda in calltrap () at
../../../i386/i386/exception.s:140

#6  0x0018 in ?? ()

#7  0x0010 in ?? ()

#8  0x0010 in ?? ()

#9  0x0002 in ?? ()

#10 0xc1713600 in ?? ()

#11 0xd50349d4 in ?? ()

#12 0xd50349bc in ?? ()

#13 0xc1609480 in ?? ()

#14 0xc1609480 in ?? ()

#15 0x in ?? ()

#16 0xc1713620 in ?? ()

---Type  to continue, or q  to quit---

#17 0x000c in ?? ()

#18 0x in ?? ()

#19 0xc052eafd in turnstile_setowner (ts=0xc1609480,
owner=0x0)

at ../../../kern/subr_turnstile.c:367

#20 0xc052edbf in turnstile_wait (ts=0xc1609480,
lock=0xc16ba800, owner=0x0)

at ../../../kern/subr_turnstile.c:504

#21 0xc0508769 in _mtx_lock_sleep (m=0xc16ba800,
td=0xc1713600, opts=0, 

file=0x0, line=0) at
../../../kern/kern_mutex.c:552

#22 0xc063c691 in ufsdirhash_lookup (ip=0xc170d1a4, 

name=0xc16dd009 "nss_compat.so.1", namelen=15,
offp=0x0, bpp=0x0, 

prevoffp=0x0) at
../../../ufs/ufs/ufs_dirhash.c:349

#23 0xc063e612 in ufs_lookup (ap=0xd5034b78)

at ../../../ufs/ufs/ufs_lookup.c:214

#24 0xc0645623 in ufs_vnoperate (ap=0x0) at
../../../ufs/ufs/ufs_vnops.c:2821

#25 0xc0558402 in vfs_cache_lookup (ap=0x0) at
vnode_if.h:82

#26 0xc0645623 in ufs_vnoperate (ap=0x0) at
../../../ufs/ufs/ufs_vnops.c:2821

#27 0xc055d5cb in lookup (ndp=0xd5034c78) at
vnode_if.h:52

#28 0xc055d069 in namei (nd

Re: Fatal trap 12: page fault while in kernel mode

2005-12-25 Thread Xin LI
Hi,

On 12/25/05, kamal kc <[EMAIL PROTECTED]> wrote:
[...]
> Is the problem related to memory leaks or sleeping
> on mutexes or some other causes.

>From the backtrace you have provided, it looks like a memory
corruption.  In order to aid your debugging, you will want INVARIANTS
and WITESS, etc. to be enabled.  Also, if feasible, please consider
using code from -CURRENT or at least RELENG_6_0, as there are more
debugging aids that is likely to catch bugs early.

Cheers,
--
Xin LI <[EMAIL PROTECTED]> http://www.delphij.net
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: accessing NetBSD filesystem

2005-12-25 Thread Anatoli Klassen

Hanspeter Roth wrote:


Fdisk shows sysid 165 (0xa5) for partition 3. This is where FreeBSD
is installed. And Fdisk shows sysid 169 (0xa9) for partition 4. This
is where NetBSD is installed.
In /dev there are ad0s3 and ad0s3[a-g] but there is only a ad0s4.
So how can filesystems of my NetBSD in ad0s4 be accessed?



AFAIK you can access only the 'a' partition of the NetBSD slice.
Just mount it.

If you need other partitions, try to use following module:

http://www.26th.net/public/projects/freebsd/geom_nbsd/geom_nbsd.tgz

1. Download, unpack, go it to the dir.
2. Say "make".
3. Sys "kldload ./geom_nbsd.ko"
4. All /dev/ad0s3[a-g] should appear.
5. Now mount all partitions as usual.

The module is tested on 6.x and CURRENT. One known bug - it's impossible 
to unload it, you have to reboot for this.

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Fatal trap 12: page fault while in kernel mode

2005-12-25 Thread kamal kc
thanks,
 i will try INVARIANTS and WITNESS options and will try to get 
 freebsd 6.0. it will be only tomorrow when i'll be able to do this
 because it is already evening and i will go to my office tomorrow 
 only.
 
 in the mean time if the memory corruption is the problem then is there
 any option/configuration or possible thing i could do to 
 make sure that the kernel quits or throws some messages or panics 
 on the moment the corruption takes place rather than some 
 time later when other program is affected by it. 
 
 that way i could locate any bug in my code if present.
 
 thanks, 
 kamal
 

Xin LI <[EMAIL PROTECTED]> wrote: Hi,

On 12/25/05, kamal kc  wrote:
[...]
> Is the problem related to memory leaks or sleeping
> on mutexes or some other causes.

>From the backtrace you have provided, it looks like a memory
corruption.  In order to aid your debugging, you will want INVARIANTS
and WITESS, etc. to be enabled.  Also, if feasible, please consider
using code from -CURRENT or at least RELENG_6_0, as there are more
debugging aids that is likely to catch bugs early.

Cheers,
--
Xin LI  http://www.delphij.net
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"




-
 Yahoo! DSL Something to write home about. Just $16.99/mo. or less
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: My wish list for 6.1

2005-12-25 Thread Sergey Babkin
Kris Kennaway wrote:
> 
> On Fri, Dec 16, 2005 at 10:34:09PM -0800, Avleen Vig wrote:
> > On Fri, Dec 16, 2005 at 10:40:22AM -0500, Martin Cracauer wrote:
> > > > 2.  SMP kernels for install.  Right now we only install a UP kernel, for
> > > > performance reasons.  We should be able to package both a UP and SMP
> > > > kernel into the release bits, and have sysinstall install both.  It
> > > > should also select the correct one for the target system and make that
> > > > the default on boot.
> > >
> > > If people are concerned about performance, I benchmarked a 6-beta
> > > kernel SMP versus UP on a socket 939 Opteron.
> >
> > If those results are accurate, there's no real reason not to just use an
> > SMP kernel on default install?
> 
> Just because it didn't manifest on this workload, doesn't mean it
> doesn't on others.  I think this is the point :)

Hm, how about this (similar to what Linuxes do):

Use an SMP kernel for the installation boot, so that the install
scripts can discover the SMP machines.

Have two GENERIC kernels built and packaged, UP and SMP.

The install scripts then install the kernel matching the absent
or present SMP (like Linux distros do). Probably with an option of
a manual override through a menu. Maybe better yet, install both
(or allow to install both) and allow to choose the one booted 
through a sysinstall menu.

-SB
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: My wish list for 6.1

2005-12-25 Thread Charles Sprickman

I'm missing the start of the thread, so perhaps I can just cut in here.

I'm to the point at home and work where I've got more USB keyboards than 
PS2.  It seems like even my old boxes support getting into the BIOS and 
everything via USB keyboards...  You all know where I'm going...  Whenever 
I want to install FBSD, I have to dig up a clunky old PS2 keyboard.  Not 
the case with Winderz, NetBSD, OpenBSD, Linux, etc.  In fact, I'm pretty 
sure 4.11 can be installed with a USB keyboard.  I may be imagining that 
though...


Back to lurking,

C
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: My wish list for 6.1

2005-12-25 Thread Matthew D. Fuller
On Sun, Dec 25, 2005 at 01:46:15PM -0500 I heard the voice of
Charles Sprickman, and lo! it spake thus:
>
> In fact, I'm pretty sure 4.11 can be installed with a USB keyboard.
> I may be imagining that though...

Well, I'm pretty sure I didn't imagine installing 6.0 last month with
a USB keyboard.  Of course, the loader didn't grok it, but...


-- 
Matthew Fuller (MF4839)   |  [EMAIL PROTECTED]
Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/
   On the Internet, nobody can hear you scream.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Ndis wrapper

2005-12-25 Thread FireWall
Has anyone successfully installed and tested ndiswrapper on Freebsd 6.0 ??

--
-FireWall
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: My wish list for 6.1

2005-12-25 Thread Kris Kennaway

Matthew D. Fuller wrote:


On Sun, Dec 25, 2005 at 01:46:15PM -0500 I heard the voice of
Charles Sprickman, and lo! it spake thus:
 


In fact, I'm pretty sure 4.11 can be installed with a USB keyboard.
I may be imagining that though...
   



Well, I'm pretty sure I didn't imagine installing 6.0 last month with
a USB keyboard.  Of course, the loader didn't grok it, but...
 

The loader groks it just fine when you choose the 'boot with USB 
keyboard' boot menu option ;-)


Kris
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"