Skip to content

Commit 55bea71

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 fixes from Martin Schwidefsky: "A few more s390 patches for 4.9: - a fix for an overflow in the dasd driver reported by UBSAN - fix a regression and add hotplug memory to the zone movable again - add ignore defines for the pkey system calls - fix the ouput of the merged stack tracer - replace printk with pr_cont in arch/s390 where appropriate - remove the arch specific return_address function again - ignore reserved channel paths at boot time - add a missing hugetlb_bad_size call to the arch backend" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: s390/mm: fix zone calculation in arch_add_memory() s390/dumpstack: use pr_cont within show_stack and die s390/dumpstack: get rid of return_address again s390/disassambler: use pr_cont where appropriate s390/dumpstack: use pr_cont where appropriate s390/dumpstack: restore reliable indicator for call traces s390/mm: use hugetlb_bad_size() s390/cio: don't register chpids in reserved state s390: ignore pkey system calls s390/dasd: avoid undefined behaviour
2 parents 7618c6a + 4a65429 commit 55bea71

12 files changed

Lines changed: 61 additions & 72 deletions

File tree

arch/s390/include/asm/ftrace.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212

1313
#ifndef __ASSEMBLY__
1414

15-
unsigned long return_address(int depth);
16-
17-
#define ftrace_return_address(n) return_address(n)
15+
#define ftrace_return_address(n) __builtin_return_address(n)
1816

1917
void _mcount(void);
2018
void ftrace_caller(void);

arch/s390/include/asm/processor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ struct task_struct;
192192
struct mm_struct;
193193
struct seq_file;
194194

195-
typedef int (*dump_trace_func_t)(void *data, unsigned long address);
195+
typedef int (*dump_trace_func_t)(void *data, unsigned long address, int reliable);
196196
void dump_trace(dump_trace_func_t func, void *data,
197197
struct task_struct *task, unsigned long sp);
198198

arch/s390/include/asm/unistd.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
#include <uapi/asm/unistd.h>
1010

1111
#define __IGNORE_time
12+
#define __IGNORE_pkey_mprotect
13+
#define __IGNORE_pkey_alloc
14+
#define __IGNORE_pkey_free
1215

1316
#define __ARCH_WANT_OLD_READDIR
1417
#define __ARCH_WANT_SYS_ALARM

arch/s390/kernel/dis.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,12 +2014,12 @@ void show_code(struct pt_regs *regs)
20142014
*ptr++ = '\t';
20152015
ptr += print_insn(ptr, code + start, addr);
20162016
start += opsize;
2017-
printk("%s", buffer);
2017+
pr_cont("%s", buffer);
20182018
ptr = buffer;
20192019
ptr += sprintf(ptr, "\n ");
20202020
hops++;
20212021
}
2022-
printk("\n");
2022+
pr_cont("\n");
20232023
}
20242024

20252025
void print_fn_code(unsigned char *code, unsigned long len)

