1. 23 Nov, 2012 1 commit
    • Martin Schwidefsky's avatar
      s390/ptrace: race of single stepping vs signal delivery · 39efd4ec
      Martin Schwidefsky authored
      The current single step code is racy in regard to concurrent delivery
      of signals. If a signal is delivered after a PER program check occurred
      but before the TIF_PER_TRAP bit has been checked in entry[64].S the code
      clears TIF_PER_TRAP and then calls do_signal. This is wrong, if the
      instruction completed (or has been suppressed) a SIGTRAP should be
      delivered to the debugger in any case. Only if the instruction has been
      nullified the SIGTRAP may not be send.
      The new logic always sets TIF_PER_TRAP if the program check indicates PER
      tracing but removes it again for all program checks that are nullifying.
      The effect is that for each change in the PSW address we now get a
      single SIGTRAP.
      Reported-by: default avatarAndreas Arnez <arnez@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
  2. 01 Oct, 2012 3 commits
  3. 20 Jul, 2012 2 commits
    • Martin Schwidefsky's avatar
      s390/vtimer: rework virtual timer interface · 27f6b416
      Martin Schwidefsky authored
      The current virtual timer interface is inherently per-cpu and hard to
      use. The sole user of the interface is appldata which uses it to execute
      a function after a specific amount of cputime has been used over all cpus.
      Rework the virtual timer interface to hook into the cputime accounting.
      This makes the interface independent from the CPU timer interrupts, and
      makes the virtual timers global as opposed to per-cpu.
      Overall the code is greatly simplified. The downside is that the accuracy
      is not as good as the original implementation, but it is still good enough
      for appldata.
      Reviewed-by: default avatarJan Glauber <jang@linux.vnet.ibm.com>
      Reviewed-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    • Heiko Carstens's avatar
      s390/comments: unify copyright messages and remove file names · a53c8fab
      Heiko Carstens authored
      Remove the file name from the comment at top of many files. In most
      cases the file name was wrong anyway, so it's rather pointless.
      Also unify the IBM copyright statement. We did have a lot of sightly
      different statements and wanted to change them one after another
      whenever a file gets touched. However that never happened. Instead
      people start to take the old/"wrong" statements to use as a template
      for new files.
      So unify all of them in one go.
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
  4. 14 Jun, 2012 1 commit
    • Heiko Carstens's avatar
      s390/smp: make absolute lowcore / cpu restart parameter accesses more robust · fbe76568
      Heiko Carstens authored
      Setting the cpu restart parameters is done in three different fashions:
      - directly setting the four parameters individually
      - copying the four parameters with memcpy (using 4 * sizeof(long))
      - copying the four parameters using a private structure
      In addition code in entry*.S relies on a certain order of the restart
      members of struct _lowcore.
      Make all of this more robust to future changes by adding a
      mem_absolute_assign(dest, val) define, which assigns val to dest
      using absolute addressing mode. Also the load multiple instructions
      in entry*.S have been split into separate load instruction so the
      order of the struct _lowcore members doesn't matter anymore.
      In addition move the prototypes of memcpy_real/absolute from uaccess.h
      to processor.h. These memcpy* variants are not related to uaccess at all.
      string.h doesn't seem to match as well, so lets use processor.h.
      Also replace the eight byte array in struct _lowcore which represents a
      misaliged u64 with a u64. The compiler will always create code that
      handles the misaligned u64 correctly.
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
  5. 05 Jun, 2012 1 commit
  6. 16 May, 2012 1 commit
    • Martin Schwidefsky's avatar
      s390: fix race on TIF_MCCK_PENDING · eda0c6d6
      Martin Schwidefsky authored
      There is a small race window in the __switch_to code in regard to
      the transfer of the TIF_MCCK_PENDING bit from the previous to the
      next task. The bit is transferred before the task struct pointer
      and the thread-info pointer for the next task has been stored to
      lowcore. If a machine check sets the TIF_MCCK_PENDING bit between
      the transfer code and the store of current/thread_info the bit
      is still set for the previous task. And if the previous task has
      terminated it can get lost. The effect is that a pending CRW is
      not retrieved until the next machine checks sets TIF_MCCK_PENDING.
      To fix this reorder __switch_to to first store the task struct
      and thread-info pointer and then do the transfer of the bit.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
  7. 11 Mar, 2012 3 commits
    • Martin Schwidefsky's avatar
      [S390] rework idle code · 4c1051e3
      Martin Schwidefsky authored
      Whenever the cpu loads an enabled wait PSW it will appear as idle to the
      underlying host system. The code in default_idle calls vtime_stop_cpu
      which does the necessary voodoo to get the cpu time accounting right.
      The udelay code just loads an enabled wait PSW. To correct this rework
      the vtime_stop_cpu/vtime_start_cpu logic and move the difficult parts
      to entry[64].S, vtime_stop_cpu can now be called from anywhere and
      vtime_start_cpu is gone. The correction of the cpu time during wakeup
      from an enabled wait PSW is done with a critical section in entry[64].S.
      As vtime_start_cpu is gone, s390_idle_check can be removed as well.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    • Martin Schwidefsky's avatar
      [S390] rework smp code · 8b646bd7
      Martin Schwidefsky authored
      Define struct pcpu and merge some of the NR_CPUS arrays into it, including
      __cpu_logical_map, current_set and smp_cpu_state. Split smp related
      functions to those operating on physical cpus and the functions operating
      on a logical cpu number. Make the functions for physical cpus use a
      pointer to a struct pcpu. This hides the knowledge about cpu addresses in
      smp.c, entry[64].S and swsusp_asm64.S, thus remove the sigp.h header.
      The PSW restart mechanism is used to start secondary cpus, calling a
      function on an online cpu, calling a function on the ipl cpu, and for
      the nmi signal. Replace the different assembler functions with a
      single function restart_int_handler. The new entry point calls a function
      whose pointer is stored in the lowcore of the target cpu and it can wait
      for the source cpu to stop. This covers all existing use cases.
      Overall the code is now simpler and there are ~380 lines less code.
      Reviewed-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    • Martin Schwidefsky's avatar
      [S390] rename lowcore field · 7e180bd8
      Martin Schwidefsky authored
      The 16 bit value at the lowcore location with offset 0x84 is the
      cpu address that is associated with an external interrupt. Rename
      the field from cpu_addr to ext_cpu_addr to make that clear.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
  8. 27 Dec, 2011 2 commits
    • Martin Schwidefsky's avatar
      [S390] cleanup trap handling · aa33c8cb
      Martin Schwidefsky authored
      Move the program interruption code and the translation exception identifier
      to the pt_regs structure as 'int_code' and 'int_parm_long' and make the
      first level interrupt handler in entry[64].S store the two values. That
      makes it possible to drop 'prot_addr' and 'trap_no' from the thread_struct
      and to reduce the number of arguments to a lot of functions. Finally
      un-inline do_trap. Overall this saves 5812 bytes in the .text section of
      the 64 bit kernel.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    • Martin Schwidefsky's avatar
      [S390] entry[64].S improvements · c5328901
      Martin Schwidefsky authored
      Another round of cleanup for entry[64].S, in particular the program check
      handler looks more reasonable now. The code size for the 31 bit kernel
      has been reduced by 616 byte and by 528 byte for the 64 bit version.
      Even better the code is a bit faster as well.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
  9. 30 Oct, 2011 3 commits
    • Martin Schwidefsky's avatar
      [S390] add TIF_SYSCALL thread flag · b6ef5bb3
      Martin Schwidefsky authored
      Add an explicit TIF_SYSCALL bit that indicates if a task is inside
      a system call. The svc_code in the pt_regs structure is now only
      valid if TIF_SYSCALL is set. With this definition TIF_RESTART_SVC
      can be replaced with TIF_SYSCALL. Overall do_signal is a bit more
      readable and it saves a few lines of code.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    • Martin Schwidefsky's avatar
      [S390] signal race with restarting system calls · 20b40a79
      Martin Schwidefsky authored
      do_signal will prepare the restart of the system call with a rewind of
      the PSW before calling get_signal_to_deliver (where the debugger might
      take control). For A ERESTART_RESTARTBLOCK restarting system call
      do_signal will set -EINTR as return code.
      There are two issues with this approach:
         ERESTART_RESTARTBLOCK as the rewinding already took place or the
         return code has been changed to -EINTR
      2) if get_signal_to_deliver does not return with a signal to deliver
         the restart via the repeat of the svc instruction is left in place.
         This opens a race if another signal is made pending before the
         system call instruction can be reexecuted. The original system call
         will be restarted even if the second signal would have ended the
         system call with -EINTR.
      These two issues can be solved by dropping the early rewind of the
      system call before get_signal_to_deliver has been called and by using
      the TIF_RESTART_SVC magic to do the restart if no signal has to be
      delivered. The only situation where the system call restart via the
      repeat of the svc instruction is appropriate is when a SA_RESTART
      signal is delivered to user space.
      Unfortunately this breaks inferior calls by the debugger again. The
      system call number and the length of the system call instruction is
      lost over the inferior call and user space will see ERESTARTNOHAND/
      new ptrace interface is added to save/restore the system call number
      and system call instruction length.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    • Martin Schwidefsky's avatar
      [S390] lowcore cleanup · 0edc8faa
      Martin Schwidefsky authored
      Remove the save_area_64 field from the 0xe00 - 0xf00 area in the lowcore.
      Use a free slot in the save_area array instead.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
  10. 03 Aug, 2011 1 commit
  11. 24 Jul, 2011 1 commit
  12. 23 May, 2011 1 commit
    • Heiko Carstens's avatar
      [S390] pfault: cpu hotplug vs missing completion interrupts · f2db2e6c
      Heiko Carstens authored
      On cpu hot remove a PFAULT CANCEL command is sent to the hypervisor
      which in turn will cancel all outstanding pfault requests that have
      been issued on that cpu (the same happens with a SIGP cpu reset).
      The result is that we end up with uninterruptible processes where
      the interrupt that would wake up these processes never arrives.
      In order to solve this all processes which wait for a pfault
      completion interrupt get woken up after a cpu hot remove. The worst
      case that could happen is that they fault again and in turn need to
      wait again.
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
  13. 10 May, 2011 1 commit
    • Michael Holzheu's avatar
      [S390] kernel: Initialize register 14 when starting new CPU · 8eb4bd66
      Michael Holzheu authored
      When starting a new CPU we currently jump to start_secondary() without
      setting register 14 (the return address) correctly. Therefore on the stack
      frame for start_secondary an invalid return address is stored. This leads
      to wrong stack back traces in kernel dumps.
       #00 [1f33fe48] cpu_idle at 10614a
       #01 [1f33fe90] start_secondary at 54fa88
       #02 [1f33feb8] (null) at 0                 <--- invalid
      To fix this start_secondary() is called now with basr/brasl that sets
      register 14 correctly. The output of the stack backtrace looks then
      like the following:
       #00 [1f33fe48] cpu_idle at 10614a
       #01 [1f33fe90] start_secondary at 54fa88
       #02 [1f33feb8] restart_base at 54f41e      <--- correct
      Signed-off-by: default avatarMichael Holzheu <holzheu@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
  14. 05 Jan, 2011 3 commits
  15. 29 Oct, 2010 1 commit
  16. 25 Oct, 2010 3 commits
  17. 27 Jul, 2010 1 commit
  18. 17 May, 2010 4 commits
    • Martin Schwidefsky's avatar
      [S390] add breaking event address for user space · 86f2552b
      Martin Schwidefsky authored
      Copy the last breaking event address from the lowcore to a new
      field in the thread_struct on each system entry. Add a new
      ptrace request PTRACE_GET_LAST_BREAK and a new utrace regset
      REGSET_LAST_BREAK to query the last breaking event.
      This is useful for debugging wild branches in user space code.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    • Martin Schwidefsky's avatar
      [S390] idle time accounting vs. machine checks · 6377981f
      Martin Schwidefsky authored
      A machine check can interrupt the i/o and external interrupt handler
      anytime. If the machine check occurs while the interrupt handler is
      waking up from idle vtime_start_cpu can get executed a second time
      and the int_clock / async_enter_timer values in the lowcore get
      clobbered. This can confuse the cpu time accounting.
      To fix this problem two changes are needed. First the machine check
      handler has to use its own copies of int_clock and async_enter_timer,
      named mcck_clock and mcck_enter_timer. Second the nested execution
      of vtime_start_cpu has to be prevented. This is done in s390_idle_check
      by checking the wait bit in the program status word.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    • Martin Schwidefsky's avatar
      [S390] improve irq tracing code in entry[64].S · 6a2df3a8
      Martin Schwidefsky authored
      The system call path in entry[64].S is run with interrupts enabled.
      Remove the irq tracing check from the system call exit code. If a
      program check interrupted a context enabled for interrupts do a
      call to trace_irq_off_caller in the program check handler before
      branching to the system call exit code.
      Restructure the system call and io interrupt return code to avoid
      avoid the lpsw[e] to disable machine checks.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    • Martin Schwidefsky's avatar
      [S390] cleanup sysc_work and io_work code · 43d399d2
      Martin Schwidefsky authored
      Cleanup the #ifdef mess at io_work in entry[64].S and streamline the
      TIF work code of the system call and io exit path.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
  19. 09 Apr, 2010 1 commit
    • Martin Schwidefsky's avatar
      [S390] fix io_return critical section cleanup · 176b1803
      Martin Schwidefsky authored
      If a machine check interrupts the io interrupt handler on one of the
      instructions between io_return and io_leave the critical section
      cleanup code will move the return psw to io_work_loop. By doing that
      the switch from the asynchronous interrupt stack to the process stack
      is skipped. If e.g. TIF_NEED_RESCHED is set things break because
      the scheduler is called with the asynchronous interrupts stack.
      Moving the psw back to io_return instead fixes the problem.
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
  20. 26 Feb, 2010 1 commit
  21. 27 Jan, 2010 1 commit
  22. 13 Nov, 2009 1 commit
    • Christian Borntraeger's avatar
      [S390] s390: fix single stepping on svc0 · bcc6525f
      Christian Borntraeger authored
      On s390 there are two ways of specifying the system call number for
      the svc instruction. The standard way is to use the immediate field
      in the instruction (or to use EXecute for values unknown during
      assemble time). This can encode 256 system calls.
      The kernel ABI also allows to put the system call number in r1 and
      then execute svc 0 to enable system call numbers > 255.
      It turns out that single stepping svc 0 is broken, since the PER
      program check handler uses r1. We have to use a different register.
      Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
  23. 11 Sep, 2009 1 commit
  24. 25 Aug, 2009 1 commit
    • Josh Stone's avatar
      tracing: Rename FTRACE_SYSCALLS for tracepoints · 66700001
      Josh Stone authored
      The syscall enter/exit tracing is no longer specific to just ftrace, so
      they now have names that reflect their tie to tracepoints instead.
      Signed-off-by: default avatarJosh Stone <jistone@redhat.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      LKML-Reference: <1251150194-1713-2-git-send-email-jistone@redhat.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
  25. 12 Jun, 2009 1 commit