1. 10 9月, 2014 2 次提交
  2. 09 8月, 2014 1 次提交
  3. 10 6月, 2014 1 次提交
  4. 18 12月, 2013 1 次提交
  5. 09 10月, 2013 1 次提交
  6. 19 8月, 2013 2 次提交
    • D
      drm: rip out drm_core_has_MTRR checks · 28185647
      Daniel Vetter 提交于
      The new arch_phys_wc_add/del functions do the right thing both with
      and without MTRR support in the kernel. So we can drop these
      additional checks.
      
      David Herrmann suggest to also kill the DRIVER_USE_MTRR flag since
      it's now unused, which spurred me to do a bit a better audit of the
      affected drivers. David helped a lot in that. Quoting our mail
      discussion:
      
      On Wed, Jul 10, 2013 at 5:41 PM, David Herrmann <dh.herrmann@gmail.com> wrote:
      > On Wed, Jul 10, 2013 at 5:22 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
      >> On Wed, Jul 10, 2013 at 3:51 PM, David Herrmann <dh.herrmann@gmail.com> wrote:
      >>>> -#if __OS_HAS_MTRR
      >>>> -static inline int drm_core_has_MTRR(struct drm_device *dev)
      >>>> -{
      >>>> -       return drm_core_check_feature(dev, DRIVER_USE_MTRR);
      >>>> -}
      >>>> -#else
      >>>> -#define drm_core_has_MTRR(dev) (0)
      >>>> -#endif
      >>>> -
      >>>
      >>> That was the last user of DRIVER_USE_MTRR (apart from drivers setting
      >>> it in .driver_features). Any reason to keep it around?
      >>
      >> Yeah, I guess we could rip things out. Which will also force me to
      >> properly audit drivers for the eventual behaviour change this could
      >> entail (in case there's an x86 driver which did not ask for an mtrr,
      >> but iirc there isn't).
      >
      > david@david-mb ~/dev/kernel/linux $ for i in drivers/gpu/drm/* ; do if
      > test -d "$i" ; then if ! grep -q USE_MTRR -r $i ; then echo $i ; fi ;
      > fi ; done
      > drivers/gpu/drm/exynos
      > drivers/gpu/drm/gma500
      > drivers/gpu/drm/i2c
      > drivers/gpu/drm/nouveau
      > drivers/gpu/drm/omapdrm
      > drivers/gpu/drm/qxl
      > drivers/gpu/drm/rcar-du
      > drivers/gpu/drm/shmobile
      > drivers/gpu/drm/tilcdc
      > drivers/gpu/drm/ttm
      > drivers/gpu/drm/udl
      > drivers/gpu/drm/vmwgfx
      > david@david-mb ~/dev/kernel/linux $
      >
      > So for x86 gma500,nouveau,qxl,udl,vmwgfx don't set DRIVER_USE_MTRR.
      > But I cannot tell whether they break if we call arch_phys_wc_add/del,
      > anyway. At least nouveau seemed to work here, but it doesn't use AGP
      > or drm_bufs, I guess.
      
      Cool, thanks a lot for stitching together the list of drivers to look
      at. So for real KMS drivers it's the drives responsibility to add an
      mtrr if it needs one. nouvea, radeon, mgag200, i915 and vmwgfx do that
      already. Somehow the savage driver also ends up doing that, I have no
      idea why.
      
      Note that gma500 as a pure KMS driver doesn't need MTRR setup since
      the platforms that it supports all support PAT. So no MTRRs needed to
      get wc iomappings.
      
      The mtrr support in the drm core is all for legacy mappings of garts,
      framebuffers and registers. All legacy drivers set the USE_MTRR flag,
      so we're good there.
      
      All in all I think we can really just ditch this
      
      /endquote
      
      v2: Also kill DRIVER_USE_MTRR as suggested by David Herrmann
      
      v3: Rebase on top of David Herrmann's agp setup/cleanup changes.
      
      Cc: David Herrmann <dh.herrmann@gmail.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Acked-by: NAndy Lutomirski <luto@amacapital.net>
      Reviewed-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      28185647
    • D
      drm: remove FASYNC support · b0e898ac
      Daniel Vetter 提交于
      So I've stumbled over drm_fasync and wondered what it does. Digging
      that up is quite a story.
      
      First I've had to read up on what this does and ended up being rather
      bewildered why peopled loved signals so much back in the days that
      they've created SIGIO just for that ...
      
      Then I wondered how this ever works, and what that strange "No-op."
      comment right above it should mean. After all calling the core fasync
      helper is pretty obviously not a noop. After reading through the
      kernels FASYNC implementation I've noticed that signals are only sent
      out to the processes attached with FASYNC by calling kill_fasync.
      
      No merged drm driver has ever done that.
      
      After more digging I've found out that the only driver that ever used
      this is the so called GAMMA driver. I've frankly never heard of such a
      gpu brand ever before. Now FASYNC seems to not have been the only bad
      thing with that driver, since Dave Airlie removed it from the drm
      driver with prejudice:
      
      commit 1430163b4bbf7b00367ea1066c1c5fe85dbeefed
      Author: Dave Airlie <airlied@linux.ie>
      Date:   Sun Aug 29 12:04:35 2004 +0000
      
          Drop GAMMA DRM from a great height ...
      
      Long story short, the drm fasync support seems to be doing absolutely
      nothing. And the only user of it was never merged into the upstream
      kernel. And we don't need any fops->fasync callback since the fcntl
      implementation in the kernel already implements the noop case
      correctly.
      
      So stop this particular cargo-cult and rip it all out.
      
      v2: Kill drm_fasync assignments in rcar (newly added) and imx drivers
      (somehow I've missed that one in staging). Also drop the reference in
      the drm DocBook. ARM compile-fail reported by Rob Clark.
      
      v3: Move the removal of dev->buf_asnyc assignment in drm_setup to this
      patch here.
      
      v4: Actually git add ... tsk.
      
      Cc: Dave Airlie <airlied@linux.ie>
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Cc: Rob Clark <robdclark@gmail.com>
      Acked-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      b0e898ac
  7. 07 8月, 2013 1 次提交
  8. 29 6月, 2013 1 次提交
  9. 03 10月, 2012 2 次提交
  10. 06 9月, 2012 1 次提交
    • K
      drm: use drm_compat_ioctl for 32-bit apps · 804d74ab
      Keith Packard 提交于
      Most of the DRM drivers appear to be missing the .compat_ioctl file
      operation entry necessary for 32-bit application compatibility.
      
      This patch  uses drm_compat_ioctl for all drivers which don't have
      their own, and which are using drm_ioctl for .unlocked_ioctl.
      
      This leaves drivers/gpu/drm/psb/psb_drv.c unchanged; it has a custom
      .unlocked_ioctl and will presumably need a custom .compat_ioctl as
      well.
      Signed-off-by: NKeith Packard <keithp@keithp.com>
      Signed-off-by: NDave Airlie <airlied@gmail.com>
      804d74ab
  11. 20 7月, 2012 2 次提交
    • D
      drm: kill dma queue support · a344a7e7
      Daniel Vetter 提交于
      Absolutely unused. All the values are only ever initialized and
      then used at most in some debug printout functions.
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      a344a7e7
    • D
      Revert "Revert "drm/i810: cleanup reclaim_buffers"" · d5346b37
      Daniel Vetter 提交于
      This reverts commit 6e877b57,
      reinstating the original commit:
      
      commit 87499ffd
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Tue Oct 25 23:51:24 2011 +0200
      
          drm/i810: cleanup reclaim_buffers
      
          My dear old i815 always hits the deadlocked on reclaim_buffers
          warning. Switch over to the idlelock duct-tape on hope that
          works better. I've fired up my i815 and now closing glxgears doesn't
          take 5 seconds anymore. \o/
      
      The original problem with that was that I've moved it ahead in the
      series so that it could be included despite some patches not being
      ready quite yet. The little problem is that this patch required some
      of the previous rework to work correctly.
      
      Now that everything is in the right order again, this actually works
      on my i810 and does speed up closing gl apps as the original commit
      claimed. Without hanging the machine, as the revert says.
      Signed-Off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      d5346b37
  12. 31 5月, 2012 1 次提交
  13. 21 4月, 2012 3 次提交
  14. 05 3月, 2012 1 次提交
  15. 17 2月, 2012 1 次提交
    • D
      drm: move pci bus master enable into driver. · 466e69b8
      Dave Airlie 提交于
      The current enabling of bus mastering in the drm midlayer allows a large
      race condition under kexec. When a kexec'ed kernel re-enables bus mastering
      for the GPU, previously setup dma blocks may cause writes to random pieces
      of memory. On radeon the writeback mechanism can cause these sorts of issues.
      
      This patch doesn't fix the problem, but it moves the bus master enable under
      the individual drivers control so they can move enabling it until later in
      their load cycle and close the race.
      
      Fix for radeon kms driver will be in a follow-up patch.
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      466e69b8
  16. 30 1月, 2012 1 次提交
  17. 23 12月, 2011 2 次提交
    • D
      drm/i810: don't acces hw regs in lastclose · 40c34d04
      Daniel Vetter 提交于
      i810 uses a userspace provided mmio map using the drm core map
      infrastructure. By the time we reach lastclose, this is all gone
      and our mmio_map pointer points at freed memory. Depending upon
      luck that still works, most often it just oopses.
      
      Aside: drm maps aren't refcounted, so userspace can essentially oops
      the kernel any time it wants to. Who cares.
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      40c34d04
    • D
      drm/i810: cleanup reclaim_buffers · 87499ffd
      Daniel Vetter 提交于
      My dear old i815 always hits the deadlocked on reclaim_buffers
      warning. Switch over to the idlelock duct-tape on hope that
      works better. I've fired up my i815 and now closing glxgears doesn't
      take 5 seconds anymore. \o/
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      87499ffd
  18. 11 11月, 2011 1 次提交
    • A
      drm: Make the per-driver file_operations struct const · e08e96de
      Arjan van de Ven 提交于
      From fdf1fdebaa00f81de18c227f32f8074c8b352d50 Mon Sep 17 00:00:00 2001
      From: Arjan van de Ven <arjan@linux.intel.com>
      Date: Sun, 30 Oct 2011 19:06:07 -0700
      Subject: [PATCH] drm: Make the per-driver file_operations struct const
      
      The DRM layer keeps a copy of struct file_operations inside its
      big driver struct... which prevents it from being consistent and static.
      For consistency (and the general security objective of having such things
      static), it's desirable to get this fixed.
      
      This patch splits out the file_operations field to its own struct,
      which is then "static const", and just stick a pointer to this into
      the driver struct, making it more consistent with how the rest of the
      kernel does this.
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      e08e96de
  19. 01 11月, 2011 1 次提交
  20. 07 2月, 2011 2 次提交
    • D
      drm: rework PCI/platform driver interface. · 8410ea3b
      Dave Airlie 提交于
      This abstracts the pci/platform interface out a step further,
      we can go further but this is far enough for now to allow USB
      to be plugged in.
      
      The drivers now just call the init code directly for their
      device type.
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      8410ea3b
    • A
      drm/i810: remove the BKL · 1f692a14
      Arnd Bergmann 提交于
      SMP i810 systems were practically nonexistent and the configuration
      was not officially supported by Intel at the time when Pentium-III
      was common.
      
      With this change, it is still possible to build a distribution kernel
      that has support for SMP and includes the i810 driver without the BKL.
      As a precaution, check for the theoretical SMP case at run time and
      refuse to load the driver.
      
      We also need to disable CONFIG_PREEMPT builds for this driver.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: dri-devel@lists.freedesktop.org
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      1f692a14
  21. 15 10月, 2010 1 次提交
    • A
      llseek: automatically add .llseek fop · 6038f373
      Arnd Bergmann 提交于
      All file_operations should get a .llseek operation so we can make
      nonseekable_open the default for future file operations without a
      .llseek pointer.
      
      The three cases that we can automatically detect are no_llseek, seq_lseek
      and default_llseek. For cases where we can we can automatically prove that
      the file offset is always ignored, we use noop_llseek, which maintains
      the current behavior of not returning an error from a seek.
      
      New drivers should normally not use noop_llseek but instead use no_llseek
      and call nonseekable_open at open time.  Existing drivers can be converted
      to do the same when the maintainer knows for certain that no user code
      relies on calling seek on the device file.
      
      The generated code is often incorrectly indented and right now contains
      comments that clarify for each added line why a specific variant was
      chosen. In the version that gets submitted upstream, the comments will
      be gone and I will manually fix the indentation, because there does not
      seem to be a way to do that using coccinelle.
      
      Some amount of new code is currently sitting in linux-next that should get
      the same modifications, which I will do at the end of the merge window.
      
      Many thanks to Julia Lawall for helping me learn to write a semantic
      patch that does all this.
      
      ===== begin semantic patch =====
      // This adds an llseek= method to all file operations,
      // as a preparation for making no_llseek the default.
      //
      // The rules are
      // - use no_llseek explicitly if we do nonseekable_open
      // - use seq_lseek for sequential files
      // - use default_llseek if we know we access f_pos
      // - use noop_llseek if we know we don't access f_pos,
      //   but we still want to allow users to call lseek
      //
      @ open1 exists @
      identifier nested_open;
      @@
      nested_open(...)
      {
      <+...
      nonseekable_open(...)
      ...+>
      }
      
      @ open exists@
      identifier open_f;
      identifier i, f;
      identifier open1.nested_open;
      @@
      int open_f(struct inode *i, struct file *f)
      {
      <+...
      (
      nonseekable_open(...)
      |
      nested_open(...)
      )
      ...+>
      }
      
      @ read disable optional_qualifier exists @
      identifier read_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      expression E;
      identifier func;
      @@
      ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
      {
      <+...
      (
         *off = E
      |
         *off += E
      |
         func(..., off, ...)
      |
         E = *off
      )
      ...+>
      }
      
      @ read_no_fpos disable optional_qualifier exists @
      identifier read_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      @@
      ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
      {
      ... when != off
      }
      
      @ write @
      identifier write_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      expression E;
      identifier func;
      @@
      ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
      {
      <+...
      (
        *off = E
      |
        *off += E
      |
        func(..., off, ...)
      |
        E = *off
      )
      ...+>
      }
      
      @ write_no_fpos @
      identifier write_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      @@
      ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
      {
      ... when != off
      }
      
      @ fops0 @
      identifier fops;
      @@
      struct file_operations fops = {
       ...
      };
      
      @ has_llseek depends on fops0 @
      identifier fops0.fops;
      identifier llseek_f;
      @@
      struct file_operations fops = {
      ...
       .llseek = llseek_f,
      ...
      };
      
      @ has_read depends on fops0 @
      identifier fops0.fops;
      identifier read_f;
      @@
      struct file_operations fops = {
      ...
       .read = read_f,
      ...
      };
      
      @ has_write depends on fops0 @
      identifier fops0.fops;
      identifier write_f;
      @@
      struct file_operations fops = {
      ...
       .write = write_f,
      ...
      };
      
      @ has_open depends on fops0 @
      identifier fops0.fops;
      identifier open_f;
      @@
      struct file_operations fops = {
      ...
       .open = open_f,
      ...
      };
      
      // use no_llseek if we call nonseekable_open
      ////////////////////////////////////////////
      @ nonseekable1 depends on !has_llseek && has_open @
      identifier fops0.fops;
      identifier nso ~= "nonseekable_open";
      @@
      struct file_operations fops = {
      ...  .open = nso, ...
      +.llseek = no_llseek, /* nonseekable */
      };
      
      @ nonseekable2 depends on !has_llseek @
      identifier fops0.fops;
      identifier open.open_f;
      @@
      struct file_operations fops = {
      ...  .open = open_f, ...
      +.llseek = no_llseek, /* open uses nonseekable */
      };
      
      // use seq_lseek for sequential files
      /////////////////////////////////////
      @ seq depends on !has_llseek @
      identifier fops0.fops;
      identifier sr ~= "seq_read";
      @@
      struct file_operations fops = {
      ...  .read = sr, ...
      +.llseek = seq_lseek, /* we have seq_read */
      };
      
      // use default_llseek if there is a readdir
      ///////////////////////////////////////////
      @ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier readdir_e;
      @@
      // any other fop is used that changes pos
      struct file_operations fops = {
      ... .readdir = readdir_e, ...
      +.llseek = default_llseek, /* readdir is present */
      };
      
      // use default_llseek if at least one of read/write touches f_pos
      /////////////////////////////////////////////////////////////////
      @ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read.read_f;
      @@
      // read fops use offset
      struct file_operations fops = {
      ... .read = read_f, ...
      +.llseek = default_llseek, /* read accesses f_pos */
      };
      
      @ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier write.write_f;
      @@
      // write fops use offset
      struct file_operations fops = {
      ... .write = write_f, ...
      +	.llseek = default_llseek, /* write accesses f_pos */
      };
      
      // Use noop_llseek if neither read nor write accesses f_pos
      ///////////////////////////////////////////////////////////
      
      @ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read_no_fpos.read_f;
      identifier write_no_fpos.write_f;
      @@
      // write fops use offset
      struct file_operations fops = {
      ...
       .write = write_f,
       .read = read_f,
      ...
      +.llseek = noop_llseek, /* read and write both use no f_pos */
      };
      
      @ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier write_no_fpos.write_f;
      @@
      struct file_operations fops = {
      ... .write = write_f, ...
      +.llseek = noop_llseek, /* write uses no f_pos */
      };
      
      @ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read_no_fpos.read_f;
      @@
      struct file_operations fops = {
      ... .read = read_f, ...
      +.llseek = noop_llseek, /* read uses no f_pos */
      };
      
      @ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      @@
      struct file_operations fops = {
      ...
      +.llseek = noop_llseek, /* no read or write fn */
      };
      ===== End semantic patch =====
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Julia Lawall <julia@diku.dk>
      Cc: Christoph Hellwig <hch@infradead.org>
      6038f373
  22. 30 9月, 2010 1 次提交
  23. 16 9月, 2010 1 次提交
    • A
      drm: use noop_llseek · dc880abe
      Arnd Bergmann 提交于
      The drm device drivers currently allow seeking on the
      character device but never care about the actual
      file position.
      
      When we change the default llseek operation to be
      no_llseek, calling llseek on a drm device would
      return an error condition, which is an API change.
      
      Explicitly setting noop_llseek lets us keep the
      current API.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: David Airlie <airlied@linux.ie>
      Cc: dri-devel@lists.freedesktop.org
      dc880abe
  24. 30 8月, 2010 2 次提交
  25. 17 8月, 2010 1 次提交
    • D
      drm: block userspace under allocating buffer and having drivers overwrite it (v2) · 1b2f1489
      Dave Airlie 提交于
      With the current screwed but its ABI, ioctls for the drm, Linus pointed out that we could allow userspace to specify the allocation size, but we pass it to the driver which then uses it blindly to store a struct. Now if userspace specifies the allocation size as smaller than the driver needs, the driver can possibly overwrite memory.
      
      This patch restructures the driver ioctls so we store the structure size we are expecting, and make sure we allocate at least that size. The copy from/to userspace are still restricted to the size the user specifies, this allows ioctl structs to grow on both sides of the equation.
      
      Up until now we didn't really use the DRM_IOCTL defines in the kernel, so this cleans them up and adds them for nouveau.
      
      v2:
      fix nouveau pushbuf arg (thanks to Ben for pointing it out)
      Reported-by: NLinus Torvalds <torvalds@linuxfoundation.org>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      1b2f1489
  26. 05 8月, 2010 1 次提交
    • A
      drm: kill BKL from common code · 58374713
      Arnd Bergmann 提交于
      This restricts the use of the big kernel lock to the i830 and i810
      device drivers. The three remaining users in common code (open, ioctl
      and release) get converted to a new mutex, the drm_global_mutex,
      making the locking stricter than the big kernel lock.
      
      This may have a performance impact, but only in those cases that
      currently don't use DRM_UNLOCKED flag in the ioctl list and would
      benefit from that anyway.
      
      The reason why i810 and i830 cannot use drm_global_mutex in their
      mmap functions is a lock-order inversion problem between the current
      use of the BKL and mmap_sem in these drivers. Since the BKL has
      release-on-sleep semantics, it's harmless but it would cause trouble
      if we replace the BKL with a mutex.
      
      Instead, these drivers get their own ioctl wrappers that take the
      BKL around every ioctl call and then set their own handlers as
      DRM_UNLOCKED.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: David Airlie <airlied@linux.ie>
      Cc: dri-devel@lists.freedesktop.org
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      58374713
  27. 02 8月, 2010 1 次提交
  28. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      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.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      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
        file.
      
      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
         files.
      
      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
         necessary.
      
      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: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  29. 18 12月, 2009 1 次提交
    • A
      drm: convert drm_ioctl to unlocked_ioctl · ed8b6704
      Arnd Bergmann 提交于
      drm_ioctl is called with the Big Kernel Lock held,
      which shows up very high in statistics on vfs_ioctl.
      
      Moving the lock into the drm_ioctl function itself
      makes sure we blame the right subsystem and it gets
      us one step closer to eliminating the locked version
      of fops->ioctl.
      
      Since drm_ioctl does not require the lock itself,
      we only need to hold it while calling the specific
      handler. The 32 bit conversion handlers do not
      interact with any other code, so they don't need
      the BKL here either and can just call drm_ioctl.
      
      As a bonus, this cleans up all the other users
      of drm_ioctl which now no longer have to find
      the inode or call lock_kernel.
      
      [airlied: squashed the non-driver bits
      of the second patch in here, this provides
      the flag for drivers to use to select unlocked
      ioctls - but doesn't modify any drivers].
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: David Airlie <airlied@linux.ie>
      Cc: dri-devel@lists.sourceforge.net
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      ed8b6704
  30. 19 6月, 2009 1 次提交
  31. 13 3月, 2009 1 次提交
    • B
      drm: Split drm_map and drm_local_map · f77d390c
      Benjamin Herrenschmidt 提交于
      Once upon a time, the DRM made the distinction between the drm_map
      data structure exchanged with user space and the drm_local_map used
      in the kernel.
      
      For some reasons, while the BSD port still has that "feature", the
      linux part abused drm_map for kernel internal usage as the local
      map only existed as a typedef of the struct drm_map.
      
      This patch fixes it by declaring struct drm_local_map separately
      (though its content is currently identical to the userspace variant),
      and changing the kernel code to only use that, except when it's a
      user<->kernel interface (ie. ioctl).
      
      This allows subsequent changes to the in-kernel format
      
      I've also replaced the use of drm_local_map_t with struct drm_local_map
      in a couple of places. Mostly by accident but they are the same (the
      former is a typedef of the later) and I have some remote plans and
      half finished patch to completely kill the drm_local_map_t typedef
      so I left those bits in.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Acked-by: NEric Anholt <eric@anholt.net>
      Signed-off-by: NDave Airlie <airlied@linux.ie>
      f77d390c