1. 12 8月, 2010 1 次提交
    • C
      drm: Remove count_lock for calling lastclose() after 58474713 (v2) · 1a72d65d
      Chris Wilson 提交于
      When removing of the BKL the locking around lastclose() was rearranged
      and resulted in the holding of the open_count spinlock over the call
      into drm_lastclose(). The drivers were not ready for this path to be
      atomic - it may indeed involve long waits to release old objects and
      cleanup the GPU - and so we ended up scheduling whilst atomic.
      
      [   54.625598] BUG: scheduling while atomic: X/3546/0x00000002
      [   54.625600] Modules linked in: sco bridge stp llc input_polldev rfcomm bnep l2cap crc16 sch_sfq ipv6 md_mod acpi_cpufreq mperf cryptd aes_x86_64 aes_generic xts gf128mul dm_crypt dm_mod btusb bluetooth usbhid hid zaurus cdc_ether usbnet mii cdc_wdm cdc_acm uvcvideo videodev v4l1_compat v4l2_compat_ioctl32 snd_hda_codec_conexant arc4 pcmcia ecb snd_hda_intel joydev sdhci_pci sdhci snd_hda_codec tpm_tis firewire_ohci mmc_core e1000e uhci_hcd thinkpad_acpi nvram yenta_socket pcmcia_rsrc pcmcia_core tpm wmi sr_mod firewire_core iwlagn ehci_hcd snd_hwdep snd_pcm usbcore tpm_bios thermal led_class snd_timer iwlcore snd soundcore ac snd_page_alloc pcspkr psmouse serio_raw battery sg mac80211 evdev cfg80211 i2c_i801 iTCO_wdt iTCO_vendor_support cdrom processor crc_itu_t rfkill xfs exportfs sd_mod crc_t10dif ahci libahci libata scsi_mod [last unloaded: scsi_wait_scan]
      [   54.625663] Pid: 3546, comm: X Not tainted 2.6.35-04771-g17879857 #301
      [   54.625665] Call Trace:
      [   54.625671]  [<ffffffff8102d599>] __schedule_bug+0x57/0x5c
      [   54.625675]  [<ffffffff81384141>] schedule+0xe5/0x832
      [   54.625679]  [<ffffffff81163e77>] ? put_dec+0x20/0x3c
      [   54.625682]  [<ffffffff81384dd4>] schedule_timeout+0x275/0x29f
      [   54.625686]  [<ffffffff810455e1>] ? process_timeout+0x0/0xb
      [   54.625688]  [<ffffffff81384e17>] schedule_timeout_uninterruptible+0x19/0x1b
      [   54.625691]  [<ffffffff81045893>] msleep+0x16/0x1d
      [   54.625695]  [<ffffffff812a2e53>] i9xx_crtc_dpms+0x273/0x2ae
      [   54.625698]  [<ffffffff812a18be>] intel_crtc_dpms+0x28/0xe7
      [   54.625702]  [<ffffffff811ec0fa>] drm_helper_disable_unused_functions+0xf0/0x118
      [   54.625705]  [<ffffffff811ecde3>] drm_crtc_helper_set_config+0x644/0x7c8
      [   54.625708]  [<ffffffff811f12dd>] ? drm_copy_field+0x40/0x50
      [   54.625711]  [<ffffffff811ebca2>] drm_fb_helper_force_kernel_mode+0x3e/0x85
      [   54.625713]  [<ffffffff811ebcf2>] drm_fb_helper_restore+0x9/0x24
      [   54.625717]  [<ffffffff81290a41>] i915_driver_lastclose+0x2b/0x5c
      [   54.625720]  [<ffffffff811f14a7>] drm_lastclose+0x44/0x2ad
      [   54.625722]  [<ffffffff811f1ed2>] drm_release+0x5c6/0x609
      [   54.625726]  [<ffffffff810d1275>] fput+0x109/0x1c7
      [   54.625728]  [<ffffffff810ce5e4>] filp_close+0x61/0x6b
      [   54.625731]  [<ffffffff810ce680>] sys_close+0x92/0xd4
      [   54.625734]  [<ffffffff81002a2b>] system_call_fastpath+0x16/0x1b
      
      v2: The spinlock is actually superfluous as access to open_count is
      entirely serialised by drm_global_mutex and so can be dropped. The
      count_lock spinlock instead appears to be used to protect access to
      dev->buf_alloc and dev->buf_use.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      1a72d65d
  2. 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
  3. 18 5月, 2010 1 次提交
  4. 31 3月, 2010 1 次提交
    • C
      drm: Return ENODEV if the inode mapping changes · da584058
      Chris Wilson 提交于
      Replace a BUG_ON with an error code in the event that the inode mapping
      changes between calls to drm_open. This may happen for instance if udev
      is loaded subsequent to the original opening of the device:
      
      [  644.291870] kernel BUG at drivers/gpu/drm/drm_fops.c:146!
      [  644.291876] invalid opcode: 0000 [#1] SMP
      [  644.291882] last sysfs file: /sys/kernel/uevent_seqnum
      [  644.291888]
      [  644.291895] Pid: 7276, comm: lt-cairo-test-s Not tainted 2.6.34-rc1 #2 N150/N210/N220             /N150/N210/N220
      [  644.291903] EIP: 0060:[<c11c70e3>] EFLAGS: 00210283 CPU: 0
      [  644.291912] EIP is at drm_open+0x4b1/0x4e2
      [  644.291918] EAX: f72d8d18 EBX: f790a400 ECX: f73176b8 EDX: 00000000
      [  644.291923] ESI: f790a414 EDI: f790a414 EBP: f647ae20 ESP: f647adfc
      [  644.291929]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
      [  644.291937] Process lt-cairo-test-s (pid: 7276, ti=f647a000 task=f73f5c80 task.ti=f647a000)
      [  644.291941] Stack:
      [  644.291945]  00000000 f7bb7400 00000080 f6451100 f73176b8 f6479214 f6451100 f73176b8
      [  644.291957] <0> c1297ce0 f647ae34 c11c6c04 f73176b8 f7949800 00000000 f647ae54 c1080ac5
      [  644.291969] <0> f7949800 f6451100 00000000 f6451100 f73176b8 f6452780 f647ae70 c107d1e6
      [  644.291982] Call Trace:
      [  644.291991]  [<c11c6c04>] ? drm_stub_open+0x8a/0xb8
      [  644.292000]  [<c1080ac5>] ? chrdev_open+0xef/0x106
      [  644.292008]  [<c107d1e6>] ? __dentry_open+0xd4/0x1a6
      [  644.292015]  [<c107d35b>] ? nameidata_to_filp+0x31/0x45
      [  644.292022]  [<c10809d6>] ? chrdev_open+0x0/0x106
      [  644.292030]  [<c10864e2>] ? do_last+0x346/0x423
      [  644.292037]  [<c108789f>] ? do_filp_open+0x190/0x415
      [  644.292046]  [<c1071eb5>] ? handle_mm_fault+0x214/0x710
      [  644.292053]  [<c107d008>] ? do_sys_open+0x4d/0xe9
      [  644.292061]  [<c1016462>] ? do_page_fault+0x211/0x23f
      [  644.292068]  [<c107d0f0>] ? sys_open+0x23/0x2b
      [  644.292075]  [<c1002650>] ? sysenter_do_call+0x12/0x26
      [  644.292079] Code: 89 f0 89 55 dc e8 8d 96 0a 00 8b 45 e0 8b 55 dc 83 78 04 01 75 28 8b 83 18 02 00 00 85 c0 74 0f 8b 4d ec 3b 81 ac 00 00 00 74 13 <0f> 0b eb fe 8b 4d ec 8b 81 ac 00 00 00 89 83 18 02 00 00 89 f0
      [  644.292143] EIP: [<c11c70e3>] drm_open+0x4b1/0x4e2 SS:ESP 0068:f647adfc
      [  644.292175] ---[ end trace 2ddd476af89a60fa ]---
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: stable@kernel.org
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      da584058
  5. 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
  6. 04 12月, 2009 1 次提交
  7. 18 11月, 2009 1 次提交
  8. 26 10月, 2009 1 次提交
  9. 19 6月, 2009 1 次提交
  10. 29 3月, 2009 1 次提交
  11. 16 3月, 2009 1 次提交
    • J
      Rationalize fasync return values · 60aa4924
      Jonathan Corbet 提交于
      Most fasync implementations do something like:
      
           return fasync_helper(...);
      
      But fasync_helper() will return a positive value at times - a feature used
      in at least one place.  Thus, a number of other drivers do:
      
           err = fasync_helper(...);
           if (err < 0)
                   return err;
           return 0;
      
      In the interests of consistency and more concise code, it makes sense to
      map positive return values onto zero where ->fasync() is called.
      
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      Signed-off-by: NJonathan Corbet <corbet@lwn.net>
      60aa4924
  12. 03 3月, 2009 1 次提交
  13. 20 2月, 2009 1 次提交
  14. 07 1月, 2009 1 次提交
  15. 29 12月, 2008 3 次提交
    • D
      DRM: add mode setting support · f453ba04
      Dave Airlie 提交于
      Add mode setting support to the DRM layer.
      
      This is a fairly big chunk of work that allows DRM drivers to provide
      full output control and configuration capabilities to userspace.  It was
      motivated by several factors:
        - the fb layer's APIs aren't suited for anything but simple
          configurations
        - coordination between the fb layer, DRM layer, and various userspace
          drivers is poor to non-existent (radeonfb excepted)
        - user level mode setting drivers makes displaying panic & oops
          messages more difficult
        - suspend/resume of graphics state is possible in many more
          configurations with kernel level support
      
      This commit just adds the core DRM part of the mode setting APIs.
      Driver specific commits using these new structure and APIs will follow.
      
      Co-authors: Jesse Barnes <jbarnes@virtuousgeek.org>, Jakob Bornecrantz <jakob@tungstengraphics.com>
      Contributors: Alan Hourihane <alanh@tungstengraphics.com>, Maarten Maathuis <madman2003@gmail.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NEric Anholt <eric@anholt.net>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      f453ba04
    • J
      drm: GEM mmap support · a2c0a97b
      Jesse Barnes 提交于
      Add core support for mapping of GEM objects.  Drivers should provide a
      vm_operations_struct if they want to support page faulting of objects.
      The code for handling GEM object offsets was taken from TTM, which was
      written by Thomas Hellström.
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NEric Anholt <eric@anholt.net>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      a2c0a97b
    • D
      drm: move to kref per-master structures. · 7c1c2871
      Dave Airlie 提交于
      This is step one towards having multiple masters sharing a drm
      device in order to get fast-user-switching to work.
      
      It splits out the information associated with the drm master
      into a separate kref counted structure, and allocates this when
      a master opens the device node. It also allows the current master
      to abdicate (say while VT switched), and a new master to take over
      the hardware.
      
      It moves the Intel and radeon drivers to using the sarea from
      within the new master structures.
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      7c1c2871
  16. 02 11月, 2008 1 次提交
    • A
      saner FASYNC handling on file close · 233e70f4
      Al Viro 提交于
      As it is, all instances of ->release() for files that have ->fasync()
      need to remember to evict file from fasync lists; forgetting that
      creates a hole and we actually have a bunch that *does* forget.
      
      So let's keep our lives simple - let __fput() check FASYNC in
      file->f_flags and call ->fasync() there if it's been set.  And lose that
      crap in ->release() instances - leaving it there is still valid, but we
      don't have to bother anymore.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      233e70f4
  17. 18 10月, 2008 2 次提交
  18. 14 7月, 2008 1 次提交
    • D
      drm: reorganise drm tree to be more future proof. · c0e09200
      Dave Airlie 提交于
      With the coming of kernel based modesetting and the memory manager stuff,
      the everything in one directory approach was getting very ugly and
      starting to be unmanageable.
      
      This restructures the drm along the lines of other kernel components.
      
      It creates a drivers/gpu/drm directory and moves the hw drivers into
      subdirectores. It moves the includes into an include/drm, and
      sets up the unifdef for the userspace headers we should be exporting.
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      c0e09200
  19. 21 6月, 2008 1 次提交
  20. 07 5月, 2008 1 次提交
  21. 26 4月, 2008 2 次提交
  22. 17 3月, 2008 1 次提交
    • M
      drm: Fix race that can lockup the kernel · 9df5808c
      Mike Isely 提交于
      The i915_vblank_swap() function schedules an automatic buffer swap
      upon receipt of the vertical sync interrupt.  Such an operation is
      lengthy so it can't be allowed to happen in normal interrupt context,
      thus the DRM implements this by scheduling the work in a kernel
      softirq-scheduled tasklet.  In order for the buffer swap to work
      safely, the DRM's central lock must be taken, via a call to
      drm_lock_take() located in drivers/char/drm/drm_irq.c within the
      function drm_locked_tasklet_func().  The lock-taking logic uses a
      non-interrupt-blocking spinlock to implement the manipulations needed
      to take the lock.  This semantic would be safe if all attempts to use
      the spinlock only happen from process context.  However this buffer
      swap happens from softirq context which is really a form of interrupt
      context.  Thus we have an unsafe situation, in that
      drm_locked_tasklet_func() can block on a spinlock already taken by a
      thread in process context which will never get scheduled again because
      of the blocked softirq tasklet.  This wedges the kernel hard.
      
      To trigger this bug, run a dual-head cloned mode configuration which
      uses the i915 drm, then execute an opengl application which
      synchronizes buffer swaps against the vertical sync interrupt.  In my
      testing, a lockup always results after running anywhere from 5 minutes
      to an hour and a half.  I believe dual-head is needed to really
      trigger the problem because then the vertical sync interrupt handling
      is no longer predictable (due to being interrupt-sourced from two
      different heads running at different speeds).  This raises the
      probability of the tasklet trying to run while the userspace DRI is
      doing things to the GPU (and manipulating the DRM lock).
      
      The fix is to change the relevant spinlock semantics to be the
      interrupt-blocking form.  After this change I am no longer able to
      trigger the lockup; the longest test run so far was 20 hours (test
      stopped after that point).
      
      Note: I have examined the places where this spinlock is being
      employed; all are reasonably short bounded sequences and should be
      suitable for interrupts being blocked without impacting overall kernel
      interrupt response latency.
      Signed-off-by: NMike Isely <isely@pobox.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      9df5808c
  23. 20 10月, 2007 1 次提交
  24. 15 10月, 2007 2 次提交
  25. 11 7月, 2007 4 次提交
  26. 23 3月, 2007 1 次提交
    • T
      drm: fix driver deadlock with AIGLX and reclaim_buffers_locked · 040ac320
      Thomas Hellstrom 提交于
      Bugzilla Bug #9457
      
      Add refcounting of user waiters to the DRM hardware lock, so that we can use
      DRM_LOCK_CONT flag more conservatively.
      
      Also add a kernel waiter refcount that if nonzero transfers the lock for the
      kernel context when it is released. This is useful when waiting for idle and can be used for very simple fence object driver implementations for the new memory manager
      Signed-off-by: NDave Airlie <airlied@linux.ie>
      040ac320
  27. 19 3月, 2007 1 次提交
  28. 11 3月, 2007 1 次提交
  29. 22 9月, 2006 3 次提交
  30. 29 3月, 2006 1 次提交