1. 27 10月, 2009 1 次提交
    • B
      powerpc/ppc64: Use preempt_schedule_irq instead of preempt_schedule · 4f917ba3
      Benjamin Herrenschmidt 提交于
      Based on an original patch by Valentine Barshak <vbarshak@ru.mvista.com>
      
      Use preempt_schedule_irq to prevent infinite irq-entry and
      eventual stack overflow problems with fast-paced IRQ sources.
      
      This kind of problems has been observed on the PASemi Electra IDE
      controller. We have to make sure we are soft-disabled before calling
      preempt_schedule_irq and hard disable interrupts after that
      to avoid unrecoverable exceptions.
      
      This patch also moves the "clrrdi r9,r1,THREAD_SHIFT" out of
      the #ifdef CONFIG_PPC_BOOK3E scope, since r9 is clobbered
      and has to be restored in both cases.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      4f917ba3
  2. 14 10月, 2009 1 次提交
  3. 21 9月, 2009 1 次提交
    • I
      perf: Do the big rename: Performance Counters -> Performance Events · cdd6c482
      Ingo Molnar 提交于
      Bye-bye Performance Counters, welcome Performance Events!
      
      In the past few months the perfcounters subsystem has grown out its
      initial role of counting hardware events, and has become (and is
      becoming) a much broader generic event enumeration, reporting, logging,
      monitoring, analysis facility.
      
      Naming its core object 'perf_counter' and naming the subsystem
      'perfcounters' has become more and more of a misnomer. With pending
      code like hw-breakpoints support the 'counter' name is less and
      less appropriate.
      
      All in one, we've decided to rename the subsystem to 'performance
      events' and to propagate this rename through all fields, variables
      and API names. (in an ABI compatible fashion)
      
      The word 'event' is also a bit shorter than 'counter' - which makes
      it slightly more convenient to write/handle as well.
      
      Thanks goes to Stephane Eranian who first observed this misnomer and
      suggested a rename.
      
      User-space tooling and ABI compatibility is not affected - this patch
      should be function-invariant. (Also, defconfigs were not touched to
      keep the size down.)
      
      This patch has been generated via the following script:
      
        FILES=$(find * -type f | grep -vE 'oprofile|[^K]config')
      
        sed -i \
          -e 's/PERF_EVENT_/PERF_RECORD_/g' \
          -e 's/PERF_COUNTER/PERF_EVENT/g' \
          -e 's/perf_counter/perf_event/g' \
          -e 's/nb_counters/nb_events/g' \
          -e 's/swcounter/swevent/g' \
          -e 's/tpcounter_event/tp_event/g' \
          $FILES
      
        for N in $(find . -name perf_counter.[ch]); do
          M=$(echo $N | sed 's/perf_counter/perf_event/g')
          mv $N $M
        done
      
        FILES=$(find . -name perf_event.*)
      
        sed -i \
          -e 's/COUNTER_MASK/REG_MASK/g' \
          -e 's/COUNTER/EVENT/g' \
          -e 's/\<event\>/event_id/g' \
          -e 's/counter/event/g' \
          -e 's/Counter/Event/g' \
          $FILES
      
      ... to keep it as correct as possible. This script can also be
      used by anyone who has pending perfcounters patches - it converts
      a Linux kernel tree over to the new naming. We tried to time this
      change to the point in time where the amount of pending patches
      is the smallest: the end of the merge window.
      
      Namespace clashes were fixed up in a preparatory patch - and some
      stylistic fallout will be fixed up in a subsequent patch.
      
      ( NOTE: 'counters' are still the proper terminology when we deal
        with hardware registers - and these sed scripts are a bit
        over-eager in renaming them. I've undone some of that, but
        in case there's something left where 'counter' would be
        better than 'event' we can undo that on an individual basis
        instead of touching an otherwise nicely automated patch. )
      Suggested-by: NStephane Eranian <eranian@google.com>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Acked-by: NPaul Mackerras <paulus@samba.org>
      Reviewed-by: NArjan van de Ven <arjan@linux.intel.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: <linux-arch@vger.kernel.org>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      cdd6c482
  4. 20 8月, 2009 3 次提交
    • B
      powerpc: Remaining 64-bit Book3E support · 2d27cfd3
      Benjamin Herrenschmidt 提交于
      This contains all the bits that didn't fit in previous patches :-) This
      includes the actual exception handlers assembly, the changes to the
      kernel entry, other misc bits and wiring it all up in Kconfig.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      2d27cfd3
    • B
      powerpc/of: Remove useless register save/restore when calling OF back · 6c171994
      Benjamin Herrenschmidt 提交于
      enter_prom() used to save and restore registers such as CTR, XER etc..
      which are volatile, or SRR0,1... which we don't care about. This
      removes a bunch of useless code and while at it turns an mtmsrd into
      an MTMSRD macro which will be useful to Book3E.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      6c171994
    • B
      powerpc: Use names rather than numbers for SPRGs (v2) · ee43eb78
      Benjamin Herrenschmidt 提交于
      The kernel uses SPRG registers for various purposes, typically in
      low level assembly code as scratch registers or to hold per-cpu
      global infos such as the PACA or the current thread_info pointer.
      
      We want to be able to easily shuffle the usage of those registers
      as some implementations have specific constraints realted to some
      of them, for example, some have userspace readable aliases, etc..
      and the current choice isn't always the best.
      
      This patch should not change any code generation, and replaces the
      usage of SPRN_SPRGn everywhere in the kernel with a named replacement
      and adds documentation next to the definition of the names as to
      what those are used for on each processor family.
      
      The only parts that still use the original numbers are bits of KVM
      or suspend/resume code that just blindly needs to save/restore all
      the SPRGs.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      ee43eb78
  5. 23 2月, 2009 3 次提交
  6. 09 1月, 2009 1 次提交
    • P
      powerpc: Provide a way to defer perf counter work until interrupts are enabled · 93a6d3ce
      Paul Mackerras 提交于
      Because 64-bit powerpc uses lazy (soft) interrupt disabling, it is
      possible for a performance monitor exception to come in when the
      kernel thinks interrupts are disabled (i.e. when they are
      soft-disabled but hard-enabled).  In such a situation the performance
      monitor exception handler might have some processing to do (such as
      process wakeups) which can't be done in what is effectively an NMI
      handler.
      
      This provides a way to defer that work until interrupts get enabled,
      either in raw_local_irq_restore() or by returning from an interrupt
      handler to code that had interrupts enabled.  We have a per-processor
      flag that indicates that there is work pending to do when interrupts
      subsequently get re-enabled.  This flag is checked in the interrupt
      return path and in raw_local_irq_restore(), and if it is set,
      perf_counter_do_pending() is called to do the pending work.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      93a6d3ce
  7. 01 12月, 2008 1 次提交
    • P
      powerpc: Fix system calls on Cell entered with XER.SO=1 · ab598b66
      Paul Mackerras 提交于
      It turns out that on Cell, on a kernel with CONFIG_VIRT_CPU_ACCOUNTING
      = y, if a program sets the SO (summary overflow) bit in the XER and
      then does a system call, the SO bit in CR0 will be set on return
      regardless of whether the system call detected an error.  Since CR0.SO
      is used as the error indication from the system call, this means that
      all system calls appear to fail.
      
      The reason is that the workaround for the timebase bug on Cell uses a
      compare instruction.  With CONFIG_VIRT_CPU_ACCOUNTING = y, the
      ACCOUNT_CPU_USER_ENTRY macro reads the timebase, so we end up doing a
      compare instruction, which copies XER.SO to CR0.SO.  Since we were
      doing this in the system call entry patch after clearing CR0.SO but
      before saving the CR, this meant that the saved CR image had CR0.SO
      set if XER.SO was set on entry.
      
      This fixes it by moving the clearing of CR0.SO to after the
      ACCOUNT_CPU_USER_ENTRY call in the system call entry path.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      ab598b66
  8. 28 11月, 2008 1 次提交
    • S
      powerpc: ftrace, do nothing in mcount call for dyn ftrace · c7b0d173
      Steven Rostedt 提交于
      Impact: quicken mcount calls that are not replaced by dyn ftrace
      
      Dynamic ftrace no longer does on the fly recording of mcount locations.
      The mcount locations are now found at compile time. The mcount
      function no longer needs to store registers and call a stub function.
      It can now just simply return.
      
      Since there are some functions that do not get converted to a nop
      (.init sections and other code that may disappear), this patch should
      help speed up that code.
      
      Also, the stub for mcount on PowerPC 32 can not be a simple branch
      link register like it is on PowerPC 64. According to the ABI specification:
      
      "The _mcount routine is required to restore the link register from
       the stack so that the profiling code can be inserted transparently,
       whether or not the profiled function saves the link register itself."
      
      This means that we must restore the link register that was used
      to make the call to mcount.  The minimal mcount function for PPC32
      ends up being:
      
       mcount:
              mflr    r0
              mtctr   r0
              lwz     r0, 4(r1)
              mtlr    r0
              bctr
      
      Where we move the link register used to call mcount into the
      ctr register, and then restore the link register from the stack.
      Then we use the ctr register to jump back to the mcount caller.
      The r0 register is free for us to use.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c7b0d173
  9. 21 10月, 2008 1 次提交
  10. 16 9月, 2008 1 次提交
    • P
      powerpc: Use LOAD_REG_IMMEDIATE only for constants on 64-bit · e31aa453
      Paul Mackerras 提交于
      Using LOAD_REG_IMMEDIATE to get the address of kernel symbols
      generates 5 instructions where LOAD_REG_ADDR can do it in one,
      and will generate R_PPC64_ADDR16_* relocations in the output when
      we get to making the kernel as a position-independent executable,
      which we'd rather not have to handle.  This changes various bits
      of assembly code to use LOAD_REG_ADDR when we need to get the
      address of a symbol, or to use suitable position-independent code
      for cases where we can't access the TOC for various reasons, or
      if we're not running at the address we were linked at.
      
      It also cleans up a few minor things; there's no reason to save and
      restore SRR0/1 around RTAS calls, __mmu_off can get the return
      address from LR more conveniently than the caller can supply it in
      R4 (and we already assume elsewhere that EA == RA if the MMU is on
      in early boot), and enable_64b_mode was using 5 instructions where
      2 would do.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      e31aa453
  11. 20 8月, 2008 1 次提交
  12. 28 7月, 2008 2 次提交
  13. 01 7月, 2008 2 次提交
  14. 24 6月, 2008 1 次提交
  15. 24 5月, 2008 1 次提交
  16. 18 4月, 2008 2 次提交
  17. 17 10月, 2007 1 次提交
    • O
      [POWERPC] Add 1TB workaround for PA6T · f66bce5e
      Olof Johansson 提交于
      PA6T has a bug where the slbie instruction does not honor the large
      segment bit.  As a result, we have to always use slbia when switching
      context.
      
      We don't have to worry about changing the slbie's during fault processing,
      since they should never be replacing one VSID with another using the
      same ESID.  I.e. there's no risk for inserting duplicate entries due to a
      failed slbie of the old entry.  So as long as we clear it out on context
      switch we should be fine.
      Signed-off-by: NOlof Johansson <olof@lixom.net>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      f66bce5e
  18. 12 10月, 2007 1 次提交
    • P
      [POWERPC] Use 1TB segments · 1189be65
      Paul Mackerras 提交于
      This makes the kernel use 1TB segments for all kernel mappings and for
      user addresses of 1TB and above, on machines which support them
      (currently POWER5+, POWER6 and PA6T).
      
      We detect that the machine supports 1TB segments by looking at the
      ibm,processor-segment-sizes property in the device tree.
      
      We don't currently use 1TB segments for user addresses < 1T, since
      that would effectively prevent 32-bit processes from using huge pages
      unless we also had a way to revert to using 256MB segments.  That
      would be possible but would involve extra complications (such as
      keeping track of which segment size was used when HPTEs were inserted)
      and is not addressed here.
      
      Parts of this patch were originally written by Ben Herrenschmidt.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      1189be65
  19. 19 9月, 2007 1 次提交
  20. 03 8月, 2007 1 次提交
    • M
      [POWERPC] Fixes for the SLB shadow buffer code · 67439b76
      Michael Neuling 提交于
      On a machine with hardware 64kB pages and a kernel configured for a
      64kB base page size, we need to change the vmalloc segment from 64kB
      pages to 4kB pages if some driver creates a non-cacheable mapping in
      the vmalloc area.  However, we never updated with SLB shadow buffer.
      This fixes it.  Thanks to paulus for finding this.
      
      Also added some write barriers to ensure the shadow buffer contents
      are always consistent.
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      67439b76
  21. 01 8月, 2007 1 次提交
  22. 07 2月, 2007 1 次提交
  23. 09 1月, 2007 1 次提交
    • D
      [POWERPC] Fix manual assembly WARN_ON() in enter_rtas(). · 007d88d0
      David Woodhouse 提交于
      When we switched over to the generic BUG mechanism we forgot to change
      the assembly code which open-codes a WARN_ON() in enter_rtas(), so the
      bug table got corrupted.
      
      This patch provides an EMIT_BUG_ENTRY macro for use in assembly code,
      and uses it in entry_64.S. Tested with CONFIG_DEBUG_BUGVERBOSE on ppc64
      but not without -- I tried to turn it off but it wouldn't go away; I
      suspect Aunt Tillie probably needed it.
      
      This version gets __FILE__ and __LINE__ right in the assembly version --
      rather than saying include/asm-powerpc/bug.h line 21 every time which is
      a little suboptimal.
      Signed-off-by: NDavid Woodhouse <dwmw2@infradead.org>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      007d88d0
  24. 04 12月, 2006 1 次提交
  25. 13 11月, 2006 1 次提交
  26. 18 10月, 2006 1 次提交
    • P
      [POWERPC] Make sure interrupt enable gets restored properly · b0a779de
      Paul Mackerras 提交于
      The lazy IRQ disable patch missed a couple of places where the
      interrupt enable flags need to be restored correctly.  First, we
      weren't restoring the paca->hard_enabled flag on interrupt exit.
      Instead of saving it on entry, we compute it from the MSR_EE bit
      in the MSR we are restoring at exit.  Secondly, the MMU hash miss
      code was clearing both paca->soft_enabled and paca->hard_enabled
      but not restoring them in the case where hash_page was able to
      resolve the miss from the Linux page tables.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      b0a779de
  27. 16 10月, 2006 1 次提交
    • P
      [POWERPC] Lazy interrupt disabling for 64-bit machines · d04c56f7
      Paul Mackerras 提交于
      This implements a lazy strategy for disabling interrupts.  This means
      that local_irq_disable() et al. just clear the 'interrupts are
      enabled' flag in the paca.  If an interrupt comes along, the interrupt
      entry code notices that interrupts are supposed to be disabled, and
      clears the EE bit in SRR1, clears the 'interrupts are hard-enabled'
      flag in the paca, and returns.  This means that interrupts only
      actually get disabled in the processor when an interrupt comes along.
      
      When interrupts are enabled by local_irq_enable() et al., the code
      sets the interrupts-enabled flag in the paca, and then checks whether
      interrupts got hard-disabled.  If so, it also sets the EE bit in the
      MSR to hard-enable the interrupts.
      
      This has the potential to improve performance, and also makes it
      easier to make a kernel that can boot on iSeries and on other 64-bit
      machines, since this lazy-disable strategy is very similar to the
      soft-disable strategy that iSeries already uses.
      
      This version renames paca->proc_enabled to paca->soft_enabled, and
      changes a couple of soft-disables in the kexec code to hard-disables,
      which should fix the crash that Michael Ellerman saw.  This doesn't
      yet use a reserved CR field for the soft_enabled and hard_enabled
      flags.  This applies on top of Stephen Rothwell's patches to make it
      possible to build a combined iSeries/other kernel.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      d04c56f7
  28. 03 10月, 2006 1 次提交
  29. 25 8月, 2006 1 次提交
  30. 08 8月, 2006 1 次提交
  31. 01 7月, 2006 1 次提交
  32. 15 6月, 2006 1 次提交
  33. 28 3月, 2006 1 次提交
    • M
      [PATCH] powerpc: Workaround for pSeries RTAS bug · 9fe901d1
      Mike Kravetz 提交于
      A bug in the RTAS services incorrectly interprets some bits in the CR
      when called from the OS.  Specifically, bits in CR4.  The result could
      be a firmware crash that also takes down the partition.  A firmware
      fix is in the works.  We have seen this situation when performing DLPAR
      operations.  As a temporary workaround, clear the CR in enter_rtas().
      Note that enter_rtas() will not set any bits in CR4 before calling RTAS.
      
      Also note that the 32 bit version of enter_rtas() should have the same
      work around even though the chances of hitting the bug are much smaller
      due to the lack of DLPAR on 32 bit kernels.  However, my assembly skills
      are a bit rusty and the 32 bit code doesn't seem to follow the conventions
      for where things should be saved.  In addition, I don't have a system
      to test 32 bit kernels.  Help creating and at least touch testing the
      same workaround for 32 bit would be appreciated.
      Signed-off-by: NMike Kravetz <kravetz@us.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      9fe901d1