From patchwork Sun Oct 25 17:49:44 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jan-Simon_M=C3=B6ller?= X-Patchwork-Id: 36864 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 58CA1B7BDC for ; Mon, 26 Oct 2009 04:50:42 +1100 (EST) Received: from localhost ([127.0.0.1]:33817 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N27El-0008Cg-DZ for incoming@patchwork.ozlabs.org; Sun, 25 Oct 2009 13:50:39 -0400 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 Received: (qmail invoked by alias); 25 Oct 2009 17:49:50 -0000 Received: from p5B21494E.dip.t-dialin.net (EHLO frodo.localnet) [91.33.73.78] by mail.gmx.net (mp057) with SMTP; 25 Oct 2009 18:49:50 +0100 X-Authenticated: #7313500 X-Provags-ID: V01U2FsdGVkX1/zPxEhNVHzo+5akIoSOMakMqXBJ7iTv7eAhsSwDc 9KWoRDevcfUlfn From: "Jan-Simon =?iso-8859-1?q?M=F6ller?=" 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 User-Agent: KMail/1.10.3 (Linux/2.6.27.29-0.1-default; KDE/4.1.3; x86_64; ; ) 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 Message-Id: <200910251849.44301.dl9pf@gmx.de> X-Y-GMX-Trusted: 0 X-FuHaFi: 0.46 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 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, ...) {