1. 08 2月, 2016 1 次提交
  2. 26 1月, 2016 1 次提交
  3. 25 1月, 2016 2 次提交
  4. 04 12月, 2015 1 次提交
  5. 26 11月, 2015 2 次提交
  6. 22 5月, 2015 1 次提交
  7. 05 5月, 2015 1 次提交
    • D
      drm: simplify authentication management · 32e7b94a
      David Herrmann 提交于
      The magic auth tokens we have are a simple map from cyclic IDs to drm_file
      objects. Remove all the old bulk of code and replace it with a simple,
      direct IDR.
      
      The previous behavior is kept. Especially calling authmagic multiple times
      on the same magic results in EINVAL except on the first call. The only
      difference in behavior is that we never allocate IDs multiple times as
      long as a client has its FD open.
      
      v2:
       - Fix return code of GetMagic()
       - Use non-cyclic IDR allocator
       - fix off-by-one in "magic > INT_MAX" sanity check
      
      v3:
       - drop redundant "magic > INT_MAX" check
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      32e7b94a
  8. 21 1月, 2015 1 次提交
    • C
      drm: Make drm_read() more robust against multithreaded races · cdd1cf79
      Chris Wilson 提交于
      The current implementation of drm_read() faces a number of issues:
      
      1. Upon an error, it consumes the event which may lead to the client
      blocking.
      2. Upon an error, it forgets about events already copied
      3. If it fails to copy a single event with O_NONBLOCK it falls into a
      infinite loop of reporting EAGAIN.
      3. There is a race between multiple waiters and blocking reads of the
      events list.
      
      Here, we inline drm_dequeue_event() into drm_read() so that we can take
      the spinlock around the list walking and event copying, and importantly
      reorder the error handling to avoid the issues above.
      
      Cc: Takashi Iwai <tiwai@suse.de>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NTakashi Iwai <tiwai@suse.de>
      Testcase: igt/drm_read
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      cdd1cf79
  9. 04 12月, 2014 1 次提交
  10. 08 10月, 2014 1 次提交
  11. 03 10月, 2014 1 次提交
  12. 12 9月, 2014 3 次提交
  13. 10 9月, 2014 2 次提交
  14. 08 8月, 2014 1 次提交
    • D
      Revert "drm: drop redundant drm_file->is_master" · 7963e9db
      Dave Airlie 提交于
      This reverts commit 48ba8137.
      
      Thanks to Chris:
      "drm_file->is_master is not synomous with having drm_file->master ==
      drm_file->minor->master. This is because drm_file->master is the same
      for all drm_files of the same generation and so when there is a master,
      every drm_file believes itself to be the master. Confusion ensues and
      things go pear shaped when one file is closed and there is no master
      anymore."
      
      Conflicts:
      	drivers/gpu/drm/drm_drv.c
      	drivers/gpu/drm/drm_stub.c
      7963e9db
  15. 06 8月, 2014 2 次提交
  16. 05 8月, 2014 5 次提交
    • D
      drm: move module initialization to drm_stub.c · 1b7199fe
      David Herrmann 提交于
      Most of the new DRM management functions are nowadays in drm_stub.c. By
      moving the core module initialization to drm_stub.c we can make several
      global variables static and keep the stub-open helper local.
      
      The core files now look like this:
        drm_stub.c: Core management
         drm_drv.c: Ioctl dispatcher
       drm_ioctl.c: Actual ioctl backends
        drm_fops.c: Char-dev file-operations
      
      A follow-up patch will move what is left from drm_drv.c into drm_ioctl.c.
      Acked-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      1b7199fe
    • D
      drm: don't de-authenticate clients on master-close · 3cb01a98
      David Herrmann 提交于
      If an active DRM-Master closes its device, we deauthenticate all clients
      on that master. However, if an inactive DRM-Master closes its device, we
      do nothing. This is quite inconsistent and breaks several scenarios:
      
       1) If this was used as security mechanism, it fails horribly if a master
          closes a device while VT switched away. Furthermore, none of the few
          drivers using ->master_*() callbacks seems to require it, anyway.
      
       2) If you spawn weston (or any other non-UMS compositor) in background
          while another compositor is active, both will get assigned to the
          same "drm_master" object. If the foreground compositor now exits, all
          clients of both the foreground AND background compositor will be
          de-authenticated leading to unexpected behavior.
      
      Stop this non-sense and keep clients authenticated. We don't do this when
      dropping DRM-Master (i.e., switching VTs) so don't do it on active-close
      either!
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      3cb01a98
    • D
      drm: drop redundant drm_file->is_master · 48ba8137
      David Herrmann 提交于
      The drm_file->is_master field is redundant as it's equivalent to:
          drm_file->master && drm_file->master == drm_file->minor->master
      
      1) "=>"
        Whenever we set drm_file->is_master, we also set:
            drm_file->minor->master = drm_file->master;
      
        Whenever we clear drm_file->is_master, we also call:
            drm_master_put(&drm_file->minor->master);
        which implicitly clears it to NULL.
      
      2) "<="
        minor->master cannot be set if it is non-NULL. Therefore, it stays as
        is unless a file drops it.
      
        If minor->master is NULL, it is only set by places that also adjust
        drm_file->is_master.
      
      Therefore, we can safely drop is_master and replace it by an inline helper
      that matches:
          drm_file->master && drm_file->master == drm_file->minor->master
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      48ba8137
    • D
      drm: extract legacy ctxbitmap flushing · 9f8d21ea
      David Herrmann 提交于
      The ctxbitmap code is only used by legacy drivers so lets try to keep it
      as separated as possible. Furthermore, the locking is non-obvious and
      kinda weird with ctxlist_mutex *and* struct_mutex. Keeping all ctxbitmap
      access in one file is much easier to review and makes drm_release() more
      readable.
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      9f8d21ea
    • C
      drm: Unlink dead file_priv from list of active files first · dff01de1
      Chris Wilson 提交于
      In order to prevent external observers walking the list of open DRM
      files from seeing an invalid drm_file_private in the process of being
      torndown, the first operation we need to take is to unlink the
      drm_file_private from that list.
      
      	general protection fault: 0000 [#1] PREEMPT SMP
      	Modules linked in: i915 i2c_algo_bit drm_kms_helper drm lpc_ich mfd_core nls_iso8859_1 i2c_hid video hid_generic usbhid hid e1000e ahci ptp libahci pps_core
      	CPU: 3 PID: 8220 Comm: cat Not tainted 3.16.0-rc6+ #4
      	Hardware name: Intel Corporation Shark Bay Client platform/WhiteTip Mountain 1, BIOS HSWLPTU1.86C.0119.R00.1303230105 03/23/2013
      	task: ffff8800219642c0 ti: ffff880047024000 task.ti: ffff880047024000
      	RIP: 0010:[<ffffffffa0137c70>]  [<ffffffffa0137c70>] per_file_stats+0x110/0x160 [i915]
      	RSP: 0018:ffff880047027d48  EFLAGS: 00010246
      	RAX: 6b6b6b6b6b6b6b6b RBX: ffff880047027e30 RCX: 0000000000000000
      	RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff88003a05cd00
      	RBP: ffff880047027d58 R08: 0000000000000001 R09: 0000000000000000
      	R10: ffff8800219642c0 R11: 0000000000000000 R12: ffff88003a05cd00
      	R13: 0000000000000000 R14: ffff88003a05cd00 R15: ffff880047027d88
      	FS:  00007f5f73a13740(0000) GS:ffff88014e380000(0000) knlGS:0000000000000000
      	CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      	CR2: 00000000023ff038 CR3: 0000000021a4b000 CR4: 00000000001407e0
      	Stack:
      	 0000000000000001 000000000000ffff ffff880047027dc8 ffffffff813438e4
      	 ffff880047027e30 ffffffffa0137b60 ffff880021a8af58 ffff880021a8f1a0
      	 ffff8800a2061fb0 ffff8800a2062048 ffff8800a2061fb0 ffff8800a1e23478
      	Call Trace:
      	 [<ffffffff813438e4>] idr_for_each+0xf4/0x180
      	 [<ffffffffa0137b60>] ? i915_gem_stolen_list_info+0x1f0/0x1f0 [i915]
      	 [<ffffffffa013a17a>] i915_gem_object_info+0x5ca/0x6a0 [i915]
      	 [<ffffffff81193ec5>] seq_read+0xf5/0x3a0
      	 [<ffffffff8116d950>] vfs_read+0x90/0x150
      	 [<ffffffff8116e509>] SyS_read+0x49/0xb0
      	 [<ffffffff815d8622>] tracesys+0xd0/0xd5
      	Code: 01 00 00 49 39 84 24 08 01 00 00 74 55 49 8b 84 24 b8 00 00 00 48 01 43 18 31 c0 5b 41 5c 5d c3 0f 1f 00 49 8b 44 24 08 4c 89 e7 <48> 8b 70 28 48 81 c6 48 80 00 00 e8 80 14 01 00 84 c0 74 bc 49
      	RIP  [<ffffffffa0137c70>] per_file_stats+0x110/0x160 [i915]
      	RSP <ffff880047027d48>
      Reported-by: N"Ursulin, Tvrtko" <tvrtko.ursulin@intel.com>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81712Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: "Ursulin, Tvrtko" <tvrtko.ursulin@intel.com>
      Reviewed-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      dff01de1
  17. 02 8月, 2014 1 次提交
    • D
      drm: drop i386 verification · 1eac8877
      David Herrmann 提交于
      Linux doesn't run on i386, anymore. See:
      
          commit d55c5a93
          Author: H. Peter Anvin <hpa@linux.intel.com>
          Date:   Wed Nov 28 11:50:24 2012 -0800
      
              x86, 386 removal: Remove CONFIG_CMPXCHG
      
              All 486+ CPUs support CMPXCHG, so remove the fallback 386 support
              code.
      
      Furthermore, as the commit-message states, all 486+ CPUs support the
      CMPXCHG instruction and thus even legacy DRM can run fine.
      
      Drop the now superfluous "x86 == 3" check.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      1eac8877
  18. 29 4月, 2014 1 次提交
  19. 28 3月, 2014 3 次提交
  20. 16 3月, 2014 5 次提交
    • D
      drm: make minors independent of global lock · 0d639883
      David Herrmann 提交于
      We used to protect minor-lookup and setup by the global drm lock. To
      continue our attempts of dropping drm_global_mutex, this patch makes the
      minor management independent of it. Furthermore, we make it all atomic and
      switch to spin-locks instead of a mutex.
      
      Now that minor-lookup is independent, we also move the
      "drm_is_unplugged()" test into the minor-lookup path. There is no reason
      to ever return a minor for unplugged objects, so keep that logic internal.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      0d639883
    • D
      drm: remove redundant minor->device field · 5817878c
      David Herrmann 提交于
      Whenever we access minor->device, we are in a minor->kdev->...->fops
      callback so the minor->kdev pointer *must* be valid. Thus, simply use
      minor->kdev->devt instead of minor->device and remove the redundant field.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      5817878c
    • D
      drm: add minor-lookup/release helpers · 1616c525
      David Herrmann 提交于
      Instead of accessing drm_minors_idr directly, this adds a small helper to
      hide the internals. This will help us later to remove the drm_global_mutex
      requirement for minor-lookup.
      
      Furthermore, this also makes sure that minor->dev is always valid and
      takes a reference-count to the device as long as the minor is used in an
      open-file. This way, "struct file*"->private_data->dev is guaranteed to be
      valid (which it has to, as we cannot reset it).
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      1616c525
    • D
      drm: skip redundant minor-lookup in open path · f4aede2e
      David Herrmann 提交于
      The drm_open_helper() function is only used internally for drm_open() so
      we can safely pass in the minor-object directly instead of the minor-id.
      This way, we avoid the additional minor IDR lookup, which we already do
      twice in drm_stub_open() and drm_open().
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      f4aede2e
    • D
      drm: use anon-inode instead of relying on cdevs · 6796cb16
      David Herrmann 提交于
      DRM drivers share a common address_space across all character-devices of a
      single DRM device. This allows simple buffer eviction and mapping-control.
      However, DRM core currently waits for the first ->open() on any char-dev
      to mark the underlying inode as backing inode of the device. This delayed
      initialization causes ugly conditions all over the place:
        if (dev->dev_mapping)
          do_sth();
      
      To avoid delayed initialization and to stop reusing the inode of the
      char-dev, we allocate an anonymous inode for each DRM device and reset
      filp->f_mapping to it on ->open().
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      6796cb16
  21. 15 2月, 2014 1 次提交
  22. 18 12月, 2013 3 次提交