From nobody Tue Feb 10 09:27:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1664398334216630.22619763569; Wed, 28 Sep 2022 13:52:14 -0700 (PDT) Received: from localhost ([::1]:56820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ode2P-0002UM-2g for importer@patchew.org; Wed, 28 Sep 2022 16:52:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oddex-0000Ag-5O for qemu-devel@nongnu.org; Wed, 28 Sep 2022 16:27:59 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:60483) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oddev-0006U9-AN for qemu-devel@nongnu.org; Wed, 28 Sep 2022 16:27:58 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N7iT4-1pHhMm2KRe-014gps; Wed, 28 Sep 2022 22:27:54 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Helge Deller , Laurent Vivier Subject: [PULL 22/37] linux-user/hppa: Increase guest stack size to 80MB for hppa target Date: Wed, 28 Sep 2022 22:27:22 +0200 Message-Id: <20220928202737.793171-23-laurent@vivier.eu> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220928202737.793171-1-laurent@vivier.eu> References: <20220928202737.793171-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:W5SIn3QUq2yyQq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zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=212.227.126.131; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1664398336586100001 Content-Type: text/plain; charset="utf-8" From: Helge Deller The hppa target requires a much bigger stack than many other targets, and the Linux kernel allocates 80 MB by default for it. This patch increases the guest stack for hppa to 80MB, and prevents that this default stack size gets reduced by a lower stack limit on the host. Since the stack grows upwards on hppa, the stack_limit value marks the upper boundary of the stack. Fix the output of /proc/self/maps (in the guest) to show the [stack] marker on the correct memory area. Signed-off-by: Helge Deller Message-Id: <20220924114501.21767-6-deller@gmx.de> Signed-off-by: Laurent Vivier --- linux-user/hppa/target_syscall.h | 2 ++ linux-user/main.c | 9 +++++++-- linux-user/syscall.c | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/linux-user/hppa/target_syscall.h b/linux-user/hppa/target_sysc= all.h index 4b382c1fcf4a..9a8f8ca62817 100644 --- a/linux-user/hppa/target_syscall.h +++ b/linux-user/hppa/target_syscall.h @@ -26,4 +26,6 @@ struct target_pt_regs { #define TARGET_MCL_FUTURE 2 #define TARGET_MCL_ONFAULT 4 =20 +#define TARGET_DEFAULT_STACK_SIZE 80 * 1024 * 1024UL + #endif /* HPPA_TARGET_SYSCALL_H */ diff --git a/linux-user/main.c b/linux-user/main.c index e44bdb17b853..88fccfe26149 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -124,10 +124,14 @@ static void usage(int exitcode); static const char *interp_prefix =3D CONFIG_QEMU_INTERP_PREFIX; const char *qemu_uname_release; =20 +#if !defined(TARGET_DEFAULT_STACK_SIZE) /* 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 */ -unsigned long guest_stack_size =3D 8 * 1024 * 1024UL; +#define TARGET_DEFAULT_STACK_SIZE 8 * 1024 * 1024UL +#endif + +unsigned long guest_stack_size =3D TARGET_DEFAULT_STACK_SIZE; =20 /***********************************************************/ /* Helper routines for implementing atomic operations. */ @@ -668,7 +672,8 @@ int main(int argc, char **argv, char **envp) struct rlimit lim; if (getrlimit(RLIMIT_STACK, &lim) =3D=3D 0 && lim.rlim_cur !=3D RLIM_INFINITY - && lim.rlim_cur =3D=3D (target_long)lim.rlim_cur) { + && lim.rlim_cur =3D=3D (target_long)lim.rlim_cur + && lim.rlim_cur > guest_stack_size) { guest_stack_size =3D lim.rlim_cur; } } diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 850410c9b553..f87b36b2491f 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8036,7 +8036,11 @@ static int open_self_maps(CPUArchState *cpu_env, int= fd) continue; } =20 +#ifdef TARGET_HPPA + if (h2g(max) =3D=3D ts->info->stack_limit) { +#else if (h2g(min) =3D=3D ts->info->stack_limit) { +#endif path =3D "[stack]"; } else { path =3D e->path; --=20 2.37.3