1. 08 Feb, 2010 5 commits
    • Matt Fleming's avatar
      sh: Optimise FDE/CIE lookup by using red-black trees · 858918b7
      Matt Fleming authored
      Now that the DWARF unwinder is being used to provide perf callstacks
      unwinding speed is an issue. It is no longer being used in exceptional
      circumstances where we don't care about runtime performance, e.g. when
      panicing, so it makes sense improve performance is possible.
      
      With this patch I saw a 42% improvement in unwind time when calling
      return_address(1). Greater improvements will be seen as the number of
      levels unwound increases as each unwind is now cheaper.
      
      Note that insertion time has doubled but that's just the price we pay
      for keeping the trees balanced. However, this is a one-time cost for
      kernel boot/module load and so the improvements in lookup time dominate
      the extra time we spend keeping the trees balanced.
      Signed-off-by: default avatarMatt Fleming <matt@console-pimps.org>
      Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
      858918b7
    • Matt Fleming's avatar
      sh: Remove superfluous setup_frame_reg call · 1af0b2fc
      Matt Fleming authored
      There's no need to setup the frame pointer again in
      call_handle_tlbmiss. The frame pointer will already have been setup in
      handle_interrupt.
      Signed-off-by: default avatarMatt Fleming <matt@console-pimps.org>
      Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
      1af0b2fc
    • Matt Fleming's avatar
      sh: Don't continue unwinding across interrupts · 944a3438
      Matt Fleming authored
      Unfortunately, due to poor DWARF info in current toolchains, unwinding
      through interrutps cannot be done reliably. The problem is that the
      DWARF info for function epilogues is wrong.
      
      Take this standard epilogue sequence,
      
      80003cc4:       e3 6f           mov     r14,r15
      80003cc6:       26 4f           lds.l   @r15+,pr
      80003cc8:       f6 6e           mov.l   @r15+,r14
      						<---- interrupt here
      80003cca:       f6 6b           mov.l   @r15+,r11
      80003ccc:       f6 6a           mov.l   @r15+,r10
      80003cce:       f6 69           mov.l   @r15+,r9
      80003cd0:       0b 00           rts
      
      If we take an interrupt at the highlighted point, the DWARF info will
      bogusly claim that the return address can be found at some offset from
      the frame pointer, even though the frame pointer was just restored. The
      worst part is if the unwinder finds a text address at the bogus stack
      address - unwinding will continue, for a bit, until it finally comes
      across an unexpected address on the stack and blows up.
      
      The only solution is to stop unwinding once we've calculated the
      function that was executing when the interrupt occurred. This PC can be
      easily calculated from pt_regs->pc.
      Signed-off-by: default avatarMatt Fleming <matt@console-pimps.org>
      Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
      944a3438
    • Matt Fleming's avatar
      sh: Setup frame pointer in handle_exception path · 1dca56f1
      Matt Fleming authored
      In order to allow the DWARF unwinder to unwind through exceptions we
      need to setup the frame pointer register (r14).
      Signed-off-by: default avatarMatt Fleming <matt@console-pimps.org>
      Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
      1dca56f1
    • Matt Fleming's avatar
      sh: Correct the offset of the return address in ret_from_exception · 14269828
      Matt Fleming authored
      The address that ret_from_exception and ret_from_irq will return to is
      found in the stack slot for SPC, not PR. This error was causing the
      DWARF unwinder to pick up the wrong return address on the stack and then
      unwind using the unwind tables for the wrong function.
      
      While I'm here I might as well add CFI annotations for the other
      registers since they could be useful when unwinding.
      Signed-off-by: default avatarMatt Fleming <matt@console-pimps.org>
      Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
      14269828
  2. 05 Feb, 2010 8 commits
  3. 04 Feb, 2010 2 commits
  4. 03 Feb, 2010 25 commits