summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVasily Gorbik <gor@linux.ibm.com>2018-09-18 12:23:40 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2018-10-09 05:20:58 -0400
commit32ce55a6592fc3e117e70953001a9ea1931f7941 (patch)
tree6f195ca6380a0241a1cbe0853e0ecadc7cccafb6
parentce3dc447493ff4186b192b38d723ab5e8c1eb52f (diff)
s390: unify stack size definitions
Remove STACK_ORDER and STACK_SIZE in favour of identical THREAD_SIZE_ORDER and THREAD_SIZE definitions. THREAD_SIZE and THREAD_SIZE_ORDER naming is misleading since it is used as general kernel stack size information. But both those definitions are used in the common code and throughout architectures specific code, so changing the naming is problematic. Reviewed-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/include/asm/processor.h8
-rw-r--r--arch/s390/include/asm/thread_info.h5
-rw-r--r--arch/s390/kernel/dumpstack.c4
-rw-r--r--arch/s390/kernel/irq.c2
-rw-r--r--arch/s390/kernel/setup.c12
-rw-r--r--arch/s390/kernel/smp.c6
6 files changed, 16 insertions, 21 deletions
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index 3c1e723a143a..43494a014d5b 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -163,14 +163,6 @@ struct thread_struct {
163typedef struct thread_struct thread_struct; 163typedef struct thread_struct thread_struct;
164 164
165/* 165/*
166 * General size of a stack
167 */
168#define STACK_ORDER 2
169#define STACK_SIZE (PAGE_SIZE << STACK_ORDER)
170#define STACK_INIT_OFFSET \
171 (STACK_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs))
172
173/*
174 * Stack layout of a C stack frame. 166 * Stack layout of a C stack frame.
175 */ 167 */
176#ifndef __PACK_STACK 168#ifndef __PACK_STACK
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h
index 3fa2fea0ba23..1bbbaf6ae511 100644
--- a/arch/s390/include/asm/thread_info.h
+++ b/arch/s390/include/asm/thread_info.h
@@ -11,7 +11,7 @@
11#include <linux/const.h> 11#include <linux/const.h>
12 12
13/* 13/*
14 * Size of kernel stack for each process 14 * General size of kernel stacks
15 */ 15 */
16#define THREAD_SIZE_ORDER 2 16#define THREAD_SIZE_ORDER 2
17#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) 17#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
@@ -21,6 +21,9 @@
21#include <asm/page.h> 21#include <asm/page.h>
22#include <asm/processor.h> 22#include <asm/processor.h>
23 23
24#define STACK_INIT_OFFSET \
25 (THREAD_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs))
26
24/* 27/*
25 * low level task data that entry.S needs immediate access to 28 * low level task data that entry.S needs immediate access to
26 * - this struct should fit entirely inside of one cache line 29 * - this struct should fit entirely inside of one cache line
diff --git a/arch/s390/kernel/dumpstack.c b/arch/s390/kernel/dumpstack.c
index 301b945de77b..ef85a00442cd 100644
--- a/arch/s390/kernel/dumpstack.c
+++ b/arch/s390/kernel/dumpstack.c
@@ -77,11 +77,11 @@ void dump_trace(dump_trace_func_t func, void *data, struct task_struct *task,
77 frame_size = STACK_FRAME_OVERHEAD + sizeof(struct pt_regs); 77 frame_size = STACK_FRAME_OVERHEAD + sizeof(struct pt_regs);
78#ifdef CONFIG_CHECK_STACK 78#ifdef CONFIG_CHECK_STACK
79 sp = __dump_trace(func, data, sp, 79 sp = __dump_trace(func, data, sp,
80 S390_lowcore.nodat_stack + frame_size - STACK_SIZE, 80 S390_lowcore.nodat_stack + frame_size - THREAD_SIZE,
81 S390_lowcore.nodat_stack + frame_size); 81 S390_lowcore.nodat_stack + frame_size);
82#endif 82#endif
83 sp = __dump_trace(func, data, sp, 83 sp = __dump_trace(func, data, sp,
84 S390_lowcore.async_stack + frame_size - STACK_SIZE, 84 S390_lowcore.async_stack + frame_size - THREAD_SIZE,
85 S390_lowcore.async_stack + frame_size); 85 S390_lowcore.async_stack + frame_size);
86 task = task ?: current; 86 task = task ?: current;
87 __dump_trace(func, data, sp, 87 __dump_trace(func, data, sp,
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index b2bc0eb1ca7a..0e8d68bac82c 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -171,7 +171,7 @@ void do_softirq_own_stack(void)
171 old = current_stack_pointer(); 171 old = current_stack_pointer();
172 /* Check against async. stack address range. */ 172 /* Check against async. stack address range. */
173 new = S390_lowcore.async_stack; 173 new = S390_lowcore.async_stack;
174 if (((new - old) >> (PAGE_SHIFT + STACK_ORDER)) != 0) { 174 if (((new - old) >> (PAGE_SHIFT + THREAD_SIZE_ORDER)) != 0) {
175 CALL_ON_STACK(__do_softirq, new, 0); 175 CALL_ON_STACK(__do_softirq, new, 0);
176 } else { 176 } else {
177 /* We are already on the async stack. */ 177 /* We are already on the async stack. */
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index eca51c485d09..67fa7cb8ae80 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -308,13 +308,13 @@ unsigned long stack_alloc(void)
308{ 308{
309#ifdef CONFIG_VMAP_STACK 309#ifdef CONFIG_VMAP_STACK
310 return (unsigned long) 310 return (unsigned long)
311 __vmalloc_node_range(STACK_SIZE, STACK_SIZE, 311 __vmalloc_node_range(THREAD_SIZE, THREAD_SIZE,
312 VMALLOC_START, VMALLOC_END, 312 VMALLOC_START, VMALLOC_END,
313 THREADINFO_GFP, 313 THREADINFO_GFP,
314 PAGE_KERNEL, 0, NUMA_NO_NODE, 314 PAGE_KERNEL, 0, NUMA_NO_NODE,
315 __builtin_return_address(0)); 315 __builtin_return_address(0));
316#else 316#else
317 return __get_free_pages(GFP_KERNEL, STACK_ORDER); 317 return __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER);
318#endif 318#endif
319} 319}
320 320
@@ -323,7 +323,7 @@ void stack_free(unsigned long stack)
323#ifdef CONFIG_VMAP_STACK 323#ifdef CONFIG_VMAP_STACK
324 vfree((void *) stack); 324 vfree((void *) stack);
325#else 325#else
326 free_pages(stack, STACK_ORDER); 326 free_pages(stack, THREAD_SIZE_ORDER);
327#endif 327#endif
328} 328}
329 329
@@ -331,7 +331,7 @@ int __init arch_early_irq_init(void)
331{ 331{
332 unsigned long stack; 332 unsigned long stack;
333 333
334 stack = __get_free_pages(GFP_KERNEL, STACK_ORDER); 334 stack = __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER);
335 if (!stack) 335 if (!stack)
336 panic("Couldn't allocate async stack"); 336 panic("Couldn't allocate async stack");
337 S390_lowcore.async_stack = stack + STACK_INIT_OFFSET; 337 S390_lowcore.async_stack = stack + STACK_INIT_OFFSET;
@@ -347,7 +347,7 @@ static int __init async_stack_realloc(void)
347 if (!new) 347 if (!new)
348 panic("Couldn't allocate async stack"); 348 panic("Couldn't allocate async stack");
349 S390_lowcore.async_stack = new + STACK_INIT_OFFSET; 349 S390_lowcore.async_stack = new + STACK_INIT_OFFSET;
350 free_pages(old, STACK_ORDER); 350 free_pages(old, THREAD_SIZE_ORDER);
351 return 0; 351 return 0;
352} 352}
353early_initcall(async_stack_realloc); 353early_initcall(async_stack_realloc);
@@ -428,7 +428,7 @@ static void __init setup_lowcore(void)
428 * Allocate the global restart stack which is the same for 428 * Allocate the global restart stack which is the same for
429 * all CPUs in cast *one* of them does a PSW restart. 429 * all CPUs in cast *one* of them does a PSW restart.
430 */ 430 */
431 restart_stack = memblock_virt_alloc(STACK_SIZE, STACK_SIZE); 431 restart_stack = memblock_virt_alloc(THREAD_SIZE, THREAD_SIZE);
432 restart_stack += STACK_INIT_OFFSET; 432 restart_stack += STACK_INIT_OFFSET;
433 433
434 /* 434 /*
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index fccdb96a04cb..032d98bfc60a 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -194,7 +194,7 @@ static int pcpu_alloc_lowcore(struct pcpu *pcpu, int cpu)
194 if (pcpu != &pcpu_devices[0]) { 194 if (pcpu != &pcpu_devices[0]) {
195 pcpu->lowcore = (struct lowcore *) 195 pcpu->lowcore = (struct lowcore *)
196 __get_free_pages(GFP_KERNEL | GFP_DMA, LC_ORDER); 196 __get_free_pages(GFP_KERNEL | GFP_DMA, LC_ORDER);
197 nodat_stack = __get_free_pages(GFP_KERNEL, STACK_ORDER); 197 nodat_stack = __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER);
198 if (!pcpu->lowcore || !nodat_stack) 198 if (!pcpu->lowcore || !nodat_stack)
199 goto out; 199 goto out;
200 } else { 200 } else {
@@ -226,7 +226,7 @@ out_async:
226 stack_free(async_stack); 226 stack_free(async_stack);
227out: 227out:
228 if (pcpu != &pcpu_devices[0]) { 228 if (pcpu != &pcpu_devices[0]) {
229 free_pages(nodat_stack, STACK_ORDER); 229 free_pages(nodat_stack, THREAD_SIZE_ORDER);
230 free_pages((unsigned long) pcpu->lowcore, LC_ORDER); 230 free_pages((unsigned long) pcpu->lowcore, LC_ORDER);
231 } 231 }
232 return -ENOMEM; 232 return -ENOMEM;
@@ -249,7 +249,7 @@ static void pcpu_free_lowcore(struct pcpu *pcpu)
249 stack_free(async_stack); 249 stack_free(async_stack);
250 if (pcpu == &pcpu_devices[0]) 250 if (pcpu == &pcpu_devices[0])
251 return; 251 return;
252 free_pages(nodat_stack, STACK_ORDER); 252 free_pages(nodat_stack, THREAD_SIZE_ORDER);
253 free_pages(lowcore, LC_ORDER); 253 free_pages(lowcore, LC_ORDER);
254} 254}
255 255