aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2014-05-22 04:28:56 -0400
committerIngo Molnar <mingo@kernel.org>2014-05-22 04:28:56 -0400
commit65c2ce70046c779974af8b5dfc25a0df489089b5 (patch)
treeb16f152eb62b71cf5a1edc51da865b357c989922 /arch/parisc
parent842514849a616e9b61acad65771c7afe01e651f9 (diff)
parent4b660a7f5c8099d88d1a43d8ae138965112592c7 (diff)
Merge tag 'v3.15-rc6' into sched/core, to pick up the latest fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/parisc')
-rw-r--r--arch/parisc/Kconfig1
-rw-r--r--arch/parisc/include/asm/processor.h5
-rw-r--r--arch/parisc/include/uapi/asm/Kbuild3
-rw-r--r--arch/parisc/include/uapi/asm/resource.h7
-rw-r--r--arch/parisc/include/uapi/asm/unistd.h3
-rw-r--r--arch/parisc/kernel/sys_parisc.c6
-rw-r--r--arch/parisc/kernel/syscall.S12
-rw-r--r--arch/parisc/kernel/syscall_table.S1
-rw-r--r--arch/parisc/kernel/traps.c54
-rw-r--r--arch/parisc/mm/fault.c44
10 files changed, 78 insertions, 58 deletions
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 1faefed32749..108d48e652af 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -22,6 +22,7 @@ config PARISC
22 select GENERIC_SMP_IDLE_THREAD 22 select GENERIC_SMP_IDLE_THREAD
23 select GENERIC_STRNCPY_FROM_USER 23 select GENERIC_STRNCPY_FROM_USER
24 select SYSCTL_ARCH_UNALIGN_ALLOW 24 select SYSCTL_ARCH_UNALIGN_ALLOW
25 select SYSCTL_EXCEPTION_TRACE
25 select HAVE_MOD_ARCH_SPECIFIC 26 select HAVE_MOD_ARCH_SPECIFIC
26 select VIRT_TO_BUS 27 select VIRT_TO_BUS
27 select MODULES_USE_ELF_RELA 28 select MODULES_USE_ELF_RELA
diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h
index 198a86feb574..d951c9681ab3 100644
--- a/arch/parisc/include/asm/processor.h
+++ b/arch/parisc/include/asm/processor.h
@@ -55,6 +55,11 @@
55#define STACK_TOP TASK_SIZE 55#define STACK_TOP TASK_SIZE
56#define STACK_TOP_MAX DEFAULT_TASK_SIZE 56#define STACK_TOP_MAX DEFAULT_TASK_SIZE
57 57
58/* Allow bigger stacks for 64-bit processes */
59#define STACK_SIZE_MAX (USER_WIDE_MODE \
60 ? (1 << 30) /* 1 GB */ \
61 : (CONFIG_MAX_STACK_SIZE_MB*1024*1024))
62
58#endif 63#endif
59 64
60#ifndef __ASSEMBLY__ 65#ifndef __ASSEMBLY__
diff --git a/arch/parisc/include/uapi/asm/Kbuild b/arch/parisc/include/uapi/asm/Kbuild
index a580642555b6..348356c99514 100644
--- a/arch/parisc/include/uapi/asm/Kbuild
+++ b/arch/parisc/include/uapi/asm/Kbuild
@@ -1,6 +1,8 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += resource.h
5
4header-y += bitsperlong.h 6header-y += bitsperlong.h
5header-y += byteorder.h 7header-y += byteorder.h
6header-y += errno.h 8header-y += errno.h
@@ -13,7 +15,6 @@ header-y += msgbuf.h
13header-y += pdc.h 15header-y += pdc.h
14header-y += posix_types.h 16header-y += posix_types.h
15header-y += ptrace.h 17header-y += ptrace.h
16header-y += resource.h
17header-y += sembuf.h 18header-y += sembuf.h
18header-y += setup.h 19header-y += setup.h
19header-y += shmbuf.h 20header-y += shmbuf.h
diff --git a/arch/parisc/include/uapi/asm/resource.h b/arch/parisc/include/uapi/asm/resource.h
deleted file mode 100644
index 8b06343b62ed..000000000000
--- a/arch/parisc/include/uapi/asm/resource.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_PARISC_RESOURCE_H
2#define _ASM_PARISC_RESOURCE_H
3
4#define _STK_LIM_MAX 10 * _STK_LIM
5#include <asm-generic/resource.h>
6
7#endif
diff --git a/arch/parisc/include/uapi/asm/unistd.h b/arch/parisc/include/uapi/asm/unistd.h
index 265ae5190b0a..47e0e21d2272 100644
--- a/arch/parisc/include/uapi/asm/unistd.h
+++ b/arch/parisc/include/uapi/asm/unistd.h
@@ -829,8 +829,9 @@
829#define __NR_sched_setattr (__NR_Linux + 334) 829#define __NR_sched_setattr (__NR_Linux + 334)
830#define __NR_sched_getattr (__NR_Linux + 335) 830#define __NR_sched_getattr (__NR_Linux + 335)
831#define __NR_utimes (__NR_Linux + 336) 831#define __NR_utimes (__NR_Linux + 336)
832#define __NR_renameat2 (__NR_Linux + 337)
832 833
833#define __NR_Linux_syscalls (__NR_utimes + 1) 834#define __NR_Linux_syscalls (__NR_renameat2 + 1)
834 835
835 836
836#define __IGNORE_select /* newselect */ 837#define __IGNORE_select /* newselect */
diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
index 31ffa9b55322..e1ffea2f9a0b 100644
--- a/arch/parisc/kernel/sys_parisc.c
+++ b/arch/parisc/kernel/sys_parisc.c
@@ -72,10 +72,10 @@ static unsigned long mmap_upper_limit(void)
72{ 72{
73 unsigned long stack_base; 73 unsigned long stack_base;
74 74
75 /* Limit stack size to 1GB - see setup_arg_pages() in fs/exec.c */ 75 /* Limit stack size - see setup_arg_pages() in fs/exec.c */
76 stack_base = rlimit_max(RLIMIT_STACK); 76 stack_base = rlimit_max(RLIMIT_STACK);
77 if (stack_base > (1 << 30)) 77 if (stack_base > STACK_SIZE_MAX)
78 stack_base = 1 << 30; 78 stack_base = STACK_SIZE_MAX;
79 79
80 return PAGE_ALIGN(STACK_TOP - stack_base); 80 return PAGE_ALIGN(STACK_TOP - stack_base);
81} 81}
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
index a63bb179f79a..838786011037 100644
--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -589,10 +589,13 @@ cas_nocontend:
589# endif 589# endif
590/* ENABLE_LWS_DEBUG */ 590/* ENABLE_LWS_DEBUG */
591 591
592 rsm PSW_SM_I, %r0 /* Disable interrupts */
593 /* COW breaks can cause contention on UP systems */
592 LDCW 0(%sr2,%r20), %r28 /* Try to acquire the lock */ 594 LDCW 0(%sr2,%r20), %r28 /* Try to acquire the lock */
593 cmpb,<>,n %r0, %r28, cas_action /* Did we get it? */ 595 cmpb,<>,n %r0, %r28, cas_action /* Did we get it? */
594cas_wouldblock: 596cas_wouldblock:
595 ldo 2(%r0), %r28 /* 2nd case */ 597 ldo 2(%r0), %r28 /* 2nd case */
598 ssm PSW_SM_I, %r0
596 b lws_exit /* Contended... */ 599 b lws_exit /* Contended... */
597 ldo -EAGAIN(%r0), %r21 /* Spin in userspace */ 600 ldo -EAGAIN(%r0), %r21 /* Spin in userspace */
598 601
@@ -619,15 +622,17 @@ cas_action:
619 stw %r1, 4(%sr2,%r20) 622 stw %r1, 4(%sr2,%r20)
620#endif 623#endif
621 /* The load and store could fail */ 624 /* The load and store could fail */
6221: ldw 0(%sr3,%r26), %r28 6251: ldw,ma 0(%sr3,%r26), %r28
623 sub,<> %r28, %r25, %r0 626 sub,<> %r28, %r25, %r0
6242: stw %r24, 0(%sr3,%r26) 6272: stw,ma %r24, 0(%sr3,%r26)
625 /* Free lock */ 628 /* Free lock */
626 stw %r20, 0(%sr2,%r20) 629 stw,ma %r20, 0(%sr2,%r20)
627#if ENABLE_LWS_DEBUG 630#if ENABLE_LWS_DEBUG
628 /* Clear thread register indicator */ 631 /* Clear thread register indicator */
629 stw %r0, 4(%sr2,%r20) 632 stw %r0, 4(%sr2,%r20)
630#endif 633#endif
634 /* Enable interrupts */
635 ssm PSW_SM_I, %r0
631 /* Return to userspace, set no error */ 636 /* Return to userspace, set no error */
632 b lws_exit 637 b lws_exit
633 copy %r0, %r21 638 copy %r0, %r21
@@ -639,6 +644,7 @@ cas_action:
639#if ENABLE_LWS_DEBUG 644#if ENABLE_LWS_DEBUG
640 stw %r0, 4(%sr2,%r20) 645 stw %r0, 4(%sr2,%r20)
641#endif 646#endif
647 ssm PSW_SM_I, %r0
642 b lws_exit 648 b lws_exit
643 ldo -EFAULT(%r0),%r21 /* set errno */ 649 ldo -EFAULT(%r0),%r21 /* set errno */
644 nop 650 nop
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 83ead0ea127d..f1432da7b4c0 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -432,6 +432,7 @@
432 ENTRY_SAME(sched_setattr) 432 ENTRY_SAME(sched_setattr)
433 ENTRY_SAME(sched_getattr) /* 335 */ 433 ENTRY_SAME(sched_getattr) /* 335 */
434 ENTRY_COMP(utimes) 434 ENTRY_COMP(utimes)
435 ENTRY_COMP(renameat2)
435 436
436 /* Nothing yet */ 437 /* Nothing yet */
437 438
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
index 1cd1d0c83b6d..47ee620d15d2 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
@@ -25,6 +25,7 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/console.h> 26#include <linux/console.h>
27#include <linux/bug.h> 27#include <linux/bug.h>
28#include <linux/ratelimit.h>
28 29
29#include <asm/assembly.h> 30#include <asm/assembly.h>
30#include <asm/uaccess.h> 31#include <asm/uaccess.h>
@@ -42,9 +43,6 @@
42 43
43#include "../math-emu/math-emu.h" /* for handle_fpe() */ 44#include "../math-emu/math-emu.h" /* for handle_fpe() */
44 45
45#define PRINT_USER_FAULTS /* (turn this on if you want user faults to be */
46 /* dumped to the console via printk) */
47
48#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 46#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
49DEFINE_SPINLOCK(pa_dbit_lock); 47DEFINE_SPINLOCK(pa_dbit_lock);
50#endif 48#endif
@@ -160,6 +158,17 @@ void show_regs(struct pt_regs *regs)
160 } 158 }
161} 159}
162 160
161static DEFINE_RATELIMIT_STATE(_hppa_rs,
162 DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST);
163
164#define parisc_printk_ratelimited(critical, regs, fmt, ...) { \
165 if ((critical || show_unhandled_signals) && __ratelimit(&_hppa_rs)) { \
166 printk(fmt, ##__VA_ARGS__); \
167 show_regs(regs); \
168 } \
169}
170
171
163static void do_show_stack(struct unwind_frame_info *info) 172static void do_show_stack(struct unwind_frame_info *info)
164{ 173{
165 int i = 1; 174 int i = 1;
@@ -229,12 +238,10 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)
229 if (err == 0) 238 if (err == 0)
230 return; /* STFU */ 239 return; /* STFU */
231 240
232 printk(KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n", 241 parisc_printk_ratelimited(1, regs,
242 KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n",
233 current->comm, task_pid_nr(current), str, err, regs->iaoq[0]); 243 current->comm, task_pid_nr(current), str, err, regs->iaoq[0]);
234#ifdef PRINT_USER_FAULTS 244
235 /* XXX for debugging only */
236 show_regs(regs);
237#endif
238 return; 245 return;
239 } 246 }
240 247
@@ -321,14 +328,11 @@ static void handle_break(struct pt_regs *regs)
321 (tt == BUG_TRAP_TYPE_NONE) ? 9 : 0); 328 (tt == BUG_TRAP_TYPE_NONE) ? 9 : 0);
322 } 329 }
323 330
324#ifdef PRINT_USER_FAULTS 331 if (unlikely(iir != GDB_BREAK_INSN))
325 if (unlikely(iir != GDB_BREAK_INSN)) { 332 parisc_printk_ratelimited(0, regs,
326 printk(KERN_DEBUG "break %d,%d: pid=%d command='%s'\n", 333 KERN_DEBUG "break %d,%d: pid=%d command='%s'\n",
327 iir & 31, (iir>>13) & ((1<<13)-1), 334 iir & 31, (iir>>13) & ((1<<13)-1),
328 task_pid_nr(current), current->comm); 335 task_pid_nr(current), current->comm);
329 show_regs(regs);
330 }
331#endif
332 336
333 /* send standard GDB signal */ 337 /* send standard GDB signal */
334 handle_gdb_break(regs, TRAP_BRKPT); 338 handle_gdb_break(regs, TRAP_BRKPT);
@@ -758,11 +762,9 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
758 762
759 default: 763 default:
760 if (user_mode(regs)) { 764 if (user_mode(regs)) {
761#ifdef PRINT_USER_FAULTS 765 parisc_printk_ratelimited(0, regs, KERN_DEBUG
762 printk(KERN_DEBUG "\nhandle_interruption() pid=%d command='%s'\n", 766 "handle_interruption() pid=%d command='%s'\n",
763 task_pid_nr(current), current->comm); 767 task_pid_nr(current), current->comm);
764 show_regs(regs);
765#endif
766 /* SIGBUS, for lack of a better one. */ 768 /* SIGBUS, for lack of a better one. */
767 si.si_signo = SIGBUS; 769 si.si_signo = SIGBUS;
768 si.si_code = BUS_OBJERR; 770 si.si_code = BUS_OBJERR;
@@ -779,16 +781,10 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
779 781
780 if (user_mode(regs)) { 782 if (user_mode(regs)) {
781 if ((fault_space >> SPACEID_SHIFT) != (regs->sr[7] >> SPACEID_SHIFT)) { 783 if ((fault_space >> SPACEID_SHIFT) != (regs->sr[7] >> SPACEID_SHIFT)) {
782#ifdef PRINT_USER_FAULTS 784 parisc_printk_ratelimited(0, regs, KERN_DEBUG
783 if (fault_space == 0) 785 "User fault %d on space 0x%08lx, pid=%d command='%s'\n",
784 printk(KERN_DEBUG "User Fault on Kernel Space "); 786 code, fault_space,
785 else 787 task_pid_nr(current), current->comm);
786 printk(KERN_DEBUG "User Fault (long pointer) (fault %d) ",
787 code);
788 printk(KERN_CONT "pid=%d command='%s'\n",
789 task_pid_nr(current), current->comm);
790 show_regs(regs);
791#endif
792 si.si_signo = SIGSEGV; 788 si.si_signo = SIGSEGV;
793 si.si_errno = 0; 789 si.si_errno = 0;
794 si.si_code = SEGV_MAPERR; 790 si.si_code = SEGV_MAPERR;
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
index 747550762f3c..3ca9c1131cfe 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -19,10 +19,6 @@
19#include <asm/uaccess.h> 19#include <asm/uaccess.h>
20#include <asm/traps.h> 20#include <asm/traps.h>
21 21
22#define PRINT_USER_FAULTS /* (turn this on if you want user faults to be */
23 /* dumped to the console via printk) */
24
25
26/* Various important other fields */ 22/* Various important other fields */
27#define bit22set(x) (x & 0x00000200) 23#define bit22set(x) (x & 0x00000200)
28#define bits23_25set(x) (x & 0x000001c0) 24#define bits23_25set(x) (x & 0x000001c0)
@@ -34,6 +30,8 @@
34 30
35DEFINE_PER_CPU(struct exception_data, exception_data); 31DEFINE_PER_CPU(struct exception_data, exception_data);
36 32
33int show_unhandled_signals = 1;
34
37/* 35/*
38 * parisc_acctyp(unsigned int inst) -- 36 * parisc_acctyp(unsigned int inst) --
39 * Given a PA-RISC memory access instruction, determine if the 37 * Given a PA-RISC memory access instruction, determine if the
@@ -173,6 +171,32 @@ int fixup_exception(struct pt_regs *regs)
173 return 0; 171 return 0;
174} 172}
175 173
174/*
175 * Print out info about fatal segfaults, if the show_unhandled_signals
176 * sysctl is set:
177 */
178static inline void
179show_signal_msg(struct pt_regs *regs, unsigned long code,
180 unsigned long address, struct task_struct *tsk,
181 struct vm_area_struct *vma)
182{
183 if (!unhandled_signal(tsk, SIGSEGV))
184 return;
185
186 if (!printk_ratelimit())
187 return;
188
189 pr_warn("\n");
190 pr_warn("do_page_fault() command='%s' type=%lu address=0x%08lx",
191 tsk->comm, code, address);
192 print_vma_addr(KERN_CONT " in ", regs->iaoq[0]);
193 if (vma)
194 pr_warn(" vm_start = 0x%08lx, vm_end = 0x%08lx\n",
195 vma->vm_start, vma->vm_end);
196
197 show_regs(regs);
198}
199
176void do_page_fault(struct pt_regs *regs, unsigned long code, 200void do_page_fault(struct pt_regs *regs, unsigned long code,
177 unsigned long address) 201 unsigned long address)
178{ 202{
@@ -270,16 +294,8 @@ bad_area:
270 if (user_mode(regs)) { 294 if (user_mode(regs)) {
271 struct siginfo si; 295 struct siginfo si;
272 296
273#ifdef PRINT_USER_FAULTS 297 show_signal_msg(regs, code, address, tsk, vma);
274 printk(KERN_DEBUG "\n"); 298
275 printk(KERN_DEBUG "do_page_fault() pid=%d command='%s' type=%lu address=0x%08lx\n",
276 task_pid_nr(tsk), tsk->comm, code, address);
277 if (vma) {
278 printk(KERN_DEBUG "vm_start = 0x%08lx, vm_end = 0x%08lx\n",
279 vma->vm_start, vma->vm_end);
280 }
281 show_regs(regs);
282#endif
283 switch (code) { 299 switch (code) {
284 case 15: /* Data TLB miss fault/Data page fault */ 300 case 15: /* Data TLB miss fault/Data page fault */
285 /* send SIGSEGV when outside of vma */ 301 /* send SIGSEGV when outside of vma */