Commit 5ee863bec794f30bdf7fdf57ce0d9f579b0d1aa3

Authored by Linus Torvalds

Merge branch 'parisc-5.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux

Pull parisc updates from Helge Deller:
 "A change to increase the default maximum stack size on parisc to 100MB
  and the ability to further increase the stack hard limit size at
  runtime with ulimit for newly started processes.

  The other patches fix compile warnings, utilize the Kbuild logic and
  cleanups the parisc arch code"

* 'parisc-5.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
  parisc: pci-dma: fix warning unused-function
  parisc/uapi: Use Kbuild logic to provide <asm/types.h>
  parisc: Make user stack size configurable
  parisc: Use _TIF_USER_WORK_MASK in entry.S
  parisc: Drop loops_per_jiffy from per_cpu struct

Showing 8 changed files Side-by-side Diff

arch/parisc/include/asm/processor.h
... ... @@ -45,15 +45,12 @@
45 45 #define STACK_TOP TASK_SIZE
46 46 #define STACK_TOP_MAX DEFAULT_TASK_SIZE
47 47  
48   -/* Allow bigger stacks for 64-bit processes */
49   -#define STACK_SIZE_MAX (USER_WIDE_MODE \
50   - ? (1 << 30) /* 1 GB */ \
51   - : (CONFIG_MAX_STACK_SIZE_MB*1024*1024))
52   -
53 48 #endif
54 49  
55 50 #ifndef __ASSEMBLY__
56 51  
  52 +unsigned long calc_max_stack_size(unsigned long stack_max);
  53 +
57 54 /*
58 55 * Data detected about CPUs at boot time which is the same for all CPU's.
59 56 * HP boxes are SMP - ie identical processors.
... ... @@ -97,7 +94,6 @@
97 94 unsigned long cpu_loc; /* CPU location from PAT firmware */
98 95 unsigned int state;
99 96 struct parisc_device *dev;
100   - unsigned long loops_per_jiffy;
101 97 };
102 98  
103 99 extern struct system_cpuinfo_parisc boot_cpu_data;
arch/parisc/include/uapi/asm/types.h
1   -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2   -#ifndef _PARISC_TYPES_H
3   -#define _PARISC_TYPES_H
4   -
5   -#include <asm-generic/int-ll64.h>
6   -
7   -#endif
arch/parisc/kernel/entry.S
... ... @@ -887,7 +887,7 @@
887 887 /* As above */
888 888 mfctl %cr30,%r1
889 889 LDREG TI_FLAGS(%r1),%r19
890   - ldi (_TIF_SIGPENDING|_TIF_NOTIFY_RESUME), %r20
  890 + ldi (_TIF_USER_WORK_MASK & ~_TIF_NEED_RESCHED), %r20
891 891 and,COND(<>) %r19, %r20, %r0
892 892 b,n intr_restore /* skip past if we've nothing to do */
893 893  
... ... @@ -1810,7 +1810,7 @@
1810 1810 .import do_signal,code
1811 1811 syscall_check_sig:
1812 1812 LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19
1813   - ldi (_TIF_SIGPENDING|_TIF_NOTIFY_RESUME), %r26
  1813 + ldi (_TIF_USER_WORK_MASK & ~_TIF_NEED_RESCHED), %r26
1814 1814 and,COND(<>) %r19, %r26, %r0
1815 1815 b,n syscall_restore /* skip past if we've nothing to do */
1816 1816  
arch/parisc/kernel/pci-dma.c
... ... @@ -335,7 +335,7 @@
335 335 dump_resmap();
336 336 }
337 337  
338   -static int proc_pcxl_dma_show(struct seq_file *m, void *v)
  338 +static int __maybe_unused proc_pcxl_dma_show(struct seq_file *m, void *v)
