Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/fault: merge report_user_fault implementations

We have two close to identical report_user_fault functions.
Add a parameter to one and get rid of the other one in order
to reduce code duplication.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Heiko Carstens and committed by
Martin Schwidefsky
5d7eccec ee8479bb

+12 -26
+2
arch/s390/include/asm/setup.h
··· 101 101 #define pfault_fini() do { } while (0) 102 102 #endif /* CONFIG_PFAULT */ 103 103 104 + void report_user_fault(struct pt_regs *regs, long signr, int is_mm_fault); 105 + 104 106 extern void cmma_init(void); 105 107 106 108 extern void (*_machine_restart)(char *command);
+2 -19
arch/s390/kernel/traps.c
··· 22 22 #include <asm/fpu/api.h> 23 23 #include "entry.h" 24 24 25 - int show_unhandled_signals = 1; 26 - 27 25 static inline void __user *get_trap_ip(struct pt_regs *regs) 28 26 { 29 27 unsigned long address; ··· 31 33 else 32 34 address = regs->psw.addr; 33 35 return (void __user *) (address - (regs->int_code >> 16)); 34 - } 35 - 36 - static inline void report_user_fault(struct pt_regs *regs, int signr) 37 - { 38 - if ((task_pid_nr(current) > 1) && !show_unhandled_signals) 39 - return; 40 - if (!unhandled_signal(current, signr)) 41 - return; 42 - if (!printk_ratelimit()) 43 - return; 44 - printk("User process fault: interruption code %04x ilc:%d ", 45 - regs->int_code & 0xffff, regs->int_code >> 17); 46 - print_vma_addr("in ", regs->psw.addr); 47 - printk("\n"); 48 - show_regs(regs); 49 36 } 50 37 51 38 int is_valid_bugaddr(unsigned long addr) ··· 48 65 info.si_code = si_code; 49 66 info.si_addr = get_trap_ip(regs); 50 67 force_sig_info(si_signo, &info, current); 51 - report_user_fault(regs, si_signo); 68 + report_user_fault(regs, si_signo, 0); 52 69 } else { 53 70 const struct exception_table_entry *fixup; 54 71 fixup = search_exception_tables(regs->psw.addr); ··· 94 111 void default_trap_handler(struct pt_regs *regs) 95 112 { 96 113 if (user_mode(regs)) { 97 - report_user_fault(regs, SIGSEGV); 114 + report_user_fault(regs, SIGSEGV, 0); 98 115 do_exit(SIGSEGV); 99 116 } else 100 117 die(regs, "Unknown program exception");
+8 -7
arch/s390/mm/fault.c
··· 183 183 { 184 184 unsigned long asce; 185 185 186 + pr_alert("Failing address: %016lx TEID: %016lx\n", 187 + regs->int_parm_long & __FAIL_ADDR_MASK, regs->int_parm_long); 186 188 pr_alert("Fault in "); 187 189 switch (regs->int_parm_long & 3) { 188 190 case 3: ··· 220 218 dump_pagetable(asce, regs->int_parm_long & __FAIL_ADDR_MASK); 221 219 } 222 220 223 - static inline void report_user_fault(struct pt_regs *regs, long signr) 221 + int show_unhandled_signals = 1; 222 + 223 + void report_user_fault(struct pt_regs *regs, long signr, int is_mm_fault) 224 224 { 225 225 if ((task_pid_nr(current) > 1) && !show_unhandled_signals) 226 226 return; ··· 234 230 regs->int_code & 0xffff, regs->int_code >> 17); 235 231 print_vma_addr(KERN_CONT "in ", regs->psw.addr); 236 232 printk(KERN_CONT "\n"); 237 - printk(KERN_ALERT "failing address: %016lx TEID: %016lx\n", 238 - regs->int_parm_long & __FAIL_ADDR_MASK, regs->int_parm_long); 239 - dump_fault_info(regs); 233 + if (is_mm_fault) 234 + dump_fault_info(regs); 240 235 show_regs(regs); 241 236 } 242 237 ··· 247 244 { 248 245 struct siginfo si; 249 246 250 - report_user_fault(regs, SIGSEGV); 247 + report_user_fault(regs, SIGSEGV, 1); 251 248 si.si_signo = SIGSEGV; 252 249 si.si_code = si_code; 253 250 si.si_addr = (void __user *)(regs->int_parm_long & __FAIL_ADDR_MASK); ··· 275 272 else 276 273 printk(KERN_ALERT "Unable to handle kernel paging request" 277 274 " in virtual user address space\n"); 278 - printk(KERN_ALERT "failing address: %016lx TEID: %016lx\n", 279 - regs->int_parm_long & __FAIL_ADDR_MASK, regs->int_parm_long); 280 275 dump_fault_info(regs); 281 276 die(regs, "Oops"); 282 277 do_exit(SIGKILL);