Commit Graph

57 Commits

Author SHA1 Message Date
Jean-Sébastien Pédron
76c40c6986 drm/ttm: Explain why we don't need to acquire a ref in ttm_bo_vm_ctor() 2013-03-23 20:43:26 +00:00
Jean-Sébastien Pédron
a649986089 drm/ttm: Fix TTM buffer object refcount
This fixes memory leaks in the radeonkms driver.

Reviewed by:	Konstantin Belousov (kib@)
Tested by:	J.R. Oldroyd <jr@opal.com>
2013-03-23 19:19:19 +00:00
Attilio Rao
89f6b8632c Switch the vm_object mutex to be a rwlock. This will enable in the
future further optimizations where the vm_object lock will be held
in read mode most of the time the page cache resident pool of pages
are accessed for reading purposes.

The change is mostly mechanical but few notes are reported:
* The KPI changes as follow:
  - VM_OBJECT_LOCK() -> VM_OBJECT_WLOCK()
  - VM_OBJECT_TRYLOCK() -> VM_OBJECT_TRYWLOCK()
  - VM_OBJECT_UNLOCK() -> VM_OBJECT_WUNLOCK()
  - VM_OBJECT_LOCK_ASSERT(MA_OWNED) -> VM_OBJECT_ASSERT_WLOCKED()
    (in order to avoid visibility of implementation details)
  - The read-mode operations are added:
    VM_OBJECT_RLOCK(), VM_OBJECT_TRYRLOCK(), VM_OBJECT_RUNLOCK(),
    VM_OBJECT_ASSERT_RLOCKED(), VM_OBJECT_ASSERT_LOCKED()
* The vm/vm_pager.h namespace pollution avoidance (forcing requiring
  sys/mutex.h in consumers directly to cater its inlining functions
  using VM_OBJECT_LOCK()) imposes that all the vm/vm_pager.h
  consumers now must include also sys/rwlock.h.
* zfs requires a quite convoluted fix to include FreeBSD rwlocks into
  the compat layer because the name clash between FreeBSD and solaris
  versions must be avoided.
  At this purpose zfs redefines the vm_object locking functions
  directly, isolating the FreeBSD components in specific compat stubs.

The KPI results heavilly broken by this commit.  Thirdy part ports must
be updated accordingly (I can think off-hand of VirtualBox, for example).

Sponsored by:	EMC / Isilon storage division
Reviewed by:	jeff
Reviewed by:	pjd (ZFS specific review)
Discussed with:	alc
Tested by:	pho
2013-03-09 02:32:23 +00:00
Jean-Sébastien Pédron
3f81c67746 drm: Fix a call to free(9) with an incorrect malloc type
While here, the call to free(9) is moved to drm_global.c, near the
initial malloc(9).

Reviewed by:	Konstantin Belousov (kib@)
2013-03-08 18:11:02 +00:00
Konstantin Belousov
257d427d5f Fix build with gcc, do not use unnamed union.
Reported and tested by:	gjb
MFC after:	1 month
2013-03-05 16:15:34 +00:00
Konstantin Belousov
94415dd90e Fix build with gcc, remove redundand declarations.
Reported and tested by:	gjb
MFC after:	1 month
2013-03-05 16:14:55 +00:00
Konstantin Belousov
e6cd8542ed Import the preliminary port of the TTM.
The early commit is done to facilitate the off-tree work on the
porting of the Radeon driver.

Sponsored by:	The FreeBSD Foundation
Debugged and tested by:	    dumbbell
MFC after:	1 month
2013-03-05 09:49:34 +00:00