1. 30 Mar, 2010 1 commit
    • Tejun Heo's avatar
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo authored
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      The script does the followings.
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
      The conversion was done in the following steps.
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
      6. percpu.h was updated not to include slab.h.
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Guess-its-ok-by: default avatarChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
  2. 08 Mar, 2010 2 commits
  3. 24 Feb, 2010 6 commits
  4. 04 Oct, 2009 1 commit
  5. 16 Oct, 2008 1 commit
  6. 15 Jul, 2008 1 commit
  7. 11 Jul, 2008 1 commit
  8. 20 Jun, 2008 1 commit
  9. 20 May, 2008 1 commit
    • Greg Kroah-Hartman's avatar
      IB: fix race in device_create · 6c06aec2
      Greg Kroah-Hartman authored
      There is a race from when a device is created with device_create() and
      then the drvdata is set with a call to dev_set_drvdata() in which a
      sysfs file could be open, yet the drvdata will be NULL, causing all
      sorts of bad things to happen.
      This patch fixes the problem by using the new function,
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Reviewed-by: default avatarRoland Dreier <rolandd@cisco.com>
      Cc: Sean Hefty <sean.hefty@intel.com>
      Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
  10. 20 Apr, 2008 1 commit
  11. 19 Apr, 2008 1 commit
  12. 25 Jan, 2008 1 commit
    • Roland Dreier's avatar
      IB/umad: Simplify and fix locking · 2fe7e6f7
      Roland Dreier authored
      In addition to being overly complex, the locking in user_mad.c is
      broken: there were multiple reports of deadlocks and lockdep warnings.
      In particular it seems that a single thread may end up trying to take
      the same rwsem for reading more than once, which is explicitly
      forbidden in the comments in <linux/rwsem.h>.
      To solve this, we change the locking to use plain mutexes instead of
      rwsems.  There is one mutex per open file, which protects the contents
      of the struct ib_umad_file, including the array of agents and list of
      queued packets; and there is one mutex per struct ib_umad_port, which
      protects the contents, including the list of open files.  We never
      hold the file mutex across calls to functions like ib_unregister_mad_agent(),
      which can call back into other ib_umad code to queue a packet, and we
      always hold the port mutex as long as we need to make sure that a
      device is not hot-unplugged from under us.
      This even makes things nicer for users of the -rt patch, since we
      remove calls to downgrade_write() (which is not implemented in -rt).
      Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
  13. 10 Oct, 2007 2 commits
    • Roland Dreier's avatar
      IB/umad: Fix bit ordering and 32-on-64 problems on big endian systems · a394f83b
      Roland Dreier authored
      The declaration of struct ib_user_mad_reg_req.method_mask[] exported
      to userspace was an array of __u32, but the kernel internally treated
      it as a bitmap made up of longs.  This makes a difference for 64-bit
      big-endian kernels, where numbering the bits in an array of__u32 gives:
      while numbering the bits in an array of longs gives:
      64-bit userspace can handle this by just treating method_mask[] as an
      array of longs, but 32-bit userspace is really stuck: the meaning of
      the bits in method_mask[] depends on whether the kernel is 32-bit or
      64-bit, and there's no sane way for userspace to know that.
      Fix this by updating <rdma/ib_user_mad.h> to make it clear that
      method_mask[] is an array of longs, and using a compat_ioctl method to
      convert to an array of 64-bit longs to handle the 32-on-64 problem.
      This fixes the interface description to match existing behavior (so
      working binaries continue to work) in almost all situations, and gives
      consistent semantics in the case of 32-bit userspace that can run on
      either a 32-bit or 64-bit kernel, so that the same binary can work for
      both 32-on-32 and 32-on-64 systems.
      Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
    • Roland Dreier's avatar
      IB/umad: Add P_Key index support · 2be8e3ee
      Roland Dreier authored
      Add support for setting the P_Key index of sent MADs and getting the
      P_Key index of received MADs.  This requires a change to the layout of
      the ABI structure struct ib_user_mad_hdr, so to avoid breaking
      compatibility, we default to the old (unchanged) ABI and add a new
      ioctl IB_USER_MAD_ENABLE_PKEY that allows applications that are aware
      of the new ABI to opt into using it.
      We plan on switching to the new ABI by default in a year or so, and
      this patch adds a warning that is printed when an application uses the
      old ABI, to push people towards converting to the new ABI.
      Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
      Reviewed-by: default avatarSean Hefty <sean.hefty@intel.com>
      Reviewed-by: default avatarHal Rosenstock <hal@xsigo.com>
  14. 03 May, 2007 1 commit
    • Jean Delvare's avatar
      PCI: Cleanup the includes of <linux/pci.h> · 6473d160
      Jean Delvare authored
      I noticed that many source files include <linux/pci.h> while they do
      not appear to need it. Here is an attempt to clean it all up.
      In order to find all possibly affected files, I searched for all
      files including <linux/pci.h> but without any other occurence of "pci"
      or "PCI". I removed the include statement from all of these, then I
      compiled an allmodconfig kernel on both i386 and x86_64 and fixed the
      false positives manually.
      My tests covered 66% of the affected files, so there could be false
      positives remaining. Untested files are:
      I would welcome test reports for these files. I am fine with removing
      the untested files from the patch if the general opinion is that these
      changes aren't safe. The tested part would still be nice to have.
      Note that this patch depends on another header fixup patch I submitted
      to LKML yesterday:
        [PATCH] scatterlist.h needs types.h
      Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
      Cc: Badari Pulavarty <pbadari@us.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
  15. 24 Apr, 2007 1 commit
  16. 19 Apr, 2007 1 commit
  17. 12 Feb, 2007 1 commit
  18. 22 Sep, 2006 2 commits
  19. 24 Jul, 2006 1 commit
  20. 30 Mar, 2006 1 commit
  21. 20 Mar, 2006 1 commit
    • Jack Morgenstein's avatar
      IB/umad: Add support for large RMPP transfers · f36e1793
      Jack Morgenstein authored
      Add support for sending and receiving large RMPP transfers.  The old
      code supports transfers only as large as a single contiguous kernel
      memory allocation.  This patch uses linked list of memory buffers when
      sending and receiving data to avoid needing contiguous pages for
      larger transfers.
        Receive side: copy the arriving MADs in chunks instead of coalescing
        to one large buffer in kernel space.
        Send side: split a multipacket MAD buffer to a list of segments,
        (multipacket_list) and send these using a gather list of size 2.
        Also, save pointer to last sent segment, and retrieve requested
        segments by walking list starting at last sent segment. Finally,
        save pointer to last-acked segment.  When retrying, retrieve
        segments for resending relative to this pointer.  When updating last
        ack, start at this pointer.
      Signed-off-by: default avatarJack Morgenstein <jackm@mellanox.co.il>
      Signed-off-by: default avatarSean Hefty <sean.hefty@intel.com>
      Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
  22. 09 Dec, 2005 1 commit
  23. 28 Nov, 2005 1 commit
  24. 18 Nov, 2005 1 commit
    • Roland Dreier's avatar
      IB/umad: make sure write()s have sufficient data · eabc7793
      Roland Dreier authored
      Make sure that userspace passes in enough data when sending a MAD.  We
      always copy at least sizeof (struct ib_user_mad) + IB_MGMT_RMPP_HDR
      bytes from userspace, so anything less is definitely invalid.  Also,
      if the length is less than this limit, it's possible for the second
      copy_from_user() to get a negative length and trigger a BUG().
      Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
  25. 10 Nov, 2005 3 commits
  26. 06 Nov, 2005 1 commit
  27. 03 Nov, 2005 1 commit
  28. 28 Oct, 2005 3 commits