s390 (6/7): system call speedup part 1.
Subsystems (4)
PATCH 1/1 s390 (6/7): system call speedup part 1.
System call speedup part 1.
diffstat:
arch/s390/kernel/asm-offsets.c | 11 + arch/s390/kernel/binfmt_elf32.c | 25 +- arch/s390/kernel/compat_signal.c | 6 arch/s390/kernel/entry.S | 346 ++++++++++++++++++++++++--------------- arch/s390/kernel/entry64.S | 322 +++++++++++++++++++++++------------- arch/s390/kernel/process.c | 20 +- arch/s390/kernel/ptrace.c | 107 +++++++----- arch/s390/kernel/s390_ksyms.c | 2 arch/s390/kernel/setup.c | 3 arch/s390/kernel/signal.c | 17 + arch/s390/kernel/traps.c | 21 +- arch/s390/lib/uaccess.S | 254 +++++++++++++++++----------- arch/s390/lib/uaccess64.S | 253 +++++++++++++++++----------- arch/s390/mm/fault.c | 8 arch/s390/mm/init.c | 4 15 files changed, 878 insertions(+), 521 deletions(-)
arch/s390/kernel/asm-offsets.c +9 -2
@@ -17,10 +17,10 @@int main (void ) { DEFINE(__THREAD_info, offsetof(struct task_struct, thread_info),); - DEFINE(__THREAD_ar2, offsetof(struct task_struct, thread.ar2),); - DEFINE(__THREAD_ar4, offsetof(struct task_struct, thread.ar4),); DEFINE(__THREAD_ksp, offsetof(struct task_struct, thread.ksp),); DEFINE(__THREAD_per, offsetof(struct task_struct, thread.per_info),); +DEFINE (__THREAD_mm_segment, + offsetof(struct task_struct, thread.mm_segment),);BLANK (); DEFINE(__PER_atmid, offsetof(per_struct, lowcore.words.perc_atmid),); DEFINE(__PER_address, offsetof(per_struct, lowcore.words.address),);
@@ -31,5 +31,12 @@ DEFINE(__TI_flags, offsetof(struct thread_info, flags),); DEFINE(__TI_cpu, offsetof(struct thread_info, cpu),); DEFINE(__TI_precount, offsetof(struct thread_info, preempt_count),); +BLANK (); + DEFINE(__PT_PSW, offsetof(struct pt_regs, psw),); + DEFINE(__PT_GPRS, offsetof(struct pt_regs, gprs),); + DEFINE(__PT_ORIG_GPR2, offsetof(struct pt_regs, orig_gpr2),); + DEFINE(__PT_ILC, offsetof(struct pt_regs, ilc),); + DEFINE(__PT_TRAP, offsetof(struct pt_regs, trap),); + DEFINE(__PT_SIZE, sizeof(struct pt_regs),);return 0 ; }
arch/s390/kernel/binfmt_elf32.c +13 -12
@@ -57,18 +57,7 @@/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is now struct_user_regs, they are different) */ -#define ELF_CORE_COPY_REGS (pr_reg, regs) \ - { \ - int i; \ - memcpy(&pr_reg.psw.mask, ®s->psw.mask, 4); \ - memcpy(&pr_reg.psw.addr, ((char*)®s->psw.addr)+4, 4); \ - for(i=0; i<NUM_GPRS; i++) \ - pr_reg.gprs[i] = regs->gprs[i]; \ - for(i=0; i<NUM_ACRS; i++) \ - pr_reg.acrs[i] = regs->acrs[i]; \ - pr_reg.orig_gpr2 = regs->orig_gpr2; \ - } - +#define ELF_CORE_COPY_REGS (pr_reg, regs) dump_regs32(regs, &pr_reg);/* This yields a mask that user programs can use to figure out what
@@ -107,6 +96,18 @@ } s390_regs32;typedef s390_regs32 elf_gregset_t ; +static inline int dump_regs32 (struct pt_regs *ptregs,elf_gregset_t *regs) +{ +int i; + +memcpy (®s->psw.mask, &ptregs->psw.mask,4 ); +memcpy (®s->psw.addr, &ptregs->psw.addr,4 ); +for (i =0 ; i <NUM_GPRS ; i++) + regs->gprs[i] = ptregs->gprs[i]; + regs->orig_gpr2 = ptregs->orig_gpr2; +return 1 ; +} +#include <asm/processor.h> #include <linux/module.h> #include <linux/config.h>
arch/s390/kernel/compat_signal.c +4 -2
@@ -297,7 +297,8 @@ regs32.psw.addr =PSW32_ADDR_AMODE31 | (__u32 ) regs->psw.addr;for (i =0 ; i <NUM_GPRS ; i++) regs32.gprs[i] = (__u32 ) regs->gprs[i]; -memcpy (regs32.acrs, regs->acrs,sizeof (regs32.acrs)); +save_access_regs (current->thread.acrs); +memcpy (regs32.acrs, current->thread.acrs,sizeof (regs32.acrs)); err =__copy_to_user (&sregs->regs, ®s32,sizeof (regs32));if (err)return err;
@@ -323,7 +324,8 @@ regs->psw.addr = (__u64)(regs32.psw.addr &PSW32_ADDR_INSN );for (i =0 ; i <NUM_GPRS ; i++) regs->gprs[i] = (__u64 ) regs32.gprs[i]; -memcpy (regs->acrs, regs32.acrs,sizeof (regs32.acrs)); +memcpy (current->thread.acrs, regs32.acrs,sizeof (current->thread.acrs)); +restore_access_regs (current->thread.acrs); err =__copy_from_user (¤t->thread.fp_regs, &sregs->fpregs,sizeof (_s390_fp_regs32));
arch/s390/kernel/entry.S +217 -129
589 lines not on this page · raw message
arch/s390/kernel/entry64.S +205 -117
536 lines not on this page · raw message
arch/s390/kernel/process.c +11 -9
@@ -179,7 +179,7 @@memset (®s,0 ,sizeof (regs)); regs.psw.mask =PSW_KERNEL_BITS ; regs.psw.addr = (unsigned long ) kernel_thread_starter |PSW_ADDR_AMODE ; - regs.gprs[7 ] =STACK_FRAME_OVERHEAD ; + regs.gprs[7 ] =STACK_FRAME_OVERHEAD +sizeof (struct pt_regs ); regs.gprs[8 ] = __LC_KERNEL_STACK; regs.gprs[9 ] = (unsigned long ) fn; regs.gprs[10 ] = (unsigned long ) arg;
@@ -230,6 +230,7 @@ (THREAD_SIZE + (unsigned long) p->thread_info)) - 1; p->thread.ksp = (unsigned long ) frame; p->set_child_tid = p->clear_child_tid =NULL ; +/* Store access registers to kernel stack of new process. */ frame->childregs = *regs; frame->childregs.gprs[2 ] =0 ;/* child returns 0 on fork. */ frame->childregs.gprs[15 ] = new_stackp;
@@ -240,6 +241,10 @@/* fake return stack for resume(), don't go back to schedule */ frame->gprs[9 ] = (unsigned long ) frame; + +/* Save access registers to new thread structure. */ +save_access_regs (&p->thread.acrs[0 ]); +#ifndef CONFIG_ARCH_S390X /* * save fprs to current->thread.fp_regs to merge them with
@@ -251,7 +256,7 @@ p->thread.user_seg =__pa ((unsigned long ) p->mm->pgd) | _SEGMENT_TABLE;/* Set a new TLS ? */ if (clone_flags &CLONE_SETTLS ) - frame->childregs.acrs[0 ] = regs->gprs[6 ]; + p->thread.acrs[0 ] = regs->gprs[6 ];#else /* CONFIG_ARCH_S390X */ /* Save the fpu registers to new thread structure. */ save_fp_regs (&p->thread.fp_regs);
@@ -259,18 +264,15 @@/* Set a new TLS ? */ if (clone_flags &CLONE_SETTLS ) {if (test_thread_flag (TIF_31BIT )) { - frame->childregs.acrs[0 ] = - (unsigned int ) regs->gprs[6 ]; + p->thread.acrs[0 ] = (unsigned int ) regs->gprs[6 ]; }else { - frame->childregs.acrs[0 ] = - (unsigned int )(regs->gprs[6 ] >>32 ); - frame->childregs.acrs[1 ] = - (unsigned int ) regs->gprs[6 ]; + p->thread.acrs[0 ] = (unsigned int )(regs->gprs[6 ] >>32 ); + p->thread.acrs[1 ] = (unsigned int ) regs->gprs[6 ]; } }#endif /* CONFIG_ARCH_S390X */ /* start new process with ar4 pointing to the correct address space */ - p->thread.ar4 =get_fs ().ar4; + p->thread.mm_segment =get_fs ();/* Don't copy debug registers */ memset (&p->thread.per_info,0 ,sizeof (p->thread.per_info));
arch/s390/kernel/ptrace.c +69 -38
190 lines not on this page · raw message
arch/s390/kernel/s390_ksyms.c +2 -0
@@ -33,6 +33,8 @@EXPORT_SYMBOL_NOVERS (__copy_from_user_asm);EXPORT_SYMBOL_NOVERS (__copy_to_user_asm);EXPORT_SYMBOL_NOVERS (__clear_user_asm); +EXPORT_SYMBOL_NOVERS (__strncpy_from_user_asm); +EXPORT_SYMBOL_NOVERS (__strnlen_user_asm);EXPORT_SYMBOL (diag10);/*
arch/s390/kernel/setup.c +2 -1
@@ -496,7 +496,7 @@ lc->external_new_psw.mask =PSW_KERNEL_BITS ; lc->external_new_psw.addr =PSW_ADDR_AMODE | (unsigned long ) ext_int_handler; - lc->svc_new_psw.mask =PSW_KERNEL_BITS ; + lc->svc_new_psw.mask =PSW_KERNEL_BITS |PSW_MASK_IO |PSW_MASK_EXT ; lc->svc_new_psw.addr =PSW_ADDR_AMODE | (unsigned long ) system_call; lc->program_new_psw.mask =PSW_KERNEL_BITS ; lc->program_new_psw.addr =
@@ -512,6 +512,7 @@ lc->async_stack = (unsigned long )__alloc_bootmem (ASYNC_SIZE ,ASYNC_SIZE ,0 ) +ASYNC_SIZE ; lc->current_task = (unsigned long ) init_thread_union.thread_info.task; + lc->thread_info = (unsigned long ) &init_thread_union;#ifdef CONFIG_ARCH_S390X if (MACHINE_HAS_DIAG44 ) lc->diag44_opcode =0x83000044 ;
arch/s390/kernel/signal.c +15 -2
@@ -151,13 +151,20 @@unsigned long old_mask = regs->psw.mask;int err; +save_access_regs (current->thread.acrs); +/* Copy a 'clean' PSW mask to the user to avoid leaking information about whether PER is currently on. */ regs->psw.mask =PSW_MASK_MERGE (PSW_USER_BITS , regs->psw.mask); - err =__copy_to_user (&sregs->regs, regs,sizeof (_s390_regs_common)); + err =__copy_to_user (&sregs->regs.psw, ®s->psw, +sizeof (sregs->regs.psw)+sizeof (sregs->regs.gprs)); regs->psw.mask = old_mask;if (err !=0 )return err; + err =__copy_to_user (&sregs->regs.acrs, current->thread.acrs, +sizeof (sregs->regs.acrs)); +if (err !=0 ) +return err;/* * We have to store the fp registers to current->thread.fp_regs * to merge them with the emulated registers.
@@ -176,11 +183,17 @@/* Alwys make any pending restarted system call return -EINTR */ current_thread_info ()->restart_block.fn = do_no_restart_syscall; - err =__copy_from_user (regs, &sregs->regs,sizeof (_s390_regs_common)); + err =__copy_from_user (®s->psw, &sregs->regs.psw, +sizeof (sregs->regs.psw)+sizeof (sregs->regs.gprs)); regs->psw.mask =PSW_MASK_MERGE (old_mask, regs->psw.mask); regs->psw.addr |=PSW_ADDR_AMODE ;if (err)return err; + err =__copy_from_user (¤t->thread.acrs, &sregs->regs.acrs, +sizeof (sregs->regs.acrs)); +if (err) +return err; +restore_access_regs (current->thread.acrs); err =__copy_from_user (¤t->thread.fp_regs, &sregs->fpregs,sizeof (s390_fp_regs));
arch/s390/kernel/traps.c +13 -8
@@ -173,6 +173,10 @@printk (" " FOURLONG , regs->gprs[12 ], regs->gprs[13 ], regs->gprs[14 ], regs->gprs[15 ]); +#if 0 +/* FIXME: this isn't needed any more but it changes the ksymoops +* input. To remove or not to remove ... */ +save_access_regs (regs->acrs);printk ("%s ACRS: %08x %08x %08x %08x\n" , mode, regs->acrs[0 ], regs->acrs[1 ], regs->acrs[2 ], regs->acrs[3 ]); printk(" %08x %08x %08x %08x\n",
@@ -181,6 +185,7 @@ regs->acrs[8], regs->acrs[9], regs->acrs[10], regs->acrs[11]);printk (" %08x %08x %08x %08x\n" , regs->acrs[12 ], regs->acrs[13 ], regs->acrs[14 ], regs->acrs[15 ]); +#endif /* * Print the first 20 byte of the instruction stream at the
@@ -229,17 +234,17 @@ regs->gprs[12 ], regs->gprs[13 ], regs->gprs[14], regs->gprs[15]); buffer +=sprintf (buffer,"User ACRS: %08x %08x %08x %08x\n" , - regs->acrs[0 ], regs->acrs[1 ], - regs->acrs[2 ], regs->acrs[3 ]); + task->thread.acrs[0 ], task->thread.acrs[1 ], + task->thread.acrs[2 ], task->thread.acrs[3 ]); buffer +=sprintf (buffer," %08x %08x %08x %08x\n" , - regs->acrs[4 ], regs->acrs[5 ], - regs->acrs[6 ], regs->acrs[7 ]); + task->thread.acrs[4 ], task->thread.acrs[5 ], + task->thread.acrs[6 ], task->thread.acrs[7 ]); buffer +=sprintf (buffer," %08x %08x %08x %08x\n" , - regs->acrs[8 ], regs->acrs[9 ], - regs->acrs[10 ], regs->acrs[11 ]); + task->thread.acrs[8 ], task->thread.acrs[9 ], + task->thread.acrs[10 ], task->thread.acrs[11 ]); buffer +=sprintf (buffer," %08x %08x %08x %08x\n" , - regs->acrs[12 ], regs->acrs[13 ], - regs->acrs[14 ], regs->acrs[15 ]); + task->thread.acrs[12 ], task->thread.acrs[13 ], + task->thread.acrs[14 ], task->thread.acrs[15 ]);return buffer; }
arch/s390/lib/uaccess.S +155 -99
290 lines not on this page · raw message
arch/s390/lib/uaccess64.S +154 -99
288 lines not on this page · raw message
arch/s390/mm/fault.c +5 -3
@@ -87,12 +87,12 @@if (areg ==0 )/* Access via access register 0 -> kernel address */ return 0 ; -if (regs && areg <NUM_ACRS && regs->acrs[areg] <=1 ) +if (regs && areg <NUM_ACRS && current->thread.acrs[areg] <=1 )/* * access register contains 0 -> kernel address, * access register contains 1 -> user space address */ -return regs->acrs[areg]; +return current->thread.acrs[areg];/* Something unhealthy was done with the access registers... */ die ("page fault via unknown access register" , regs, error_code);
@@ -115,8 +115,10 @@* 3: Home Segment Table Descriptor */ int descriptor = S390_lowcore.trans_exc_code &3 ; -if (descriptor ==1 ) +if (descriptor ==1 ) { +save_access_regs (current->thread.acrs);return __check_access_register (regs, error_code); + }return descriptor >>1 ; }
arch/s390/mm/init.c +4 -0
@@ -138,6 +138,8 @@ } } + S390_lowcore.kernel_asce = pgdir_k; +/* enable virtual mapping in kernel mode */ __asm__ __volatile__(" LCTL 1,1,%0\n" " LCTL 7,7,%0\n"
@@ -223,6 +225,8 @@ } } + S390_lowcore.kernel_asce = pgdir_k; +/* enable virtual mapping in kernel mode */ __asm__ __volatile__("lctlg 1,1,%0\n\t" "lctlg 7,7,%0\n\t"