1. 22 8月, 2013 1 次提交
    • M
      s390: convert interrupt handling to use generic hardirq · 1f44a225
      Martin Schwidefsky 提交于
      With the introduction of PCI it became apparent that s390 should
      convert to generic hardirqs as too many drivers do not have the
      correct dependency for GENERIC_HARDIRQS. On the architecture
      level s390 does not have irq lines. It has external interrupts,
      I/O interrupts and adapter interrupts. This patch hard-codes all
      external interrupts as irq #1, all I/O interrupts as irq #2 and
      all adapter interrupts as irq #3. The additional information from
      the lowcore associated with the interrupt is stored in the
      pt_regs of the interrupt frame, where the interrupt handler can
      pick it up. For PCI/MSI interrupts the adapter interrupt handler
      scans the relevant bit fields and calls generic_handle_irq with
      the virtual irq number for the MSI interrupt.
      Reviewed-by: NSebastian Ott <sebott@linux.vnet.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      1f44a225
  2. 27 6月, 2013 1 次提交
  3. 26 4月, 2013 2 次提交
  4. 05 3月, 2013 1 次提交
    • M
      s390: critical section cleanup vs. machine checks · 6551fbdf
      Martin Schwidefsky 提交于
      The current machine check code uses the registers stored by the machine
      in the lowcore at __LC_GPREGS_SAVE_AREA as the registers of the interrupted
      context. The registers 0-7 of a user process can get clobbered if a machine
      checks interrupts the execution of a critical section in entry[64].S.
      
      The reason is that the critical section cleanup code may need to modify
      the PSW and the registers for the previous context to get to the end of a
      critical section. If registers 0-7 have to be replaced the relevant copy
      will be in the registers, which invalidates the copy in the lowcore. The
      machine check handler needs to explicitly store registers 0-7 to the stack.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      6551fbdf
  5. 23 11月, 2012 1 次提交
    • M
      s390/ptrace: race of single stepping vs signal delivery · 39efd4ec
      Martin Schwidefsky 提交于
      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: NAndreas Arnez <arnez@linux.vnet.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      39efd4ec
  6. 29 10月, 2012 1 次提交
  7. 01 10月, 2012 3 次提交
  8. 20 7月, 2012 2 次提交
    • M
      s390/vtimer: rework virtual timer interface · 27f6b416
      Martin Schwidefsky 提交于
      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: NJan Glauber <jang@linux.vnet.ibm.com>
      Reviewed-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      27f6b416
    • H
      s390/comments: unify copyright messages and remove file names · a53c8fab
      Heiko Carstens 提交于
      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: NHeiko Carstens <heiko.carstens@de.ibm.com>
      a53c8fab
  9. 14 6月, 2012 1 次提交
    • H
      s390/smp: make absolute lowcore / cpu restart parameter accesses more robust · fbe76568
      Heiko Carstens 提交于
      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: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      fbe76568
  10. 05 6月, 2012 1 次提交
  11. 16 5月, 2012 1 次提交
    • M
      s390: fix race on TIF_MCCK_PENDING · eda0c6d6
      Martin Schwidefsky 提交于
      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: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      eda0c6d6
  12. 11 3月, 2012 3 次提交
    • M
      [S390] rework idle code · 4c1051e3
      Martin Schwidefsky 提交于
      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: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      4c1051e3
    • M
      [S390] rework smp code · 8b646bd7
      Martin Schwidefsky 提交于
      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: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      8b646bd7
    • M
      [S390] rename lowcore field · 7e180bd8
      Martin Schwidefsky 提交于
      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: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      7e180bd8
  13. 27 12月, 2011 2 次提交
    • M
      [S390] cleanup trap handling · aa33c8cb
      Martin Schwidefsky 提交于
      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: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      aa33c8cb
    • M
      [S390] entry[64].S improvements · c5328901
      Martin Schwidefsky 提交于
      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: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      c5328901
  14. 30 10月, 2011 3 次提交
    • M
      [S390] add TIF_SYSCALL thread flag · b6ef5bb3
      Martin Schwidefsky 提交于
      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: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      b6ef5bb3
    • M
      [S390] signal race with restarting system calls · 20b40a79
      Martin Schwidefsky 提交于
      For a ERESTARTNOHAND/ERESTARTSYS/ERESTARTNOINTR restarting system call
      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:
      1) strace never sees ERESTARTNOHAND, ERESTARTSYS, ERESTARTNOINTR or
         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/
      ERESTARTSYS/ERESTARTNOINTR/ERESTART_RESTARTBLOCK. To correct this a
      new ptrace interface is added to save/restore the system call number
      and system call instruction length.
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      20b40a79
    • M
      [S390] lowcore cleanup · 0edc8faa
      Martin Schwidefsky 提交于
      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: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      0edc8faa
  15. 03 8月, 2011 1 次提交
  16. 24 7月, 2011 1 次提交
  17. 23 5月, 2011 1 次提交
    • H
      [S390] pfault: cpu hotplug vs missing completion interrupts · f2db2e6c
      Heiko Carstens 提交于
      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: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      f2db2e6c
  18. 10 5月, 2011 1 次提交
    • M
      [S390] kernel: Initialize register 14 when starting new CPU · 8eb4bd66
      Michael Holzheu 提交于
      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.
      
      Example:
      
       #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: NMichael Holzheu <holzheu@linux.vnet.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      8eb4bd66
  19. 05 1月, 2011 3 次提交
  20. 29 10月, 2010 1 次提交
  21. 25 10月, 2010 3 次提交
  22. 28 7月, 2010 1 次提交
  23. 17 5月, 2010 4 次提交
    • M
      [S390] add breaking event address for user space · 86f2552b
      Martin Schwidefsky 提交于
      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: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      86f2552b
    • M
      [S390] idle time accounting vs. machine checks · 6377981f
      Martin Schwidefsky 提交于
      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: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      6377981f
    • M
      [S390] improve irq tracing code in entry[64].S · 6a2df3a8
      Martin Schwidefsky 提交于
      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: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      6a2df3a8
    • M
      [S390] cleanup sysc_work and io_work code · 43d399d2
      Martin Schwidefsky 提交于
      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: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      43d399d2
  24. 09 4月, 2010 1 次提交
    • M
      [S390] fix io_return critical section cleanup · 176b1803
      Martin Schwidefsky 提交于
      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: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      176b1803