Skip to content

Commit 5ee863b

Browse files
committed
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
2 parents 8312f41 + 39b1e77 commit 5ee863b

File tree

8 files changed

+35
-30
lines changed

8 files changed

+35
-30
lines changed

arch/parisc/include/asm/processor.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,12 @@
4545
#define STACK_TOP TASK_SIZE
4646
#define STACK_TOP_MAX DEFAULT_TASK_SIZE
4747

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-
5348
#endif
5449

5550
#ifndef __ASSEMBLY__
5651

52+
unsigned long calc_max_stack_size(unsigned long stack_max);
53+
5754
/*
5855
* Data detected about CPUs at boot time which is the same for all CPU's.
5956
* HP boxes are SMP - ie identical processors.
@@ -97,7 +94,6 @@ struct cpuinfo_parisc {
9794
unsigned long cpu_loc; /* CPU location from PAT firmware */
9895
unsigned int state;
9996
struct parisc_device *dev;
100-
unsigned long loops_per_jiffy;
10197
};
10298

10399
extern struct system_cpuinfo_parisc boot_cpu_data;

arch/parisc/include/uapi/asm/types.h

Lines changed: 0 additions & 7 deletions
This file was deleted.

arch/parisc/kernel/entry.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ intr_check_sig:
887887
/* As above */
888888
mfctl %cr30,%r1
889889
LDREG TI_FLAGS(%r1),%r19
890-
ldi (_TIF_SIGPENDING|_TIF_NOTIFY_RESUME), %r20
890+
ldi (_TIF_USER_WORK_MASK & ~_TIF_NEED_RESCHED), %r20
891891
and,COND(<>) %r19, %r20, %r0
892892
b,n intr_restore /* skip past if we've nothing to do */
893893

@@ -1810,7 +1810,7 @@ syscall_check_resched:
18101810
.import do_signal,code
18111811
syscall_check_sig:
18121812
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
18141814
and,COND(<>) %r19, %r26, %r0
18151815
b,n syscall_restore /* skip past if we've nothing to do */
18161816

arch/parisc/kernel/pci-dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ pcxl_free_range(unsigned long vaddr, size_t size)
335335
dump_resmap();
336336
}
337337

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)
339339
{
340340
#if 0
341341
u_long i = 0;

arch/parisc/kernel/processor.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ static int __init processor_probe(struct parisc_device *dev)
163163
if (cpuid)
164164
memset(p, 0, sizeof(struct cpuinfo_parisc));
165165

166-
p->loops_per_jiffy = loops_per_jiffy;
167166
p->dev = dev; /* Save IODC data in case we need it */
168167
p->hpa = dev->hpa.start; /* save CPU hpa */
169168
p->cpuid = cpuid; /* save CPU id */
@@ -434,8 +433,8 @@ show_cpuinfo (struct seq_file *m, void *v)
434433
show_cache_info(m);
435434

436435
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);
439438

440439
seq_printf(m, "software id\t: %ld\n\n",
441440
boot_cpu_data.pdc.model.sw_id);

arch/parisc/kernel/sys_parisc.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,25 @@ static inline unsigned long COLOR_ALIGN(unsigned long addr,
5353
return base + off;
5454
}
5555

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+
5675
/*
5776
* Top of mmap area (just below the process stack).
5877
*/
@@ -69,8 +88,8 @@ static unsigned long mmap_upper_limit(struct rlimit *rlim_stack)
6988
/* Limit stack size - see setup_arg_pages() in fs/exec.c */
7089
stack_base = rlim_stack ? rlim_stack->rlim_max
7190
: 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);
7493

7594
/* Add space for stack randomization. */
7695
if (current->flags & PF_RANDOMIZE)

fs/exec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,8 @@ int setup_arg_pages(struct linux_binprm *bprm,
757757
#ifdef CONFIG_STACK_GROWSUP
758758
/* Limit stack size */
759759
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);
762762

763763
/* Add space for stack randomization. */
764764
stack_base += (STACK_RND_MASK << PAGE_SHIFT);

mm/Kconfig

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -720,19 +720,17 @@ config ZSMALLOC_STAT
720720
config GENERIC_EARLY_IOREMAP
721721
bool
722722

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
726726
range 8 2048
727727
depends on STACK_GROWSUP && (!64BIT || COMPAT)
728728
help
729729
This is the maximum stack size in Megabytes in the VM layout of 32-bit
730730
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.
734732

735-
A sane initial value is 80 MB.
733+
A sane initial value is 100 MB.
736734

737735
config DEFERRED_STRUCT_PAGE_INIT
738736
bool "Defer initialisation of struct pages to kthreads"

0 commit comments

Comments
 (0)