[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 22/38] linux-user/hppa: Increase guest stack size to 80MB for hppa
From: |
Laurent Vivier |
Subject: |
[PULL 22/38] linux-user/hppa: Increase guest stack size to 80MB for hppa target |
Date: |
Wed, 28 Sep 2022 10:15:01 +0200 |
From: Helge Deller <deller@gmx.de>
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 <deller@gmx.de>
Message-Id: <20220924114501.21767-6-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
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_syscall.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
+#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 = CONFIG_QEMU_INTERP_PREFIX;
const char *qemu_uname_release;
+#if !defined(TARGET_DEFAULT_STACK_SIZE)
/* 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 guest_stack_size = 8 * 1024 * 1024UL;
+#define TARGET_DEFAULT_STACK_SIZE 8 * 1024 * 1024UL
+#endif
+
+unsigned long guest_stack_size = TARGET_DEFAULT_STACK_SIZE;
/***********************************************************/
/* 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) == 0
&& lim.rlim_cur != RLIM_INFINITY
- && lim.rlim_cur == (target_long)lim.rlim_cur) {
+ && lim.rlim_cur == (target_long)lim.rlim_cur
+ && lim.rlim_cur > guest_stack_size) {
guest_stack_size = 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;
}
+#ifdef TARGET_HPPA
+ if (h2g(max) == ts->info->stack_limit) {
+#else
if (h2g(min) == ts->info->stack_limit) {
+#endif
path = "[stack]";
} else {
path = e->path;
--
2.37.3
- [PULL 13/38] linux-user: Provide MADV_* definitions, (continued)
- [PULL 13/38] linux-user: Provide MADV_* definitions, Laurent Vivier, 2022/09/28
- [PULL 23/38] linux-user/hppa: Allow PROT_GROWSUP and PROT_GROWSDOWN in mprotect(), Laurent Vivier, 2022/09/28
- [PULL 17/38] tests/tcg/linux-test: Add linux-madvise test, Laurent Vivier, 2022/09/28
- [PULL 12/38] linux-user: Show timespec on strace for futex(), Laurent Vivier, 2022/09/28
- [PULL 01/38] linux-user: use 'max' instead of 'qemu32' / 'qemu64' by default, Laurent Vivier, 2022/09/28
- [PULL 06/38] linux-user: Log failing executable in EXCP_DUMP(), Laurent Vivier, 2022/09/28
- [PULL 30/38] linux-user: Combine do_futex and do_futex_time64, Laurent Vivier, 2022/09/28
- [PULL 26/38] linux-user: Don't assume 0 is not a valid host timer_t value, Laurent Vivier, 2022/09/28
- [PULL 27/38] linux-user/s390x: Save/restore fpc when handling a signal, Laurent Vivier, 2022/09/28
- [PULL 35/38] linux-user: Update print_futex_op, Laurent Vivier, 2022/09/28
- [PULL 22/38] linux-user/hppa: Increase guest stack size to 80MB for hppa target,
Laurent Vivier <=
- [PULL 31/38] linux-user: Sink call to do_safe_futex, Laurent Vivier, 2022/09/28
- [PULL 34/38] linux-user: Implement PI futexes, Laurent Vivier, 2022/09/28
- [PULL 29/38] linux-user: Set ELF_BASE_PLATFORM for MIPS, Laurent Vivier, 2022/09/28
- [PULL 15/38] linux-user: Implement stracing madvise(), Laurent Vivier, 2022/09/28
- [PULL 21/38] linux-user/hppa: Drop stack guard page on hppa target, Laurent Vivier, 2022/09/28
- [PULL 20/38] linux-user/hppa: Add signal trampoline for hppa target, Laurent Vivier, 2022/09/28
- [PULL 38/38] linux-user: Add parameters of getrandom() syscall for strace, Laurent Vivier, 2022/09/28
- [PULL 11/38] linux-user: Add strace for clock_nanosleep(), Laurent Vivier, 2022/09/28
- [PULL 28/38] linux-user: Introduce stubs for ELF AT_BASE_PLATFORM, Laurent Vivier, 2022/09/28
- [PULL 16/38] linux-user: Passthrough MADV_DONTNEED for certain file mappings, Laurent Vivier, 2022/09/28