diff options
Diffstat (limited to 'arch/parisc/kernel')
| -rw-r--r-- | arch/parisc/kernel/sys_parisc.c | 6 | ||||
| -rw-r--r-- | arch/parisc/kernel/syscall.S | 12 | ||||
| -rw-r--r-- | arch/parisc/kernel/traps.c | 54 | 
3 files changed, 37 insertions, 35 deletions
| 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)  {  	unsigned long stack_base; -	/* Limit stack size to 1GB - see setup_arg_pages() in fs/exec.c */ +	/* Limit stack size - see setup_arg_pages() in fs/exec.c */  	stack_base = rlimit_max(RLIMIT_STACK); -	if (stack_base > (1 << 30)) -		stack_base = 1 << 30; +	if (stack_base > STACK_SIZE_MAX) +		stack_base = STACK_SIZE_MAX;  	return PAGE_ALIGN(STACK_TOP - stack_base);  } 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:  # endif  /* ENABLE_LWS_DEBUG */ +	rsm	PSW_SM_I, %r0				/* Disable interrupts */ +	/* COW breaks can cause contention on UP systems */  	LDCW	0(%sr2,%r20), %r28			/* Try to acquire the lock */  	cmpb,<>,n	%r0, %r28, cas_action		/* Did we get it? */  cas_wouldblock:  	ldo	2(%r0), %r28				/* 2nd case */ +	ssm	PSW_SM_I, %r0  	b	lws_exit				/* Contended... */  	ldo	-EAGAIN(%r0), %r21			/* Spin in userspace */ @@ -619,15 +622,17 @@ cas_action:  	stw	%r1, 4(%sr2,%r20)  #endif  	/* The load and store could fail */ -1:	ldw	0(%sr3,%r26), %r28 +1:	ldw,ma	0(%sr3,%r26), %r28  	sub,<>	%r28, %r25, %r0 -2:	stw	%r24, 0(%sr3,%r26) +2:	stw,ma	%r24, 0(%sr3,%r26)  	/* Free lock */ -	stw	%r20, 0(%sr2,%r20) +	stw,ma	%r20, 0(%sr2,%r20)  #if ENABLE_LWS_DEBUG  	/* Clear thread register indicator */  	stw	%r0, 4(%sr2,%r20)  #endif +	/* Enable interrupts */ +	ssm	PSW_SM_I, %r0  	/* Return to userspace, set no error */  	b	lws_exit  	copy	%r0, %r21 @@ -639,6 +644,7 @@ cas_action:  #if ENABLE_LWS_DEBUG  	stw	%r0, 4(%sr2,%r20)  #endif +	ssm	PSW_SM_I, %r0  	b	lws_exit  	ldo	-EFAULT(%r0),%r21	/* set errno */  	nop 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 @@  #include <linux/interrupt.h>  #include <linux/console.h>  #include <linux/bug.h> +#include <linux/ratelimit.h>  #include <asm/assembly.h>  #include <asm/uaccess.h> @@ -42,9 +43,6 @@  #include "../math-emu/math-emu.h"	/* for handle_fpe() */ -#define PRINT_USER_FAULTS /* (turn this on if you want user faults to be */ -			  /*  dumped to the console via printk)          */ -  #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)  DEFINE_SPINLOCK(pa_dbit_lock);  #endif @@ -160,6 +158,17 @@ void show_regs(struct pt_regs *regs)  	}  } +static DEFINE_RATELIMIT_STATE(_hppa_rs, +	DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST); + +#define parisc_printk_ratelimited(critical, regs, fmt, ...)	{	      \ +	if ((critical || show_unhandled_signals) && __ratelimit(&_hppa_rs)) { \ +		printk(fmt, ##__VA_ARGS__);				      \ +		show_regs(regs);					      \ +	}								      \ +} + +  static void do_show_stack(struct unwind_frame_info *info)  {  	int i = 1; @@ -229,12 +238,10 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)  		if (err == 0)  			return; /* STFU */ -		printk(KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n", +		parisc_printk_ratelimited(1, regs, +			KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n",  			current->comm, task_pid_nr(current), str, err, regs->iaoq[0]); -#ifdef PRINT_USER_FAULTS -		/* XXX for debugging only */ -		show_regs(regs); -#endif +  		return;  	} @@ -321,14 +328,11 @@ static void handle_break(struct pt_regs *regs)  			(tt == BUG_TRAP_TYPE_NONE) ? 9 : 0);  	} -#ifdef PRINT_USER_FAULTS -	if (unlikely(iir != GDB_BREAK_INSN)) { -		printk(KERN_DEBUG "break %d,%d: pid=%d command='%s'\n", +	if (unlikely(iir != GDB_BREAK_INSN)) +		parisc_printk_ratelimited(0, regs, +			KERN_DEBUG "break %d,%d: pid=%d command='%s'\n",  			iir & 31, (iir>>13) & ((1<<13)-1),  			task_pid_nr(current), current->comm); -		show_regs(regs); -	} -#endif  	/* send standard GDB signal */  	handle_gdb_break(regs, TRAP_BRKPT); @@ -758,11 +762,9 @@ void notrace handle_interruption(int code, struct pt_regs *regs)  	default:  		if (user_mode(regs)) { -#ifdef PRINT_USER_FAULTS -			printk(KERN_DEBUG "\nhandle_interruption() pid=%d command='%s'\n", -			    task_pid_nr(current), current->comm); -			show_regs(regs); -#endif +			parisc_printk_ratelimited(0, regs, KERN_DEBUG +				"handle_interruption() pid=%d command='%s'\n", +				task_pid_nr(current), current->comm);  			/* SIGBUS, for lack of a better one. */  			si.si_signo = SIGBUS;  			si.si_code = BUS_OBJERR; @@ -779,16 +781,10 @@ void notrace handle_interruption(int code, struct pt_regs *regs)  	if (user_mode(regs)) {  	    if ((fault_space >> SPACEID_SHIFT) != (regs->sr[7] >> SPACEID_SHIFT)) { -#ifdef PRINT_USER_FAULTS -		if (fault_space == 0) -			printk(KERN_DEBUG "User Fault on Kernel Space "); -		else -			printk(KERN_DEBUG "User Fault (long pointer) (fault %d) ", -			       code); -		printk(KERN_CONT "pid=%d command='%s'\n", -		       task_pid_nr(current), current->comm); -		show_regs(regs); -#endif +		parisc_printk_ratelimited(0, regs, KERN_DEBUG +				"User fault %d on space 0x%08lx, pid=%d command='%s'\n", +				code, fault_space, +				task_pid_nr(current), current->comm);  		si.si_signo = SIGSEGV;  		si.si_errno = 0;  		si.si_code = SEGV_MAPERR; |