1. 22 9月, 2005 3 次提交
  2. 21 9月, 2005 1 次提交
  3. 20 9月, 2005 2 次提交
  4. 15 9月, 2005 1 次提交
    • D
      [LIB]: Consolidate _atomic_dec_and_lock() · 4db2ce01
      David S. Miller 提交于
      Several implementations were essentialy a common piece of C code using
      the cmpxchg() macro.  Put the implementation in one spot that everyone
      can share, and convert sparc64 over to using this.
      
      Alpha is the lone arch-specific implementation, which codes up a
      special fast path for the common case in order to avoid GP reloading
      which a pure C version would require.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4db2ce01
  5. 11 9月, 2005 1 次提交
    • I
      [PATCH] spinlock consolidation · fb1c8f93
      Ingo Molnar 提交于
      This patch (written by me and also containing many suggestions of Arjan van
      de Ven) does a major cleanup of the spinlock code.  It does the following
      things:
      
       - consolidates and enhances the spinlock/rwlock debugging code
      
       - simplifies the asm/spinlock.h files
      
       - encapsulates the raw spinlock type and moves generic spinlock
         features (such as ->break_lock) into the generic code.
      
       - cleans up the spinlock code hierarchy to get rid of the spaghetti.
      
      Most notably there's now only a single variant of the debugging code,
      located in lib/spinlock_debug.c.  (previously we had one SMP debugging
      variant per architecture, plus a separate generic one for UP builds)
      
      Also, i've enhanced the rwlock debugging facility, it will now track
      write-owners.  There is new spinlock-owner/CPU-tracking on SMP builds too.
      All locks have lockup detection now, which will work for both soft and hard
      spin/rwlock lockups.
      
      The arch-level include files now only contain the minimally necessary
      subset of the spinlock code - all the rest that can be generalized now
      lives in the generic headers:
      
       include/asm-i386/spinlock_types.h       |   16
       include/asm-x86_64/spinlock_types.h     |   16
      
      I have also split up the various spinlock variants into separate files,
      making it easier to see which does what. The new layout is:
      
         SMP                         |  UP
         ----------------------------|-----------------------------------
         asm/spinlock_types_smp.h    |  linux/spinlock_types_up.h
         linux/spinlock_types.h      |  linux/spinlock_types.h
         asm/spinlock_smp.h          |  linux/spinlock_up.h
         linux/spinlock_api_smp.h    |  linux/spinlock_api_up.h
         linux/spinlock.h            |  linux/spinlock.h
      
      /*
       * here's the role of the various spinlock/rwlock related include files:
       *
       * on SMP builds:
       *
       *  asm/spinlock_types.h: contains the raw_spinlock_t/raw_rwlock_t and the
       *                        initializers
       *
       *  linux/spinlock_types.h:
       *                        defines the generic type and initializers
       *
       *  asm/spinlock.h:       contains the __raw_spin_*()/etc. lowlevel
       *                        implementations, mostly inline assembly code
       *
       *   (also included on UP-debug builds:)
       *
       *  linux/spinlock_api_smp.h:
       *                        contains the prototypes for the _spin_*() APIs.
       *
       *  linux/spinlock.h:     builds the final spin_*() APIs.
       *
       * on UP builds:
       *
       *  linux/spinlock_type_up.h:
       *                        contains the generic, simplified UP spinlock type.
       *                        (which is an empty structure on non-debug builds)
       *
       *  linux/spinlock_types.h:
       *                        defines the generic type and initializers
       *
       *  linux/spinlock_up.h:
       *                        contains the __raw_spin_*()/etc. version of UP
       *                        builds. (which are NOPs on non-debug, non-preempt
       *                        builds)
       *
       *   (included on UP-non-debug builds:)
       *
       *  linux/spinlock_api_up.h:
       *                        builds the _spin_*() APIs.
       *
       *  linux/spinlock.h:     builds the final spin_*() APIs.
       */
      
      All SMP and UP architectures are converted by this patch.
      
      arm, i386, ia64, ppc, ppc64, s390/s390x, x64 was build-tested via
      crosscompilers.  m32r, mips, sh, sparc, have not been tested yet, but should
      be mostly fine.
      
      From: Grant Grundler <grundler@parisc-linux.org>
      
        Booted and lightly tested on a500-44 (64-bit, SMP kernel, dual CPU).
        Builds 32-bit SMP kernel (not booted or tested).  I did not try to build
        non-SMP kernels.  That should be trivial to fix up later if necessary.
      
        I converted bit ops atomic_hash lock to raw_spinlock_t.  Doing so avoids
        some ugly nesting of linux/*.h and asm/*.h files.  Those particular locks
        are well tested and contained entirely inside arch specific code.  I do NOT
        expect any new issues to arise with them.
      
       If someone does ever need to use debug/metrics with them, then they will
        need to unravel this hairball between spinlocks, atomic ops, and bit ops
        that exist only because parisc has exactly one atomic instruction: LDCW
        (load and clear word).
      
      From: "Luck, Tony" <tony.luck@intel.com>
      
         ia64 fix
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NArjan van de Ven <arjanv@infradead.org>
      Signed-off-by: NGrant Grundler <grundler@parisc-linux.org>
      Cc: Matthew Wilcox <willy@debian.org>
      Signed-off-by: NHirokazu Takata <takata@linux-m32r.org>
      Signed-off-by: NMikael Pettersson <mikpe@csd.uu.se>
      Signed-off-by: NBenoit Boissinot <benoit.boissinot@ens-lyon.org>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      fb1c8f93
  6. 10 9月, 2005 4 次提交
  7. 09 9月, 2005 3 次提交
    • D
      [PATCH] Make sparc64 use setup-res.c · 085ae41f
      David S. Miller 提交于
      There were three changes necessary in order to allow
      sparc64 to use setup-res.c:
      
      1) Sparc64 roots the PCI I/O and MEM address space using
         parent resources contained in the PCI controller structure.
         I'm actually surprised no other platforms do this, especially
         ones like Alpha and PPC{,64}.  These resources get linked into the
         iomem/ioport tree when PCI controllers are probed.
      
         So the hierarchy looks like this:
      
         iomem --|
      	   PCI controller 1 MEM space --|
      				        device 1
      					device 2
      					etc.
      	   PCI controller 2 MEM space --|
      				        ...
         ioport --|
                  PCI controller 1 IO space --|
      					...
                  PCI controller 2 IO space --|
      					...
      
         You get the idea.  The drivers/pci/setup-res.c code allocates
         using plain iomem_space and ioport_space as the root, so that
         wouldn't work with the above setup.
      
         So I added a pcibios_select_root() that is used to handle this.
         It uses the PCI controller struct's io_space and mem_space on
         sparc64, and io{port,mem}_resource on every other platform to
         keep current behavior.
      
      2) quirk_io_region() is buggy.  It takes in raw BUS view addresses
         and tries to use them as a PCI resource.
      
         pci_claim_resource() expects the resource to be fully formed when
         it gets called.  The sparc64 implementation would do the translation
         but that's absolutely wrong, because if the same resource gets
         released then re-claimed we'll adjust things twice.
      
         So I fixed up quirk_io_region() to do the proper pcibios_bus_to_resource()
         conversion before passing it on to pci_claim_resource().
      
      3) I was mistakedly __init'ing the function methods the PCI controller
         drivers provide on sparc64 to implement some parts of these
         routines.  This was, of course, easy to fix.
      
      So we end up with the following, and that nasty SPARC64 makefile
      ifdef in drivers/pci/Makefile is finally zapped.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      085ae41f
    • J
      [PATCH] PCI: restore BAR values after D3hot->D0 for devices that need it · 064b53db
      John W. Linville 提交于
      Some PCI devices (e.g. 3c905B, 3c556B) lose all configuration
      (including BARs) when transitioning from D3hot->D0.  This leaves such
      a device in an inaccessible state.  The patch below causes the BARs
      to be restored when enabling such a device, so that its driver will
      be able to access it.
      
      The patch also adds pci_restore_bars as a new global symbol, and adds a
      correpsonding EXPORT_SYMBOL_GPL for that.
      
      Some firmware (e.g. Thinkpad T21) leaves devices in D3hot after a
      (re)boot.  Most drivers call pci_enable_device very early, so devices
      left in D3hot that lose configuration during the D3hot->D0 transition
      will be inaccessible to their drivers.
      
      Drivers could be modified to account for this, but it would
      be difficult to know which drivers need modification.  This is
      especially true since often many devices are covered by the same
      driver.  It likely would be necessary to replicate code across dozens
      of drivers.
      
      The patch below should trigger only when transitioning from D3hot->D0
      (or at boot), and only for devices that have the "no soft reset" bit
      cleared in the PM control register.  I believe it is safe to include
      this patch as part of the PCI infrastructure.
      
      The cleanest implementation of pci_restore_bars was to call
      pci_update_resource.  Unfortunately, that does not currently exist
      for the sparc64 architecture.  The patch below includes a null
      implemenation of pci_update_resource for sparc64.
      
      Some have expressed interest in making general use of the the
      pci_restore_bars function, so that has been exported to GPL licensed
      modules.
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      064b53db
    • D
      [SPARC64]: Inline membar()'s again. · 4d803fcd
      David S. Miller 提交于
      Since GCC has to emit a call and a delay slot to the
      out-of-line "membar" routines in arch/sparc64/lib/mb.S
      it is much better to just do the necessary predicted
      branch inline instead as:
      
      	ba,pt	%xcc, 1f
      	 membar	#whatever
      1:
      
      instead of the current:
      
      	call	membar_foo
      	 dslot
      
      because this way GCC is not required to allocate a stack
      frame if the function can be a leaf function.
      
      This also makes this bug fix easier to backport to 2.4.x
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4d803fcd
  8. 08 9月, 2005 5 次提交
  9. 07 9月, 2005 1 次提交
  10. 06 9月, 2005 1 次提交
  11. 02 9月, 2005 1 次提交
  12. 01 9月, 2005 1 次提交
  13. 31 8月, 2005 4 次提交
  14. 30 8月, 2005 8 次提交
    • D
      [SPARC64]: Eliminate irq_cpustat_t. · d7ce78fd
      David S. Miller 提交于
      We can put the __softirq_pending mask in the cpudata,
      no need for the silly NR_CPUS array in kernel/softirq.c
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d7ce78fd
    • D
      [SPARC64]: More fully work around Spitfire Errata 51. · 4f07118f
      David S. Miller 提交于
      It appears that a memory barrier soon after a mispredicted
      branch, not just in the delay slot, can cause the hang
      condition of this cpu errata.
      
      So move them out-of-line, and explicitly put them into
      a "branch always, predict taken" delay slot which should
      fully kill this problem.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4f07118f
    • D
      [SPARC64]: Make debugging spinlocks usable again. · 442464a5
      David S. Miller 提交于
      When the spinlock routines were moved out of line into
      kernel/spinlock.c this made it so that the debugging
      spinlocks record lock acquisition program counts in the
      kernel/spinlock.c functions not in their callers.
      This makes the debugging info kind of useless.
      
      So record the correct caller's program counter and
      now this feature is useful once more.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      442464a5
    • K
      [SPARC64]: remove use of asm/segment.h · 3d6364ab
      Kumar Gala 提交于
      Removed sparc64 architecture specific users of asm/segment.h and
      asm-sparc64/segment.h itself
      Signed-off-by: NKumar Gala <kumar.gala@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3d6364ab
    • D
      [SPARC64]: Revamp Spitfire error trap handling. · 6c52a96e
      David S. Miller 提交于
      Current uncorrectable error handling was poor enough
      that the processor could just loop taking the same
      trap over and over again.  Fix things up so that we
      at least get a log message and perhaps even some register
      state.
      
      In the process, much consolidation became possible,
      particularly with the correctable error handler.
      
      Prefix assembler and C function names with "spitfire"
      to indicate that these are for Ultra-I/II/IIi/IIe only.
      
      More work is needed to make these routines robust and
      featureful to the level of the Ultra-III error handlers.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6c52a96e
    • D
      [SPARC64]: Do not call winfix_dax blindly · bde4e4ee
      David S. Miller 提交于
      Verify we really are taking a data access exception trap, at TL1, from
      one of the window spill/fill handlers.
      
      Else call a new function, data_access_exception_tl1, to log the error.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bde4e4ee
    • D
      [SPARC64]: Fix trap state reading for instruction_access_exception. · 5ea68e02
      David S. Miller 提交于
      1) Read ASI_IMMU SFSR not ASI_DMMU.
      2) IMMU has no SFAR, read TPC instead
      3) Delete old and incorrect comment about the DTLB protection
         trap having a dependency on the SFSR contents in order to
         function correctly
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5ea68e02
    • S
      [PATCH] convert signal handling of NODEFER to act like other Unix boxes. · 69be8f18
      Steven Rostedt 提交于
      It has been reported that the way Linux handles NODEFER for signals is
      not consistent with the way other Unix boxes handle it.  I've written a
      program to test the behavior of how this flag affects signals and had
      several reports from people who ran this on various Unix boxes,
      confirming that Linux seems to be unique on the way this is handled.
      
      The way NODEFER affects signals on other Unix boxes is as follows:
      
      1) If NODEFER is set, other signals in sa_mask are still blocked.
      
      2) If NODEFER is set and the signal is in sa_mask, then the signal is
      still blocked. (Note: this is the behavior of all tested but Linux _and_
      NetBSD 2.0 *).
      
      The way NODEFER affects signals on Linux:
      
      1) If NODEFER is set, other signals are _not_ blocked regardless of
      sa_mask (Even NetBSD doesn't do this).
      
      2) If NODEFER is set and the signal is in sa_mask, then the signal being
      handled is not blocked.
      
      The patch converts signal handling in all current Linux architectures to
      the way most Unix boxes work.
      
      Unix boxes that were tested:  DU4, AIX 5.2, Irix 6.5, NetBSD 2.0, SFU
      3.5 on WinXP, AIX 5.3, Mac OSX, and of course Linux 2.6.13-rcX.
      
      * NetBSD was the only other Unix to behave like Linux on point #2. The
      main concern was brought up by point #1 which even NetBSD isn't like
      Linux.  So with this patch, we leave NetBSD as the lonely one that
      behaves differently here with #2.
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      69be8f18
  15. 25 8月, 2005 1 次提交
  16. 20 8月, 2005 1 次提交
  17. 19 8月, 2005 1 次提交
  18. 10 8月, 2005 1 次提交
    • A
      [NET]: Fix memory leak in sys_{send,recv}msg() w/compat · d64d3873
      Andrew Morton 提交于
      From: Dave Johnson <djohnson+linux-kernel@sw.starentnetworks.com>
      
      sendmsg()/recvmsg() syscalls from o32/n32 apps to a 64bit kernel will
      cause a kernel memory leak if iov_len > UIO_FASTIOV for each syscall!
      
      This is because both sys_sendmsg() and verify_compat_iovec() kmalloc a
      new iovec structure.  Only the one from sys_sendmsg() is free'ed.
      
      I wrote a simple test program to confirm this after identifying the
      problem:
      
      http://davej.org/programs/testsendmsg.c
      
      Note that the below fix will break solaris_sendmsg()/solaris_recvmsg() as
      it also calls verify_compat_iovec() but expects it to malloc internally.
      
      [ I fixed that. -DaveM ]
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d64d3873