arch/s390/kernel/dumpstack.c

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,27 @@ __dump_trace(dump_trace_func_t func, void *data, unsigned long sp,
3838
if (sp < low || sp > high - sizeof(*sf))
3939
return sp;
4040
sf = (struct stack_frame *) sp;
41+
if (func(data, sf->gprs[8], 0))
42+
return sp;
4143
/* Follow the backchain. */
4244
while (1) {
43-
if (func(data, sf->gprs[8]))
44-
return sp;
4545
low = sp;
4646
sp = sf->back_chain;
4747
if (!sp)
4848
break;
4949
if (sp <= low || sp > high - sizeof(*sf))
5050
return sp;
5151
sf = (struct stack_frame *) sp;
52+
if (func(data, sf->gprs[8], 1))
53+
return sp;
5254
}
5355
/* Zero backchain detected, check for interrupt frame. */
5456
sp = (unsigned long) (sf + 1);
5557
if (sp <= low || sp > high - sizeof(*regs))
5658
return sp;
5759
regs = (struct pt_regs *) sp;
5860
if (!user_mode(regs)) {
59-
if (func(data, regs->psw.addr))
61+
if (func(data, regs->psw.addr, 1))
6062
return sp;
6163
}
6264
low = sp;
@@ -85,33 +87,12 @@ void dump_trace(dump_trace_func_t func, void *data, struct task_struct *task,
8587
}
8688
EXPORT_SYMBOL_GPL(dump_trace);
8789

88-
struct return_address_data {
89-
unsigned long address;
90-
int depth;
91-
};
92-
93-
static int __return_address(void *data, unsigned long address)
94-
{
95-
struct return_address_data *rd = data;
96-
97-
if (rd->depth--)
98-
return 0;
99-
rd->address = address;
100-
return 1;
101-
}
102-
103-
unsigned long return_address(int depth)
104-
{
105-
struct return_address_data rd = { .depth = depth + 2 };
106-
107-
dump_trace(__return_address, &rd, NULL, current_stack_pointer());
108-
return rd.address;
109-
}
110-
EXPORT_SYMBOL_GPL(return_address);
111-
112-
static int show_address(void *data, unsigned long address)
90+
static int show_address(void *data, unsigned long address, int reliable)
11391
{
114-
printk("([<%016lx>] %pSR)\n", address, (void *)address);
92+
if (reliable)
93+
printk(" [<%016lx>] %pSR \n", address, (void *)address);
94+
else
95+
printk("([<%016lx>] %pSR)\n", address, (void *)address);
11596
return 0;
11697
}
11798

@@ -138,14 +119,14 @@ void show_stack(struct task_struct *task, unsigned long *sp)
138119
else
139120
stack = (unsigned long *)task->thread.ksp;
140121
}
122+
printk(KERN_DEFAULT "Stack:\n");
141123
for (i = 0; i < 20; i++) {
142124
if (((addr_t) stack & (THREAD_SIZE-1)) == 0)
143125
break;
144-
if ((i * sizeof(long) % 32) == 0)
145-
printk("%s ", i == 0 ? "" : "\n");
146-
printk("%016lx ", *stack++);
126+
if (i % 4 == 0)
127+
printk(KERN_DEFAULT " ");
128+
pr_cont("%016lx%c", *stack++, i % 4 == 3 ? '\n' : ' ');
147129
}
148-
printk("\n");
149130
show_trace(task, (unsigned long)sp);
150131
}
151132

@@ -163,13 +144,13 @@ void show_registers(struct pt_regs *regs)
163144
mode = user_mode(regs) ? "User" : "Krnl";
164145
printk("%s PSW : %p %p", mode, (void *)regs->psw.mask, (void *)regs->psw.addr);
165146
if (!user_mode(regs))
166-
printk(" (%pSR)", (void *)regs->psw.addr);
167-
printk("\n");
147+
pr_cont(" (%pSR)", (void *)regs->psw.addr);
148+
pr_cont("\n");
168149
printk(" R:%x T:%x IO:%x EX:%x Key:%x M:%x W:%x "
169150
"P:%x AS:%x CC:%x PM:%x", psw->r, psw->t, psw->i, psw->e,
170151
psw->key, psw->m, psw->w, psw->p, psw->as, psw->cc, psw->pm);
171-
printk(" RI:%x EA:%x", psw->ri, psw->eaba);
172-
printk("\n%s GPRS: %016lx %016lx %016lx %016lx\n", mode,
152+
pr_cont(" RI:%x EA:%x\n", psw->ri, psw->eaba);
153+
printk("%s GPRS: %016lx %016lx %016lx %016lx\n", mode,
173154
regs->gprs[0], regs->gprs[1], regs->gprs[2], regs->gprs[3]);
174155
printk(" %016lx %016lx %016lx %016lx\n",
175156
regs->gprs[4], regs->gprs[5], regs->gprs[6], regs->gprs[7]);
@@ -205,14 +186,14 @@ void die(struct pt_regs *regs, const char *str)
205186
printk("%s: %04x ilc:%d [#%d] ", str, regs->int_code & 0xffff,
206187
regs->int_code >> 17, ++die_counter);
207188
#ifdef CONFIG_PREEMPT
208-
printk("PREEMPT ");
189+
pr_cont("PREEMPT ");
209190
#endif
210191
#ifdef CONFIG_SMP
211-
printk("SMP ");
192+
pr_cont("SMP ");
212193
#endif
213194
if (debug_pagealloc_enabled())
214-
printk("DEBUG_PAGEALLOC");
215-
printk("\n");
195+
pr_cont("DEBUG_PAGEALLOC");
196+
pr_cont("\n");
216197
notify_die(DIE_OOPS, str, regs, 0, regs->int_code & 0xffff, SIGSEGV);
217198
print_modules();
218199
show_regs(regs);

arch/s390/kernel/perf_event.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static int __init service_level_perf_register(void)
222222
}
223223
arch_initcall(service_level_perf_register);
224224

