1. Sep 25, 2014
  2. Sep 09, 2014
    • Heiko Carstens's avatar
      s390/spinlock: optimize spin_unlock code · 44230282
      Heiko Carstens authored
      
      
      Use a memory barrier + store sequence instead of a load + compare and swap
      sequence to unlock a spinlock and an rw lock.
      For the spinlock case this saves us two memory reads and a not needed cpu
      serialization after the compare and swap instruction stored the new value.
      
      The kernel size (performance_defconfig) gets reduced by ~14k.
      
      Average execution time of a tight inlined spin_unlock loop drops from
      5.8ns to 0.7ns on a zEC12 machine.
      
      An artificial stress test case where several counters are protected with
      a single spinlock and which are only incremented while holding the spinlock
      shows ~30% improvement on a 4 cpu machine.
      
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      44230282
    • Heiko Carstens's avatar
      s390/ftrace: optimize mcount code · 3d1e220d
      Heiko Carstens authored
      
      
      Reduce the number of executed instructions within the mcount block if
      function tracing is enabled. We achieve that by using a non-standard
      C function call ABI. Since the called function is also written in
      assembler this is not a problem.
      This also allows to replace the unconditional store at the beginning
      of the mcount block with a larl instruction, which doesn't touch
      memory.
      
      In theory we could also patch the first instruction of the mcount block
      to enable and disable function tracing. However this would break kprobes.
      This could be fixed with implementing the "kprobes_on_ftrace" feature;
      however keeping the odd jprobes working seems not to be possible without
      a lot of code churn. Therefore keep the code easy and simply accept one
      wasted 1-cycle "larl" instruction per function prologue.
      
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      3d1e220d
    • Heiko Carstens's avatar
      s390/kprobes: remove unused jprobe_return_end() · ea2f4769
      Heiko Carstens authored
      
      
      Even if it has a __used annotation it is actually unused.
      
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      ea2f4769
    • Heiko Carstens's avatar
      s390/ftrace: enforce DYNAMIC_FTRACE if FUNCTION_TRACER is selected · 5d6a0163
      Heiko Carstens authored
      
      
      We have too many combinations for function tracing. Lets simply stick to
      the most advanced option, so we don't have to care of other combinations.
      
      This means we always select DYNAMIC_FTRACE if FUNCTION_TRACER is selected.
      
      In the s390 Makefile also remove CONFIG_FTRACE_SYSCALLS since that
      functionality got moved to architecture independent code in the meantime.
      
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      5d6a0163
    • Heiko Carstens's avatar
      s390/ftrace: add HAVE_DYNAMIC_FTRACE_WITH_REGS support · 10dec7db
      Heiko Carstens authored
      This code is based on a patch from Vojtech Pavlik.
      http://marc.info/?l=linux-s390&m=140438885114413&w=2
      
      
      
      The actual implementation now differs significantly:
      Instead of adding a second function "ftrace_regs_caller" which would be nearly
      identical to the existing ftrace_caller function, the current ftrace_caller
      function is now an alias to ftrace_regs_caller and always passes the needed
      pt_regs structure and function_trace_op parameters unconditionally.
      
      Besides that also use asm offsets to correctly allocate and access the new
      struct pt_regs on the stack.
      
      While at it we can make use of new instruction to get rid of some indirect
      loads if compiled for new machines.
      
      The passed struct pt_regs can be changed by the called function and it's new
      contents will replace the current contents.
      
      Note: to change the return address the embedded psw member of the pt_regs
      structure must be changed. The psw member is right now incomplete, since
      the mask part is missing. For all current use cases this should be sufficent.
      Providing and restoring a sane mask would mean we need to add an epsw/lpswe
      pair to the mcount code. Only these two instruction would cost us ~120 cycles
      which currently seems not necessary.
      
      Cc: Vojtech Pavlik <vojtech@suse.cz>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      10dec7db
    • Heiko Carstens's avatar
      s390/ftrace: optimize function graph caller code · 2481a87b
      Heiko Carstens authored
      
      
      When the function graph tracer is disabled we can skip three additional
      instructions. So let's just do this.
      
      So if function tracing is enabled but function graph tracing is
      runtime disabled, we get away with a single unconditional branch.
      
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      2481a87b
    • Heiko Carstens's avatar
      s390: pass march flag to assembly files as well · 0f1b1ff5
      Heiko Carstens authored
      
      
      Currently the march flag gets only passed to C files, but not to
      assembler files.
      This means that we can't add new instructions like e.g. aghik to asm
      files, since the assembler doesn't know of the new instructions if
      the appropriate march flag isn't specified.
      
      So also pass the march flag when compiling assembler files as well.
      
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      0f1b1ff5
    • Martin Schwidefsky's avatar
      s390/vdso: add vdso support for coarse clocks · b7eacb59
      Martin Schwidefsky authored
      
      
      Add CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE optimization to
      the 64-bit and 31-bit vdso.
      
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      b7eacb59
    • Martin Schwidefsky's avatar
      s390/vdso: replace stck with stcke · 070b7be6
      Martin Schwidefsky authored
      
      
      If gettimeofday / clock_gettime are called multiple times in a row
      the STCK instruction will stall until a difference in the result is
      visible. This unnecessarily slows down the vdso calls, use stcke
      instead of stck to get rid of the stall.
      
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      070b7be6
    • Heiko Carstens's avatar
      Documentation/kprobes: add s390 to list of supported architectures · 369e8c35
      Heiko Carstens authored
      
      
      s390 supports kprobes since 2006 but is missing in the list of
      architectures that support kprobes.
      
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      369e8c35
    • Heiko Carstens's avatar
    • Linus Torvalds's avatar
      Merge branch 'for_linus_urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 8c68face
      Linus Torvalds authored
      Pull ext4 bugfix from Ted Ts'o.
      
      [ Hmm.  It's possible we should make kfree() aware of error pointers,
        and use IS_ERR_OR_NULL rather than a NULL check.  But in the meantime
        this is obviously the right fix.  - Linus ]
      
      * 'for_linus_urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        ext4: avoid trying to kfree an ERR_PTR pointer
      8c68face
    • Linus Torvalds's avatar
      Merge branch 'for-3.17' of git://linux-nfs.org/~bfields/linux · 861b7102
      Linus Torvalds authored
      Pull nfsd bugfixes from Bruce Fields:
       "A couple minor nfsd bugfixes"
      
      * 'for-3.17' of git://linux-nfs.org/~bfields/linux:
        lockd: fix rpcbind crash on lockd startup failure
        nfsd4: fix rd_dircount enforcement
      861b7102
    • J. Bruce Fields's avatar
      lockd: fix rpcbind crash on lockd startup failure · 7c17705e
      J. Bruce Fields authored
      
      
      Nikita Yuschenko reported that booting a kernel with init=/bin/sh and
      then nfs mounting without portmap or rpcbind running using a busybox
      mount resulted in:
      
        # mount -t nfs 10.30.130.21:/opt /mnt
        svc: failed to register lockdv1 RPC service (errno 111).
        lockd_up: makesock failed, error=-111
        Unable to handle kernel paging request for data at address 0x00000030
        Faulting instruction address: 0xc055e65c
        Oops: Kernel access of bad area, sig: 11 [#1]
        MPC85xx CDS
        Modules linked in:
        CPU: 0 PID: 1338 Comm: mount Not tainted 3.10.44.cge #117
        task: cf29cea0 ti: cf35c000 task.ti: cf35c000
        NIP: c055e65c LR: c0566490 CTR: c055e648
        REGS: cf35dad0 TRAP: 0300   Not tainted  (3.10.44.cge)
        MSR: 00029000 <CE,EE,ME>  CR: 22442488  XER: 20000000
        DEAR: 00000030, ESR: 00000000
      
        GPR00: c05606f4 cf35db80 cf29cea0 cf0ded80 cf0dedb8 00000001 1dec3086
        00000000
        GPR08: 00000000 c07b1640 00000007 1dec3086 22442482 100b9758 00000000
        10090ae8
        GPR16: 00000000 000186a5 00000000 00000000 100c3018 bfa46edc 100b0000
        bfa46ef0
        GPR24: cf386ae0 c07834f0 00000000 c0565f88 00000001 cf0dedb8 00000000
        cf0ded80
        NIP [c055e65c] call_start+0x14/0x34
        LR [c0566490] __rpc_execute+0x70/0x250
        Call Trace:
        [cf35db80] [00000080] 0x80 (unreliable)
        [cf35dbb0] [c05606f4] rpc_run_task+0x9c/0xc4
        [cf35dbc0] [c0560840] rpc_call_sync+0x50/0xb8
        [cf35dbf0] [c056ee90] rpcb_register_call+0x54/0x84
        [cf35dc10] [c056f24c] rpcb_register+0xf8/0x10c
        [cf35dc70] [c0569e18] svc_unregister.isra.23+0x100/0x108
        [cf35dc90] [c0569e38] svc_rpcb_cleanup+0x18/0x30
        [cf35dca0] [c0198c5c] lockd_up+0x1dc/0x2e0
        [cf35dcd0] [c0195348] nlmclnt_init+0x2c/0xc8
        [cf35dcf0] [c015bb5c] nfs_start_lockd+0x98/0xec
        [cf35dd20] [c015ce6c] nfs_create_server+0x1e8/0x3f4
        [cf35dd90] [c0171590] nfs3_create_server+0x10/0x44
        [cf35dda0] [c016528c] nfs_try_mount+0x158/0x1e4
        [cf35de20] [c01670d0] nfs_fs_mount+0x434/0x8c8
        [cf35de70] [c00cd3bc] mount_fs+0x20/0xbc
        [cf35de90] [c00e4f88] vfs_kern_mount+0x50/0x104
        [cf35dec0] [c00e6e0c] do_mount+0x1d0/0x8e0
        [cf35df10] [c00e75ac] SyS_mount+0x90/0xd0
        [cf35df40] [c000ccf4] ret_from_syscall+0x0/0x3c
      
      The addition of svc_shutdown_net() resulted in two calls to
      svc_rpcb_cleanup(); the second is no longer necessary and crashes when
      it calls rpcb_register_call with clnt=NULL.
      
      Reported-by: default avatarNikita Yushchenko <nyushchenko@dev.rtsoft.ru>
      Fixes: 679b033d
      
       "lockd: ensure we tear down any live sockets when socket creation fails during lockd_up"
      Cc: stable@vger.kernel.org
      Acked-by: default avatarJeff Layton <jlayton@primarydata.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      7c17705e
    • J. Bruce Fields's avatar
      nfsd4: fix rd_dircount enforcement · aee37764
      J. Bruce Fields authored
      Commit 3b299709 "nfsd4: enforce rd_dircount" totally misunderstood
      rd_dircount; it refers to total non-attribute bytes returned, not number
      of directory entries returned.
      
      Bring the code into agreement with RFC 3530 section 14.2.24.
      
      Cc: stable@vger.kernel.org
      Fixes: 3b299709
      
       "nfsd4: enforce rd_dircount"
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      aee37764
  3. Sep 08, 2014