All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Glatz <andreasglatz@domain.hid>
To: Philippe Gerum <rpm@xenomai.org>, xenomai@xenomai.org
Subject: Re: [Xenomai-help] Running out of stack memory in kernel-space
Date: Thu, 28 May 2009 14:23:07 -0400	[thread overview]
Message-ID: <1243534987.898.44.camel@domain.hid> (raw)
In-Reply-To: <1243528798.22173.3.camel@domain.hid>

On Thu, 2009-05-28 at 18:39 +0200, Philippe Gerum wrote:
> On Thu, 2009-05-28 at 11:59 -0400, Andreas Glatz wrote:
> > Hi,
> > 
> > We have to start 40+ Xenomai tasks in kernel space.
> > We want to allocate at least 4kbyte of stack memory
> > for each of them. So we need the stack heap size 
> > to be more than 160kbyte. 
> > 
> > In the documentation it says that the total 
> > stack heap size cannot be more than 128kbyte
> > (the limit of kmalloc).
> 
> Could you point me at that doc? TIA,
> 
> > 
> > Now my idea is to modify the Xenomai code to have 
> > more than one stack heaps. So when I'm running out
> > of space in one heap I can switch to the next heap...
> > 
> > Is there an easier way to increase the max. stack heap size?
> > 
> 
> See CONFIG_XENO_OPT_SYS_STACKPOOLSZ, nucleus configuration menu.

I found this in kernel/xenomai/nucleus/Kconfig :

config XENO_OPT_SYS_STACKPOOLSZ
        depends on XENO_GENERIC_STACKPOOL
    int "Size of the private stack pool (Kb)"
    default 32
    range 0 128
    help

    On this architecture, kernel-based Xenomai threads get the
    stack space they need from a private memory pool.  If you
    don't start any kernel-based thread (i.e. no RTDM driver
    thread, and no real-time task created from an application
    embodied into a kernel module), you may leave a zero value for
    this option. The size is expressed in Kilobytes.


And if you follow the CONFIG_XENO_OPT_SYS_STACKPOOLSZ macro 
you eventually end up at this comment in kernel/xenomai/nucleus/pod.c :

    /*
     * We have to differentiate the system heap memory from the
     * pool the kernel thread stacks will be obtained from,
     * because on some architectures, vmalloc memory may not be
     * accessed while running in physical addressing mode
     * (e.g. exception trampoline code on powerpc with standard
     * MMU support - CONFIG_PPC_STD_MMU). Meanwhile, since we want
     * to allow the system heap to be larger than 128Kb in
     * contiguous memory, we can't restrict to using kmalloc()
     * memory for it either.  Therefore, we manage a private stack
     * pool for kernel-based threads which will be populated with
     * the kind of memory the underlying arch requires, still
     * allowing the system heap to rely on a vmalloc'ed segment.
     */
    heapaddr = xnarch_alloc_stack_mem(CONFIG_XENO_OPT_SYS_STACKPOOLSZ *
1024);



Andreas



  reply	other threads:[~2009-05-28 18:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-28 15:59 [Xenomai-help] Running out of stack memory in kernel-space Andreas Glatz
2009-05-28 16:39 ` Philippe Gerum
2009-05-28 18:23   ` Andreas Glatz [this message]
2009-05-28 22:14     ` Philippe Gerum
2009-05-28 16:52 ` Philippe Gerum
2009-05-28 17:58   ` Andreas Glatz
2009-05-28 21:47     ` Philippe Gerum
2009-06-22 13:23       ` Andreas Glatz
2009-06-23  9:30         ` Philippe Gerum
2009-06-23  9:37           ` Gilles Chanteperdrix
2009-06-23 10:23             ` Philippe Gerum
2009-06-23 10:37           ` Philippe Gerum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1243534987.898.44.camel@domain.hid \
    --to=andreasglatz@domain.hid \
    --cc=rpm@xenomai.org \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.