225-
static int __perf_callchain_kernel(void *data, unsigned long address)
225+
static int __perf_callchain_kernel(void *data, unsigned long address, int reliable)
226226
{
227227
struct perf_callchain_entry_ctx *entry = data;
228228

arch/s390/kernel/stacktrace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ static int __save_address(void *data, unsigned long address, int nosched)
2727
return 1;
2828
}
2929

30-
static int save_address(void *data, unsigned long address)
30+
static int save_address(void *data, unsigned long address, int reliable)
3131
{
3232
return __save_address(data, address, 0);
3333
}
3434

35-
static int save_address_nosched(void *data, unsigned long address)
35+
static int save_address_nosched(void *data, unsigned long address, int reliable)
3636
{
3737
return __save_address(data, address, 1);
3838
}

arch/s390/mm/hugetlbpage.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ static __init int setup_hugepagesz(char *opt)
217217
} else if (MACHINE_HAS_EDAT2 && size == PUD_SIZE) {
218218
hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
219219
} else {
220+
hugetlb_bad_size();
220221
pr_err("hugepagesz= specifies an unsupported page size %s\n",
221222
string);
222223
return 0;

arch/s390/mm/init.c

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -151,36 +151,40 @@ void __init free_initrd_mem(unsigned long start, unsigned long end)
151151
#ifdef CONFIG_MEMORY_HOTPLUG
152152
int arch_add_memory(int nid, u64 start, u64 size, bool for_device)
153153
{
154-
unsigned long normal_end_pfn = PFN_DOWN(memblock_end_of_DRAM());
155-
unsigned long dma_end_pfn = PFN_DOWN(MAX_DMA_ADDRESS);
154+
unsigned long zone_start_pfn, zone_end_pfn, nr_pages;
156155
unsigned long start_pfn = PFN_DOWN(start);
157156
unsigned long size_pages = PFN_DOWN(size);
158-
unsigned long nr_pages;
159-
int rc, zone_enum;
157+
pg_data_t *pgdat = NODE_DATA(nid);
158+
struct zone *zone;
159+
int rc, i;
160160

161161
rc = vmem_add_mapping(start, size);
162162
if (rc)
163163
return rc;
164164

165-
while (size_pages > 0) {
166-
if (start_pfn < dma_end_pfn) {
167-
nr_pages = (start_pfn + size_pages > dma_end_pfn) ?
168-
dma_end_pfn - start_pfn : size_pages;
169-
zone_enum = ZONE_DMA;
170-
} else if (start_pfn < normal_end_pfn) {
171-
nr_pages = (start_pfn + size_pages > normal_end_pfn) ?
172-
normal_end_pfn - start_pfn : size_pages;
173-
zone_enum = ZONE_NORMAL;
165+
for (i = 0; i < MAX_NR_ZONES; i++) {
166+
zone = pgdat->node_zones + i;
167+
if (zone_idx(zone) != ZONE_MOVABLE) {
168+
/* Add range within existing zone limits, if possible */
169+
zone_start_pfn = zone->zone_start_pfn;
170+
zone_end_pfn = zone->zone_start_pfn +
171+
zone->spanned_pages;
174172
} else {
175-
nr_pages = size_pages;
176-
zone_enum = ZONE_MOVABLE;
173+
/* Add remaining range to ZONE_MOVABLE */
174+
zone_start_pfn = start_pfn;
175+
zone_end_pfn = start_pfn + size_pages;
177176
}
178-
rc = __add_pages(nid, NODE_DATA(nid)->node_zones + zone_enum,
179-
start_pfn, size_pages);
177+
if (start_pfn < zone_start_pfn || start_pfn >= zone_end_pfn)
178+
continue;
179+
nr_pages = (start_pfn + size_pages > zone_end_pfn) ?
180+
zone_end_pfn - start_pfn : size_pages;
181+
rc = __add_pages(nid, zone, start_pfn, nr_pages);
180182
if (rc)
181183
break;
182184
start_pfn += nr_pages;
183185
size_pages -= nr_pages;
186+
if (!size_pages)
187+
break;
184188
}
185189
if (rc)
186190
vmem_remove_mapping(start, size);

arch/s390/oprofile/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <linux/init.h>
1414
#include <asm/processor.h>
1515

16-
static int __s390_backtrace(void *data, unsigned long address)
16+
static int __s390_backtrace(void *data, unsigned long address, int reliable)
1717
{
1818
unsigned int *depth = data;
1919

0 commit comments

Comments
 (0)