Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N27E6-0008Ay-J2 for qemu-devel@nongnu.org; Sun, 25 Oct 2009 13:49:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N27E2-000888-4J for qemu-devel@nongnu.org; Sun, 25 Oct 2009 13:49:58 -0400 Received: from [199.232.76.173] (port=39127 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N27E1-000885-Vm for qemu-devel@nongnu.org; Sun, 25 Oct 2009 13:49:54 -0400 Received: from mail.gmx.net ([213.165.64.20]:34324) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1N27E1-0007Lc-6k for qemu-devel@nongnu.org; Sun, 25 Oct 2009 13:49:53 -0400 From: "Jan-Simon =?iso-8859-1?q?M=F6ller?=" Subject: Re: [Qemu-devel] [Patch] Make usermode stacksize (-s) configurable at compile-time Date: Sun, 25 Oct 2009 18:49:44 +0100 References: <200910251622.07800.dl9pf@gmx.de> <761ea48b0910250854g2aa96a49w65eb5ede77c38f51@mail.gmail.com> <200910251841.25045.dl9pf@gmx.de> In-Reply-To: <200910251841.25045.dl9pf@gmx.de> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_4+I5KaWEd7PLDN+" Message-Id: <200910251849.44301.dl9pf@gmx.de> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --Boundary-00=_4+I5KaWEd7PLDN+ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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=F6ller diff --git a/configure b/configure =20 index 43d87c5..dad9175 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 ;; =20 + --user-mode-stacksize=3D*) user_mode_stacksize=3D"$optarg" = =20 + ;; =20 --with-pkgversion=3D*) pkgversion=3D" ($optarg)" = =20 ;; =20 --disable-docs) docs=3D"no" =20 @@ -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 @@ -2481,6 +2485,16 @@ if test "$target_user_only" =3D "yes" -a "$static" = =3D "no" -a \ ldflags=3D"-pie $ldflags" fi +# change default stacksize in usermode +# +if test "$target_user_only" =3D "yes" -a "$user_mode_stacksize" !=3D "" ; = then + cflags=3D"-DUSER_MODE_STACKSIZE=3D$user_mode_stacksize $cflags" + echo "user_mode_stack $user_mode_stacksize" +else + echo "user_mode_stack default" +fi + + if test "$target_softmmu" =3D "yes" -a \( \ "$TARGET_ARCH" =3D "microblaze" -o \ "$TARGET_ARCH" =3D "cris" \) ; then diff --git a/linux-user/main.c b/linux-user/main.c index 81a1ada..9ac2421 100644 =2D-- a/linux-user/main.c +++ b/linux-user/main.c @@ -51,7 +51,10 @@ 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 */ =2Dunsigned long x86_stack_size =3D 512 * 1024; +#ifndef USER_MODE_STACKSIZE +#define USER_MODE_STACKSIZE (512 * 1024) +#endif +unsigned long x86_stack_size =3D USER_MODE_STACKSIZE; void gemu_log(const char *fmt, ...) { --Boundary-00=_4+I5KaWEd7PLDN+ 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..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, ...) { --Boundary-00=_4+I5KaWEd7PLDN+--