1. 15 May, 2008 1 commit
    • David S. Miller's avatar
      sparc: Fix debugger syscall restart interactions. · b6c84db1
      David S. Miller authored
      [ This is a 2.6.25 backport of upstream changeset
        28e61036
      
       with sparc32 build
        fixes from Robert Reif ]
      
      So, forever, we've had this ptrace_signal_deliver implementation
      which tries to handle all of the nasties that can occur when the
      debugger looks at a process about to take a signal.  It's meant
      to address all of these issues inside of the kernel so that the
      debugger need not be mindful of such things.
      
      Problem is, this doesn't work.
      
      The idea was that we should do the syscall restart business first, so
      that the debugger captures that state.  Otherwise, if the debugger for
      example saves the child's state, makes the child execute something
      else, then restores the saved state, we won't handle the syscall
      restart properly because we lose the "we're in a syscall" state.
      
      The code here worked for most cases, but if the debugger actually
      passes the signal through to the child unaltered, it's possible that
      we would do a syscall restart when we shouldn't have.
      
      In particular this breaks the case of debugging a process under a gdb
      which is being debugged by yet another gdb.  gdb uses sigsuspend
      to wait for SIGCHLD of the inferior, but if gdb itself is being
      debugged by a top-level gdb we get a ptrace_stop().  The top-level gdb
      does a PTRACE_CONT with SIGCHLD to let the inferior gdb see the
      signal.  But ptrace_signal_deliver() assumed the debugger would cancel
      out the signal and therefore did a syscall restart, because the return
      error was ERESTARTNOHAND.
      
      Fix this by simply making ptrace_signal_deliver() a nop, and providing
      a way for the debugger to control system call restarting properly:
      
      1) Report a "in syscall" software bit in regs->{tstate,psr}.
         It is set early on in trap entry to a system call and is fully
         visible to the debugger via ptrace() and regsets.
      
      2) Test this bit right before doing a syscall restart.  We have
         to do a final recheck right after get_signal_to_deliver() in
         case the debugger cleared the bit during ptrace_stop().
      
      3) Clear the bit in trap return so we don't accidently try to set
         that bit in the real register.
      
      As a result we also get a ptrace_{is,clear}_syscall() for sparc32 just
      like sparc64 has.
      
      M68K has this same exact bug, and is now the only other user of the
      ptrace_signal_deliver hook.  It needs to be fixed in the same exact
      way as sparc.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      b6c84db1
  2. 30 Jun, 2006 1 commit
  3. 20 Mar, 2006 11 commits
    • David S. Miller's avatar
      [SPARC64]: Fix tl1 trap state capture/dump on SUN4V. · 3d6395cb
      David S. Miller authored
      
      No trap levels above 2 in privileged mode on SUN4V.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3d6395cb
    • David S. Miller's avatar
      [SPARC64]: Patch up mmu context register writes for sun4v. · 8b11bd12
      David S. Miller authored
      
      sun4v uses ASI_MMU instead of ASI_DMMU
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8b11bd12
    • David S. Miller's avatar
    • David S. Miller's avatar
      [SPARC64]: Add initial code to twiddle %gl on trap entry/exit. · 936f482a
      David S. Miller authored
      
      Instead of setting/clearing PSTATE_AG we have to change
      the %gl register value on sun4v.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      936f482a
    • David S. Miller's avatar
      [SPARC64]: Fill dead cycles on trap entry with real work. · 6e02493a
      David S. Miller authored
      
      As we save trap state onto the stack, the store buffer fills up
      mid-way through and we stall for several cycles as the store buffer
      trickles out to the L2 cache.  Meanwhile we can do some privileged
      register reads and other calculations, essentially for free.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6e02493a
    • David S. Miller's avatar
      [SPARC64]: Refine register window trap handling. · 314ef685
      David S. Miller authored
      
      When saving and restoing trap state, do the window spill/fill
      handling inline so that we never trap deeper than 2 trap levels.
      This is important for chips like Niagara.
      
      The window fixup code is massively simplified, and many more
      improvements are now possible.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      314ef685
    • David S. Miller's avatar
      [SPARC64]: Add explicit register args to trap state loading macros. · ffe483d5
      David S. Miller authored
      
      This, as well as making the code cleaner, allows a simplification in
      the TSB miss handling path.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ffe483d5
    • David S. Miller's avatar
      [SPARC64]: Fix race in LOAD_PER_CPU_BASE() · 86b81868
      David S. Miller authored
      
      Since we use %g5 itself as a temporary, it can get clobbered
      if we take an interrupt mid-stream and thus cause end up with
      the final %g5 value too early as a result of rtrap processing.
      
      Set %g5 at the very end, atomically, to avoid this problem.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      86b81868
    • David S. Miller's avatar
      [SPARC64]: Fix bogus flush instruction usage. · 4da808c3
      David S. Miller authored
      
      Some of the trap code was still assuming that alternate
      global %g6 was hard coded with current_thread_info().
      Let's just consistently flush at KERNBASE when we need
      a pipeline synchronization.  That's locked into the TLB
      and will always work.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4da808c3
    • David S. Miller's avatar
      [SPARC64]: Elminate all usage of hard-coded trap globals. · 56fb4df6
      David S. Miller authored
      
      UltraSPARC has special sets of global registers which are switched to
      for certain trap types.  There is one set for MMU related traps, one
      set of Interrupt Vector processing, and another set (called the
      Alternate globals) for all other trap types.
      
      For what seems like forever we've hard coded the values in some of
      these trap registers.  Some examples include:
      
      1) Interrupt Vector global %g6 holds current processors interrupt
         work struct where received interrupts are managed for IRQ handler
         dispatch.
      
      2) MMU global %g7 holds the base of the page tables of the currently
         active address space.
      
      3) Alternate global %g6 held the current_thread_info() value.
      
      Such hardcoding has resulted in some serious issues in many areas.
      There are some code sequences where having another register available
      would help clean up the implementation.  Taking traps such as
      cross-calls from the OBP firmware requires some trick code sequences
      wherein we have to save away and restore all of the special sets of
      global registers when we enter/exit OBP.
      
      We were also using the IMMU TSB register on SMP to hold the per-cpu
      area base address, which doesn't work any longer now that we actually
      use the TSB facility of the cpu.
      
      The implementation is pretty straight forward.  One tricky bit is
      getting the current processor ID as that is different on different cpu
      variants.  We use a stub with a fancy calling convention which we
      patch at boot time.  The calling convention is that the stub is
      branched to and the (PC - 4) to return to is in register %g1.  The cpu
      number is left in %g6.  This stub can be invoked by using the
      __GET_CPUID macro.
      
      We use an array of per-cpu trap state to store the current thread and
      physical address of the current address space's page tables.  The
      TRAP_LOAD_THREAD_REG loads %g6 with the current thread from this
      table, it uses __GET_CPUID and also clobbers %g1.
      
      TRAP_LOAD_IRQ_WORK is used by the interrupt vector processing to load
      the current processor's IRQ software state into %g6.  It also uses
      __GET_CPUID and clobbers %g1.
      
      Finally, TRAP_LOAD_PGD_PHYS loads the physical address base of the
      current address space's page tables into %g7, it clobbers %g1 and uses
      __GET_CPUID.
      
      Many refinements are possible, as well as some tuning, with this stuff
      in place.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      56fb4df6
    • David S. Miller's avatar
      [SPARC64]: Move away from virtual page tables, part 1. · 74bf4312
      David S. Miller authored
      
      We now use the TSB hardware assist features of the UltraSPARC
      MMUs.
      
      SMP is currently knowingly broken, we need to find another place
      to store the per-cpu base pointers.  We hid them away in the TSB
      base register, and that obviously will not work any more :-)
      
      Another known broken case is non-8KB base page size.
      
      Also noticed that flush_tlb_all() is not referenced anywhere, only
      the internal __flush_tlb_all() (local cpu only) is used by the
      sparc64 port, so we can get rid of flush_tlb_all().
      
      The kernel gets it's own 8KB TSB (swapper_tsb) and each address space
      gets it's own private 8K TSB.  Later we can add code to dynamically
      increase the size of per-process TSB as the RSS grows.  An 8KB TSB is
      good enough for up to about a 4MB RSS, after which the TSB starts to
      incur many capacity and conflict misses.
      
      We even accumulate OBP translations into the kernel TSB.
      
      Another area for refinement is large page size support.  We could use
      a secondary address space TSB to handle those.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      74bf4312
  4. 04 Oct, 2005 1 commit
  5. 16 Apr, 2005 1 commit
    • Linus Torvalds's avatar
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds authored
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4