1. 10 5月, 2013 1 次提交
    • C
      drm: Use names of ioctls in debug traces · b9434d0f
      Chris Cummins 提交于
      The intention here is to make the output of dmesg with full verbosity a
      bit easier for a human to parse. This commit transforms:
      
      [drm:drm_ioctl], pid=699, cmd=0x6458, nr=0x58, dev 0xe200, auth=1
      [drm:drm_ioctl], pid=699, cmd=0xc010645b, nr=0x5b, dev 0xe200, auth=1
      [drm:drm_ioctl], pid=699, cmd=0xc0106461, nr=0x61, dev 0xe200, auth=1
      [drm:drm_ioctl], pid=699, cmd=0xc01c64ae, nr=0xae, dev 0xe200, auth=1
      [drm:drm_mode_addfb], [FB:32]
      [drm:drm_ioctl], pid=699, cmd=0xc0106464, nr=0x64, dev 0xe200, auth=1
      [drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a00000
      [drm:drm_ioctl], pid=699, cmd=0x400c645f, nr=0x5f, dev 0xe200, auth=1
      [drm:drm_ioctl], pid=699, cmd=0xc00464af, nr=0xaf, dev 0xe200, auth=1
      [drm:intel_crtc_set_config], [CRTC:3] [NOFB]
      
      into:
      
      [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_THROTTLE
      [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_CREATE
      [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_TILING
      [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, IOCTL_MODE_ADDFB
      [drm:drm_mode_addfb], [FB:32]
      [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_MMAP_GTT
      [drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a00000
      [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_DOMAIN
      [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, DRM_IOCTL_MODE_RMFB
      [drm:intel_crtc_set_config], [CRTC:3] [NOFB]
      
      v2: drm_ioctls is now a constant (Ville Syrjälä)
      Signed-off-by: NChris Cummins <christopher.e.cummins@intel.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      b9434d0f
  2. 30 4月, 2013 2 次提交
  3. 16 4月, 2013 1 次提交
  4. 28 2月, 2013 1 次提交
  5. 03 10月, 2012 1 次提交
  6. 02 10月, 2012 1 次提交
    • R
      drm: change ioctl permissions · 2216c9e7
      Rob Clark 提交于
      Previously read-only KMS ioctls had some somewhat inconsistent settings
      regarding whether mastership was required.  For example, GETRESOURCES
      did not require master, but GETPLANERESOURCES, GETPROPERTY, etc. did.
      
      At least for debugging, it is nice to be able to use modetest to dump
      property values while another process is master, and there seems to
      be no harm in allowing read-only access to the KMS state to other
      processes.
      Signed-off-by: NRob Clark <rob@ti.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      2216c9e7
  7. 13 9月, 2012 1 次提交
    • D
      drm: make buffer management work without DRM_MASTER · fb30edf5
      David Herrmann 提交于
      DRM users should be able to create/destroy/manage dumb- and frame-buffers
      without DRM_MASTER. These ioctls do not affect modesetting so there is no
      reason to protect them by drm-master. Particularly, destroying buffers
      should always be possible as a client has only access to buffers that they
      created. Hence, there is no reason to prevent a client from destroying the
      buffers, considering a simple close() would destroy them, anyway.
      
      Furthermore, a display-server currently cannot shutdown correctly if it
      does not have DRM_MASTER. If some other display-server becomes active (or
      the kernel console), then the background display-server is unable to
      destroy its buffers.
      Under special curcumstances (like monitor reconfiguration) this might even
      happen during runtime.
      Signed-off-by: NDavid Herrmann <dh.herrmann@googlemail.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      fb30edf5
  8. 20 7月, 2012 1 次提交
  9. 21 6月, 2012 1 次提交
  10. 17 5月, 2012 1 次提交
  11. 30 3月, 2012 1 次提交
  12. 15 3月, 2012 1 次提交
    • D
      drm: add core support for unplugging a device (v2) · 2c07a21d
      Dave Airlie 提交于
      Two parts to this, one is simple unplug from sysfs for the device node.
      
      The second adds an unplugged state, if we have device opens, we
      just set the unplugged state and return, if we have no device
      opens we drop the drm device.
      
      If after a lastclose we discover we are unplugged we then
      drop the drm device.
      
      v2: use an atomic for unplugged and wrap it for users,
      add checks on open + mmap + ioctl entry points.
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      2c07a21d
  13. 03 2月, 2012 1 次提交
    • M
      drm: remove master fd restriction on mode setting getters · a14b1b42
      Mandeep Singh Baines 提交于
      Its useful to be able to call the mode setting getter ioctls.
      Not requiring master fd, enables writing a simple program which
      can query the state of the video system.
      
      Since these ioctls are only "getters" there is no security or
      synchronization issues which would require master fd. Opening
      an new fd is already protected by the file permissions on the
      device file.
      Signed-off-by: NMandeep Singh Baines <msb@chromium.org>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Ilija Hadzic <ihadzic@research.bell-labs.com>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Cc: Stephane Marchesin <marcheu@chromium.org>
      Cc: dri-devel@lists.freedesktop.org
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      a14b1b42
  14. 05 1月, 2012 2 次提交
    • I
      drm: make DRM_UNLOCKED ioctls with their own mutex · 09b4ea47
      Ilija Hadzic 提交于
      drm_getclient, drm_getstats and drm_getmap (with a few minor
      adjustments) do not need global mutex, so fix that and
      make the said ioctls DRM_UNLOCKED. Details:
      
        drm_getclient: the only thing that should be protected here
        is dev->filelist and that is already protected everywhere with
        dev->struct_mutex.
      
        drm_getstats: there is no need for any mutex here because the
        loop runs through quasi-static (set at load time only)
        data, and the actual count access is done with atomic_read()
      
        drm_getmap already uses dev->struct_mutex to protect
        dev->maplist, which also used to protect the same structure
        everywhere else except at three places:
        * drm_getsarea, which doesn't grab *any* mutex before
          touching dev->maplist (so no drm_global_mutex doesn't help
          here either; different issue for a different patch).
          However, drivers seem to call it only at
          initialization time so it probably doesn't matter
        * drm_master_destroy, which is called from drm_master_put,
          which in turn is protected with dev->struct_mutex
          everywhere else in drm module, so we are good here too.
        * drm_getsareactx, which releases the dev->struct_mutex
          too early, but this patch includes the fix for that.
      
      v2: * incorporate comments received from Daniel Vetter
          * include the (long) explanation above to make it clear what
            we are doing (and why), also at Daniel Vetter's request
          * tighten up mutex grab/release locations to only
            encompass real critical sections, rather than some
            random code around them
      Signed-off-by: NIlija Hadzic <ihadzic@research.bell-labs.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      09b4ea47
    • I
      drm: no need to hold global mutex for static data · 53fead96
      Ilija Hadzic 提交于
      drm_getcap and drm_version ioctls only reads static data,
      there is no need to protect them with drm_global_mutex,
      so make them DRM_UNLOCKED
      Signed-off-by: NIlija Hadzic <ihadzic@research.bell-labs.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      53fead96
  15. 16 11月, 2011 2 次提交
  16. 11 11月, 2011 1 次提交
    • I
      drm: do not sleep on vblank while holding a mutex · 8f4ff2b0
      Ilija Hadzic 提交于
      drm_wait_vblank must be DRM_UNLOCKED because otherwise it
      will grab the drm_global_mutex and then go to sleep until the vblank
      event it is waiting for. That can wreck havoc in the windowing system
      because if one process issues this ioctl, it will block all other
      processes for the duration of all vblanks between the current and the
      one it is waiting for. In some cases it can block the entire windowing
      system.
      
      v2: incorporate comments received from Daniel Vetter and
          Michel Daenzer.
      
      v3/v4: after a lengty discussion with Daniel Vetter, it was concluded
             that the only thing not yet protected with locks and atomic
             ops is the write to dev->last_vblank_wait. It's only used in a
             debug file in proc, and the current code already employs no
             correct locking: the proc file only takes dev->struct_mutex,
             whereas drm_wait_vblank implicitly took the drm_global_mutex.
             Given all this, it's not worth bothering to try to fix
             the locks at this time.
      Signed-off-by: NIlija Hadzic <ihadzic@research.bell-labs.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      8f4ff2b0
  17. 01 11月, 2011 1 次提交
  18. 19 10月, 2011 1 次提交
  19. 04 3月, 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
    • D
      drm: dumb scanout create/mmap for intel/radeon (v3) · ff72145b
      Dave Airlie 提交于
      This is just an idea that might or might not be a good idea,
      it basically adds two ioctls to create a dumb and map a dumb buffer
      suitable for scanout. The handle can be passed to the KMS ioctls to create
      a framebuffer.
      
      It looks to me like it would be useful in the following cases:
      a) in development drivers - we can always provide a shadowfb fallback.
      b) libkms users - we can clean up libkms a lot and avoid linking
      to libdrm_*.
      c) plymouth via libkms is a lot easier.
      
      Userspace bits would be just calls + mmaps. We could probably
      mark these handles somehow as not being suitable for acceleartion
      so as top stop people who are dumber than dumb.
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      ff72145b
  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 8月, 2010 2 次提交
  23. 17 8月, 2010 2 次提交
    • 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
    • D
      drm: stop information leak of old kernel stack. · b9f0aee8
      Dave Airlie 提交于
      non-critical issue, CVE-2010-2803
      
      Userspace controls the amount of memory to be allocate, so it can
      get the ioctl to allocate more memory than the kernel uses, and get
      access to kernel stack. This can only be done for processes authenticated
      to the X server for DRI access, and if the user has DRI access.
      
      Fix is to just memset the data to 0 if the user doesn't copy into
      it in the first place.
      Reported-by: NKees Cook <kees@ubuntu.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      b9f0aee8
  24. 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
  25. 04 8月, 2010 1 次提交
  26. 02 8月, 2010 1 次提交
    • C
      drm: Free the idr layers before calling idr_destroy() · ddd3d069
      Chris Wilson 提交于
      /* A typical clean-up sequence for objects stored in an idr tree, will
       * use idr_for_each() to free all objects, if necessary, then
       * idr_remove_all() to remove all ids, and idr_destroy() to free
       * up the cached idr_layers.
       */
      
      We were missing the vital idr_rmove_all() step and so were leaking
      the used layers for every dri client:
      
      unreferenced object 0xf32133c0 (size 148):
        comm "plymouthd", pid 131, jiffies 4294678490 (age 2308.030s)
        hex dump (first 32 bytes):
          04 00 00 00 00 00 00 00 00 00 00 00 00 40 19 f3  .............@..
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<c04e5657>] create_object+0x124/0x1f1
          [<c07cf100>] kmemleak_alloc+0x4c/0x90
          [<c04db6a9>] kmem_cache_alloc+0xee/0x13c
          [<c05c3d25>] idr_pre_get+0x24/0x61
          [<f8315c9c>] drm_gem_handle_create+0x27/0x7f [drm]
          [<f89925b2>] i915_gem_create_ioctl+0x4f/0x71 [i915]
          [<f83148ac>] drm_ioctl+0x272/0x356 [drm]
          [<c04f27c4>] vfs_ioctl+0x33/0x91
          [<c04f31cf>] do_vfs_ioctl+0x46b/0x496
          [<c04f3240>] sys_ioctl+0x46/0x66
          [<c040325f>] sysenter_do_call+0x12/0x38
          [<ffffffff>] 0xffffffff
      
      Fixes https://bugzilla.kernel.org/show_bug.cgi?id=15803Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      ddd3d069
  27. 01 6月, 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. 11 2月, 2010 1 次提交
  30. 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
  31. 04 12月, 2009 1 次提交
    • J
      drm: Add dirty ioctl and property · 884840aa
      Jakob Bornecrantz 提交于
      This commit adds a ioctl and property to allow userspace
      to notify the kernel that a framebuffer has changed. Instead
      of snooping the command stream this allows finer grained
      tracking of which areas have changed.
      
      The primary user for this functionality is virtual hardware
      like the vmware svga device, but also Xen hardware likes to
      be notify. There is also real hardware like DisplayLink and
      DisplayPort that might take advantage of this ioctl.
      Signed-off-by: NJakob Bornecrantz <jakob@vmware.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      884840aa
  32. 18 11月, 2009 3 次提交