From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N25QC-0006ju-7u for qemu-devel@nongnu.org; Sun, 25 Oct 2009 11:54:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N25QB-0006ja-8q for qemu-devel@nongnu.org; Sun, 25 Oct 2009 11:54:19 -0400 Received: from [199.232.76.173] (port=48336 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N25QB-0006jX-32 for qemu-devel@nongnu.org; Sun, 25 Oct 2009 11:54:19 -0400 Received: from fg-out-1718.google.com ([72.14.220.155]:9045) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N25QA-0006eb-Lp for qemu-devel@nongnu.org; Sun, 25 Oct 2009 11:54:18 -0400 Received: by fg-out-1718.google.com with SMTP id 16so644331fgg.10 for ; Sun, 25 Oct 2009 08:54:17 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <200910251622.07800.dl9pf@gmx.de> References: <200910251622.07800.dl9pf@gmx.de> Date: Sun, 25 Oct 2009 16:54:16 +0100 Message-ID: <761ea48b0910250854g2aa96a49w65eb5ede77c38f51@mail.gmail.com> Subject: Re: [Qemu-devel] [Patch] Make usermode stacksize (-s) configurable at compile-time From: Laurent Desnogues Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-1?Q?Jan=2DSimon_M=F6ller?= Cc: qemu-devel@nongnu.org 2009/10/25 Jan-Simon M=F6ller : > Hi ! > > We encontered problems with the low default value for the stacksize in us= ermode (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=F6ller > > > diff --git a/configure b/configure > index 43d87c5..076f45a 100755 > --- a/configure > +++ b/configure > @@ -220,6 +220,7 @@ uname_release=3D"" > =A0io_thread=3D"no" > =A0mixemu=3D"no" > =A0kerneldir=3D"" > +user_mode_stacksize=3D"" > =A0aix=3D"no" > =A0blobs=3D"yes" > =A0pkgversion=3D"" > @@ -557,6 +558,8 @@ for opt do > =A0 ;; > =A0 --kerneldir=3D*) kerneldir=3D"$optarg" > =A0 ;; > + =A0--user-mode-stacksize=3D*) user_mode_stacksize=3D"$optarg" > + =A0;; > =A0 --with-pkgversion=3D*) pkgversion=3D" ($optarg)" > =A0 ;; > =A0 --disable-docs) docs=3D"no" > @@ -713,6 +716,7 @@ echo " =A0--enable-linux-aio =A0 =A0 =A0 enable Linux= AIO support" > =A0echo " =A0--enable-io-thread =A0 =A0 =A0 enable IO thread" > =A0echo " =A0--disable-blobs =A0 =A0 =A0 =A0 =A0disable installing provid= ed firmware blobs" > =A0echo " =A0--kerneldir=3DPATH =A0 =A0 =A0 =A0 look for kernel includes = in PATH" > +echo " =A0--user-mode-stacksize=3D =A0 set default stack size in bytes (= as -s, only in usermode)" > =A0echo "" > =A0echo "NOTE: The object files are built at the place where configure is= launched" > =A0exit 1 > @@ -2576,3 +2580,10 @@ d=3Dlibuser > =A0mkdir -p $d > =A0rm -f $d/Makefile > =A0ln -s $source_path/Makefile.user $d/Makefile > + > +# change default stacksize in usermode > +# > +if test "$user_mode_stacksize" !=3D "" ; then > + echo "user_mode_stack =A0 $user_mode_stacksize" > + echo "QEMU_CFLAGS+=3D-DUSER_MODE_STACKSIZE=3D$user_mode_stacksize" >> $= config_host_mak > +fi Wouldn't it be better to set this earlier only if target_user_only is set to yes and use cflags? Something like this: if test "$target_user_only" =3D "yes" -a "$user_mode_stacksize" !=3D ""; th= en cflags=3D"-DUSER_MODE_STACKSIZE $cflags" fi just after the test for pie (line 2478) for instance. The informative echo should go with the others (line 1853). > 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 =3D CONFIG_UNAME_RELEAS= E; > =A0/* XXX: on x86 MAP_GROWSDOWN only works if ESP <=3D address + 32, so > =A0 =A0we allocate a bigger stack. Need a better solution, for example > =A0 =A0by remapping the process stack directly at the right place */ > +#if defined(USER_MODE_STACKSIZE) > +unsigned long x86_stack_size =3D USER_MODE_STACKSIZE; > +#else > =A0unsigned long x86_stack_size =3D 512 * 1024; > +#endif I'd prefer: #ifndef USER_MODE_STACKSIZE #define x86_stack_size (512 * 1024) #endif unsigned long x86_stack_size =3D USER_MODE_STACKSIZE; Laurent > =A0void gemu_log(const char *fmt, ...) > =A0{ > >