All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan-Simon Möller" <dl9pf@gmx.de>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Patch] Make usermode stacksize (-s) configurable at compile-time
Date: Sun, 25 Oct 2009 18:49:44 +0100	[thread overview]
Message-ID: <200910251849.44301.dl9pf@gmx.de> (raw)
In-Reply-To: <200910251841.25045.dl9pf@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 3500 bytes --]

We encontered problems with the low default value for the stacksize in usermode (ok, whats "low"). 
For environments like scratchbox, its hard to use "-s" as qemu is called by binfmt mechanism.
The attached patch makes this configurable at compile-time.

Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>

diff --git a/configure b/configure                                     
index 43d87c5..dad9175 100755                                          
--- a/configure                                                        
+++ b/configure                                                        
@@ -220,6 +220,7 @@ uname_release=""                                   
 io_thread="no"                                                        
 mixemu="no"                                                           
 kerneldir=""                                                          
+user_mode_stacksize=""                                                
 aix="no"                                                              
 blobs="yes"                                                           
 pkgversion=""                                                         
@@ -557,6 +558,8 @@ for opt do                                         
   ;;                                                                  
   --kerneldir=*) kerneldir="$optarg"                                  
   ;;                                                                  
+  --user-mode-stacksize=*) user_mode_stacksize="$optarg"              
+  ;;                                                                  
   --with-pkgversion=*) pkgversion=" ($optarg)"                        
   ;;                                                                  
   --disable-docs) docs="no"                                           
@@ -713,6 +716,7 @@ echo "  --enable-linux-aio       enable Linux AIO support"
 echo "  --enable-io-thread       enable IO thread"
 echo "  --disable-blobs          disable installing provided firmware blobs"
 echo "  --kerneldir=PATH         look for kernel includes in PATH"
+echo "  --user-mode-stacksize=   set default stack size in bytes (as -s, only in usermode)"
 echo ""
 echo "NOTE: The object files are built at the place where configure is launched"
 exit 1
@@ -2481,6 +2485,16 @@ if test "$target_user_only" = "yes" -a "$static" = "no" -a \
   ldflags="-pie $ldflags"
 fi

+# change default stacksize in usermode
+#
+if test "$target_user_only" = "yes" -a "$user_mode_stacksize" != "" ; then
+ cflags="-DUSER_MODE_STACKSIZE=$user_mode_stacksize $cflags"
+ echo "user_mode_stack   $user_mode_stacksize"
+else
+ echo "user_mode_stack   default"
+fi
+
+
 if test "$target_softmmu" = "yes" -a \( \
         "$TARGET_ARCH" = "microblaze" -o \
         "$TARGET_ARCH" = "cris" \) ; then
diff --git a/linux-user/main.c b/linux-user/main.c
index 81a1ada..9ac2421 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -51,7 +51,10 @@ const char *qemu_uname_release = CONFIG_UNAME_RELEASE;
 /* XXX: on x86 MAP_GROWSDOWN only works if ESP <= address + 32, so
    we allocate a bigger stack. Need a better solution, for example
    by remapping the process stack directly at the right place */
-unsigned long x86_stack_size = 512 * 1024;
+#ifndef USER_MODE_STACKSIZE
+#define USER_MODE_STACKSIZE (512 * 1024)
+#endif
+unsigned long x86_stack_size = USER_MODE_STACKSIZE;

 void gemu_log(const char *fmt, ...)
 {


[-- Attachment #2: usermode_stacksize.diff --]
[-- Type: text/x-patch, Size: 2084 bytes --]

diff --git a/configure b/configure
index 43d87c5..dad9175 100755
--- a/configure
+++ b/configure
@@ -220,6 +220,7 @@ uname_release=""
 io_thread="no"
 mixemu="no"
 kerneldir=""
+user_mode_stacksize=""
 aix="no"
 blobs="yes"
 pkgversion=""
@@ -557,6 +558,8 @@ for opt do
   ;;
   --kerneldir=*) kerneldir="$optarg"
   ;;
+  --user-mode-stacksize=*) user_mode_stacksize="$optarg"
+  ;;
   --with-pkgversion=*) pkgversion=" ($optarg)"
   ;;
   --disable-docs) docs="no"
@@ -713,6 +716,7 @@ echo "  --enable-linux-aio       enable Linux AIO support"
 echo "  --enable-io-thread       enable IO thread"
 echo "  --disable-blobs          disable installing provided firmware blobs"
 echo "  --kerneldir=PATH         look for kernel includes in PATH"
+echo "  --user-mode-stacksize=   set default stack size in bytes (as -s, only in usermode)"
 echo ""
 echo "NOTE: The object files are built at the place where configure is launched"
 exit 1
@@ -2481,6 +2485,16 @@ if test "$target_user_only" = "yes" -a "$static" = "no" -a \
   ldflags="-pie $ldflags"
 fi
 
+# change default stacksize in usermode
+#
+if test "$target_user_only" = "yes" -a "$user_mode_stacksize" != "" ; then
+ cflags="-DUSER_MODE_STACKSIZE=$user_mode_stacksize $cflags"
+ echo "user_mode_stack   $user_mode_stacksize"
+else
+ echo "user_mode_stack   default"
+fi
+
+
 if test "$target_softmmu" = "yes" -a \( \
         "$TARGET_ARCH" = "microblaze" -o \
         "$TARGET_ARCH" = "cris" \) ; then
diff --git a/linux-user/main.c b/linux-user/main.c
index 81a1ada..9ac2421 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -51,7 +51,10 @@ const char *qemu_uname_release = CONFIG_UNAME_RELEASE;
 /* XXX: on x86 MAP_GROWSDOWN only works if ESP <= address + 32, so
    we allocate a bigger stack. Need a better solution, for example
    by remapping the process stack directly at the right place */
-unsigned long x86_stack_size = 512 * 1024;
+#ifndef USER_MODE_STACKSIZE
+#define USER_MODE_STACKSIZE (512 * 1024)
+#endif
+unsigned long x86_stack_size = USER_MODE_STACKSIZE;
 
 void gemu_log(const char *fmt, ...)
 {

  reply	other threads:[~2009-10-25 17:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-25 15:22 [Qemu-devel] [Patch] Make usermode stacksize (-s) configurable at compile-time Jan-Simon Möller
2009-10-25 15:54 ` Laurent Desnogues
2009-10-25 17:41   ` Jan-Simon Möller
2009-10-25 17:49     ` Jan-Simon Möller [this message]
2009-10-25 21:09       ` [Qemu-devel] " Juan Quintela
2009-10-26 11:37         ` Jan-Simon Möller
2009-10-26  0:53       ` [Qemu-devel] " Jamie Lokier
2009-10-26 12:25       ` Riku Voipio
2009-10-27 19:56         ` Jan-Simon Möller

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=200910251849.44301.dl9pf@gmx.de \
    --to=dl9pf@gmx.de \
    --cc=qemu-devel@nongnu.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.