Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N24vB-00068v-1I for qemu-devel@nongnu.org; Sun, 25 Oct 2009 11:22:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N24v6-00067y-CZ for qemu-devel@nongnu.org; Sun, 25 Oct 2009 11:22:16 -0400 Received: from [199.232.76.173] (port=55840 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N24v6-00067v-97 for qemu-devel@nongnu.org; Sun, 25 Oct 2009 11:22:12 -0400 Received: from mail.gmx.net ([213.165.64.20]:53159) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1N24v5-0002RE-Nq for qemu-devel@nongnu.org; Sun, 25 Oct 2009 11:22:12 -0400 From: "Jan-Simon =?utf-8?q?M=C3=B6ller?=" Date: Sun, 25 Oct 2009 16:22:07 +0100 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_f0G5Kpt1gZMv4aP" Message-Id: <200910251622.07800.dl9pf@gmx.de> Subject: [Qemu-devel] [Patch] Make usermode stacksize (-s) configurable at compile-time List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --Boundary-00=_f0G5Kpt1gZMv4aP Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi ! We encontered problems with the low default value for the stacksize in user= mode (ok, whats "low").=20 =46or 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=C3=B6ller diff --git a/configure b/configure =20 index 43d87c5..076f45a 100755 =20 =2D-- a/configure =20 +++ b/configure =20 @@ -220,6 +220,7 @@ uname_release=3D"" =20 io_thread=3D"no" =20 mixemu=3D"no" =20 kerneldir=3D"" =20 +user_mode_stacksize=3D"" =20 aix=3D"no" =20 blobs=3D"yes" =20 pkgversion=3D"" =20 @@ -557,6 +558,8 @@ for opt do =20 ;; =20 --kerneldir=3D*) kerneldir=3D"$optarg" =20 ;; + --user-mode-stacksize=3D*) user_mode_stacksize=3D"$optarg" + ;; --with-pkgversion=3D*) pkgversion=3D" ($optarg)" ;; --disable-docs) docs=3D"no" @@ -713,6 +716,7 @@ echo " --enable-linux-aio enable Linux AIO suppo= rt" echo " --enable-io-thread enable IO thread" echo " --disable-blobs disable installing provided firmware blob= s" echo " --kerneldir=3DPATH look for kernel includes in PATH" +echo " --user-mode-stacksize=3D 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 lau= nched" exit 1 @@ -2576,3 +2580,10 @@ d=3Dlibuser mkdir -p $d rm -f $d/Makefile ln -s $source_path/Makefile.user $d/Makefile + +# change default stacksize in usermode +# +if test "$user_mode_stacksize" !=3D "" ; then + echo "user_mode_stack $user_mode_stacksize" + echo "QEMU_CFLAGS+=3D-DUSER_MODE_STACKSIZE=3D$user_mode_stacksize" >> $co= nfig_host_mak +fi diff --git a/linux-user/main.c b/linux-user/main.c index 81a1ada..30c0a87 100644 =2D-- a/linux-user/main.c +++ b/linux-user/main.c @@ -51,7 +51,11 @@ const char *qemu_uname_release =3D CONFIG_UNAME_RELEASE; /* XXX: on x86 MAP_GROWSDOWN only works if ESP <=3D address + 32, so we allocate a bigger stack. Need a better solution, for example by remapping the process stack directly at the right place */ +#if defined(USER_MODE_STACKSIZE) +unsigned long x86_stack_size =3D USER_MODE_STACKSIZE; +#else unsigned long x86_stack_size =3D 512 * 1024; +#endif void gemu_log(const char *fmt, ...) { --Boundary-00=_f0G5Kpt1gZMv4aP Content-Type: text/x-patch; charset="UTF-8"; name="usermode_stacksize.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="usermode_stacksize.diff" diff --git a/configure b/configure index 43d87c5..076f45a 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 @@ -2576,3 +2580,10 @@ d=libuser mkdir -p $d rm -f $d/Makefile ln -s $source_path/Makefile.user $d/Makefile + +# change default stacksize in usermode +# +if test "$user_mode_stacksize" != "" ; then + echo "user_mode_stack $user_mode_stacksize" + echo "QEMU_CFLAGS+=-DUSER_MODE_STACKSIZE=$user_mode_stacksize" >> $config_host_mak +fi diff --git a/linux-user/main.c b/linux-user/main.c index 81a1ada..30c0a87 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -51,7 +51,11 @@ 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 */ +#if defined(USER_MODE_STACKSIZE) +unsigned long x86_stack_size = USER_MODE_STACKSIZE; +#else unsigned long x86_stack_size = 512 * 1024; +#endif void gemu_log(const char *fmt, ...) { --Boundary-00=_f0G5Kpt1gZMv4aP--