339 339 {
340 340 #if 0
341 341 u_long i = 0;
arch/parisc/kernel/processor.c
... ... @@ -163,7 +163,6 @@
163 163 if (cpuid)
164 164 memset(p, 0, sizeof(struct cpuinfo_parisc));
165 165  
166   - p->loops_per_jiffy = loops_per_jiffy;
167 166 p->dev = dev; /* Save IODC data in case we need it */
168 167 p->hpa = dev->hpa.start; /* save CPU hpa */
169 168 p->cpuid = cpuid; /* save CPU id */
... ... @@ -434,8 +433,8 @@
434 433 show_cache_info(m);
435 434  
436 435 seq_printf(m, "bogomips\t: %lu.%02lu\n",
437   - cpuinfo->loops_per_jiffy / (500000 / HZ),
438   - (cpuinfo->loops_per_jiffy / (5000 / HZ)) % 100);
  436 + loops_per_jiffy / (500000 / HZ),
  437 + loops_per_jiffy / (5000 / HZ) % 100);
439 438  
440 439 seq_printf(m, "software id\t: %ld\n\n",
441 440 boot_cpu_data.pdc.model.sw_id);
arch/parisc/kernel/sys_parisc.c
... ... @@ -53,6 +53,25 @@
53 53 return base + off;
54 54 }
55 55  
  56 +
  57 +#define STACK_SIZE_DEFAULT (USER_WIDE_MODE \
  58 + ? (1 << 30) /* 1 GB */ \
  59 + : (CONFIG_STACK_MAX_DEFAULT_SIZE_MB*1024*1024))
  60 +
  61 +unsigned long calc_max_stack_size(unsigned long stack_max)
  62 +{
  63 +#ifdef CONFIG_COMPAT
  64 + if (!USER_WIDE_MODE && (stack_max == COMPAT_RLIM_INFINITY))
  65 + stack_max = STACK_SIZE_DEFAULT;
  66 + else
  67 +#endif
  68 + if (stack_max == RLIM_INFINITY)
  69 + stack_max = STACK_SIZE_DEFAULT;
  70 +
  71 + return stack_max;
  72 +}
  73 +
  74 +
56 75 /*
57 76 * Top of mmap area (just below the process stack).
58 77 */
... ... @@ -69,8 +88,8 @@
69 88 /* Limit stack size - see setup_arg_pages() in fs/exec.c */
70 89 stack_base = rlim_stack ? rlim_stack->rlim_max
71 90 : rlimit_max(RLIMIT_STACK);
72   - if (stack_base > STACK_SIZE_MAX)
73   - stack_base = STACK_SIZE_MAX;
  91 +
  92 + stack_base = calc_max_stack_size(stack_base);
74 93  
75 94 /* Add space for stack randomization. */
76 95 if (current->flags & PF_RANDOMIZE)
... ... @@ -757,8 +757,8 @@
757 757 #ifdef CONFIG_STACK_GROWSUP
758 758 /* Limit stack size */
759 759 stack_base = bprm->rlim_stack.rlim_max;
760   - if (stack_base > STACK_SIZE_MAX)
761   - stack_base = STACK_SIZE_MAX;
  760 +
  761 + stack_base = calc_max_stack_size(stack_base);
762 762  
763 763 /* Add space for stack randomization. */
764 764 stack_base += (STACK_RND_MASK << PAGE_SHIFT);
... ... @@ -720,19 +720,17 @@
720 720 config GENERIC_EARLY_IOREMAP
721 721 bool
722 722  
723   -config MAX_STACK_SIZE_MB
724   - int "Maximum user stack size for 32-bit processes (MB)"
725   - default 80
  723 +config STACK_MAX_DEFAULT_SIZE_MB
  724 + int "Default maximum user stack size for 32-bit processes (MB)"
  725 + default 100
726 726 range 8 2048
727 727 depends on STACK_GROWSUP && (!64BIT || COMPAT)
728 728 help
729 729 This is the maximum stack size in Megabytes in the VM layout of 32-bit
730 730 user processes when the stack grows upwards (currently only on parisc
731   - arch). The stack will be located at the highest memory address minus
732   - the given value, unless the RLIMIT_STACK hard limit is changed to a
733   - smaller value in which case that is used.
  731 + arch) when the RLIMIT_STACK hard limit is unlimited.
734 732  
735   - A sane initial value is 80 MB.
  733 + A sane initial value is 100 MB.
736 734  
737 735 config DEFERRED_STRUCT_PAGE_INIT
738 736 bool "Defer initialisation of struct pages to kthreads"