Re: Graceful failure instead of panicking in kmem_malloc

2008-01-08 Thread Bharma Ji
Thanks for the response. I am hoping to keep some memory aside specifically
for handling out of memory allocation situations. Yes the real fix is to
avoid out of memory allocation. Thanks for the patch. Will try that. As a
first cut I am just trying to handle failure gracefully.

So asking again - if there is any way already discussed or standardized to
make the system handle failures gracefully

On Jan 8, 2008 4:30 PM, Kris Kennaway <[EMAIL PROTECTED]> wrote:

> Bharma Ji wrote:
> > In FreeBSD 6_2, if kmem_malloc is unable to find space it panics. The
> > relevant code is in vm_kern.c
> >   if ((flags & M_NOWAIT) == 0)
> >  panic("kmem_malloc(%ld): kmem_map too small:
> %ld
> > total allocated",
> > (long)size, (long)map->size);
> >
> > Is there any way to make the system log and then gracefully shut off
> instead
> > of panicking?
>
> Not really, because those actions require memory allocation.  The real
> fix is to either
>
> a) avoid running out of memory in the first place by tuning vm.kmem_size
>
> b) perhaps trying harder to avoid panicking by first trying to more
> aggressively reclaim memory.
>
> You can try
>
>   
> http://www.freebsd.org/~pjd/patches/vm_kern.c.2.patch
>
> which implements b) (patch against 7.0, but might apply to 6.2 unchanged).
>
> Kris
>
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Graceful failure instead of panicking in kmem_malloc

2008-01-08 Thread Kris Kennaway

Bharma Ji wrote:

In FreeBSD 6_2, if kmem_malloc is unable to find space it panics. The
relevant code is in vm_kern.c
  if ((flags & M_NOWAIT) == 0)
 panic("kmem_malloc(%ld): kmem_map too small: %ld
total allocated",
(long)size, (long)map->size);

Is there any way to make the system log and then gracefully shut off instead
of panicking?


Not really, because those actions require memory allocation.  The real 
fix is to either


a) avoid running out of memory in the first place by tuning vm.kmem_size

b) perhaps trying harder to avoid panicking by first trying to more 
aggressively reclaim memory.


You can try

  http://www.freebsd.org/~pjd/patches/vm_kern.c.2.patch

which implements b) (patch against 7.0, but might apply to 6.2 unchanged).

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


Graceful failure instead of panicking in kmem_malloc

2008-01-08 Thread Bharma Ji
In FreeBSD 6_2, if kmem_malloc is unable to find space it panics. The
relevant code is in vm_kern.c
  if ((flags & M_NOWAIT) == 0)
 panic("kmem_malloc(%ld): kmem_map too small: %ld
total allocated",
(long)size, (long)map->size);

Is there any way to make the system log and then gracefully shut off instead
of panicking?
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


RE: trap 12 with interrupts disabled, need help

2008-01-08 Thread Andrew Duane
Obvious question: is your stack set up properly, and is it big enough?
It could be that you haven't set up a bigger kernel stack yet, and have
overrun the small boot stack that the processor was running on. Do you
know what the stack pointer is? If it is a few bytes below a page
boundary, then overrunning the stack is a good guess.

/Andrew
 
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:owner-freebsd-
> [EMAIL PROTECTED] On Behalf Of Sharad Chandra
> Sent: Friday, December 28, 2007 12:58 AM
> To: freebsd-hackers@freebsd.org
> Cc: [EMAIL PROTECTED]
> Subject: trap 12 with interrupts disabled, need help
> 
> Hi,
> 
>   I got a message on first boot "pid  (): trap 12 with
> interrupts
> disabled", then it hanged and hard boot is required.
> It does not appears all the time.
> 
> I tried to figure out the problem, trap 12 is stack exception, find at
the
> last
> http://www.acm.uiuc.edu/sigops/roll_your_own/i386/idt.html
> and is coming from kernel,
> The location of this message is /usr/src/
> sys/amd64/amd64/trap.c: "pid %ld (%s): trap %d
with
> interrupts disabled\n",
> 
> What does this exception mean, and what could be possible reason that
my
> program is doing wrong? How to handle it
> 
> Platform: freebsd 6.1 on amd64
> 
> --
> 
> Thanks
> Sharad Chandra
> ___
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to
"[EMAIL PROTECTED]"
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"