Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /** |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 2 | * \file drm_memory_debug.h |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * Memory management wrappers for DRM. |
| 4 | * |
| 5 | * \author Rickard E. (Rik) Faith <faith@valinux.com> |
| 6 | * \author Gareth Hughes <gareth@valinux.com> |
| 7 | */ |
| 8 | |
| 9 | /* |
| 10 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. |
| 11 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. |
| 12 | * All Rights Reserved. |
| 13 | * |
| 14 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 15 | * copy of this software and associated documentation files (the "Software"), |
| 16 | * to deal in the Software without restriction, including without limitation |
| 17 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 18 | * and/or sell copies of the Software, and to permit persons to whom the |
| 19 | * Software is furnished to do so, subject to the following conditions: |
| 20 | * |
| 21 | * The above copyright notice and this permission notice (including the next |
| 22 | * paragraph) shall be included in all copies or substantial portions of the |
| 23 | * Software. |
| 24 | * |
| 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 28 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 29 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 30 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 31 | * OTHER DEALINGS IN THE SOFTWARE. |
| 32 | */ |
| 33 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | #include "drmP.h" |
| 35 | |
| 36 | typedef struct drm_mem_stats { |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 37 | const char *name; |
| 38 | int succeed_count; |
| 39 | int free_count; |
| 40 | int fail_count; |
| 41 | unsigned long bytes_allocated; |
| 42 | unsigned long bytes_freed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | } drm_mem_stats_t; |
| 44 | |
Ingo Molnar | 34af946 | 2006-06-27 02:53:55 -0700 | [diff] [blame] | 45 | static DEFINE_SPINLOCK(drm_mem_lock); |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 46 | static unsigned long drm_ram_available = 0; /* In pages */ |
| 47 | static unsigned long drm_ram_used = 0; |
| 48 | static drm_mem_stats_t drm_mem_stats[] = |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 49 | { |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 50 | [DRM_MEM_DMA] = {"dmabufs"}, |
| 51 | [DRM_MEM_SAREA] = {"sareas"}, |
| 52 | [DRM_MEM_DRIVER] = {"driver"}, |
| 53 | [DRM_MEM_MAGIC] = {"magic"}, |
| 54 | [DRM_MEM_IOCTLS] = {"ioctltab"}, |
| 55 | [DRM_MEM_MAPS] = {"maplist"}, |
| 56 | [DRM_MEM_VMAS] = {"vmalist"}, |
| 57 | [DRM_MEM_BUFS] = {"buflist"}, |
| 58 | [DRM_MEM_SEGS] = {"seglist"}, |
| 59 | [DRM_MEM_PAGES] = {"pagelist"}, |
| 60 | [DRM_MEM_FILES] = {"files"}, |
| 61 | [DRM_MEM_QUEUES] = {"queues"}, |
| 62 | [DRM_MEM_CMDS] = {"commands"}, |
| 63 | [DRM_MEM_MAPPINGS] = {"mappings"}, |
| 64 | [DRM_MEM_BUFLISTS] = {"buflists"}, |
| 65 | [DRM_MEM_AGPLISTS] = {"agplist"}, |
| 66 | [DRM_MEM_SGLISTS] = {"sglist"}, |
| 67 | [DRM_MEM_TOTALAGP] = {"totalagp"}, |
| 68 | [DRM_MEM_BOUNDAGP] = {"boundagp"}, |
| 69 | [DRM_MEM_CTXBITMAP] = {"ctxbitmap"}, |
| 70 | [DRM_MEM_CTXLIST] = {"ctxlist"}, |
| 71 | [DRM_MEM_STUB] = {"stub"}, |
| 72 | {NULL, 0,} /* Last entry must be null */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | }; |
| 74 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 75 | void drm_mem_init (void) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | drm_mem_stats_t *mem; |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 77 | struct sysinfo si; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 79 | for (mem = drm_mem_stats; mem->name; ++mem) { |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 80 | mem->succeed_count = 0; |
| 81 | mem->free_count = 0; |
| 82 | mem->fail_count = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | mem->bytes_allocated = 0; |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 84 | mem->bytes_freed = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | si_meminfo(&si); |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 88 | drm_ram_available = si.totalram; |
| 89 | drm_ram_used = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | /* drm_mem_info is called whenever a process reads /dev/drm/mem. */ |
| 93 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 94 | static int drm__mem_info (char *buf, char **start, off_t offset, |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 95 | int request, int *eof, void *data) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | drm_mem_stats_t *pt; |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 97 | int len = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | |
| 99 | if (offset > DRM_PROC_LIMIT) { |
| 100 | *eof = 1; |
| 101 | return 0; |
| 102 | } |
| 103 | |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 104 | *eof = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | *start = &buf[offset]; |
| 106 | |
| 107 | DRM_PROC_PRINT(" total counts " |
| 108 | " | outstanding \n"); |
| 109 | DRM_PROC_PRINT("type alloc freed fail bytes freed" |
| 110 | " | allocs bytes\n\n"); |
| 111 | DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n", |
| 112 | "system", 0, 0, 0, |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 113 | drm_ram_available << (PAGE_SHIFT - 10)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n", |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 115 | "locked", 0, 0, 0, drm_ram_used >> 10); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | DRM_PROC_PRINT("\n"); |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 117 | for (pt = drm_mem_stats; pt->name; pt++) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu %10lu | %6d %10ld\n", |
| 119 | pt->name, |
| 120 | pt->succeed_count, |
| 121 | pt->free_count, |
| 122 | pt->fail_count, |
| 123 | pt->bytes_allocated, |
| 124 | pt->bytes_freed, |
| 125 | pt->succeed_count - pt->free_count, |
| 126 | (long)pt->bytes_allocated |
| 127 | - (long)pt->bytes_freed); |
| 128 | } |
| 129 | |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 130 | if (len > request + offset) |
| 131 | return request; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | *eof = 1; |
| 133 | return len - offset; |
| 134 | } |
| 135 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 136 | int drm_mem_info (char *buf, char **start, off_t offset, |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 137 | int len, int *eof, void *data) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | int ret; |
| 139 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 140 | spin_lock(&drm_mem_lock); |
| 141 | ret = drm__mem_info (buf, start, offset, len, eof, data); |
| 142 | spin_unlock(&drm_mem_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | return ret; |
| 144 | } |
| 145 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 146 | void *drm_alloc (size_t size, int area) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | void *pt; |
| 148 | |
| 149 | if (!size) { |
| 150 | DRM_MEM_ERROR(area, "Allocating 0 bytes\n"); |
| 151 | return NULL; |
| 152 | } |
| 153 | |
| 154 | if (!(pt = kmalloc(size, GFP_KERNEL))) { |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 155 | spin_lock(&drm_mem_lock); |
| 156 | ++drm_mem_stats[area].fail_count; |
| 157 | spin_unlock(&drm_mem_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | return NULL; |
| 159 | } |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 160 | spin_lock(&drm_mem_lock); |
| 161 | ++drm_mem_stats[area].succeed_count; |
| 162 | drm_mem_stats[area].bytes_allocated += size; |
| 163 | spin_unlock(&drm_mem_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | return pt; |
| 165 | } |
| 166 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 167 | void *drm_calloc (size_t nmemb, size_t size, int area) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | void *addr; |
| 169 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 170 | addr = drm_alloc (nmemb * size, area); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | if (addr != NULL) |
| 172 | memset((void *)addr, 0, size * nmemb); |
| 173 | |
| 174 | return addr; |
| 175 | } |
| 176 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 177 | void *drm_realloc (void *oldpt, size_t oldsize, size_t size, int area) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | void *pt; |
| 179 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 180 | if (!(pt = drm_alloc (size, area))) |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 181 | return NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | if (oldpt && oldsize) { |
| 183 | memcpy(pt, oldpt, oldsize); |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 184 | drm_free (oldpt, oldsize, area); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | } |
| 186 | return pt; |
| 187 | } |
| 188 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 189 | void drm_free (void *pt, size_t size, int area) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | int alloc_count; |
| 191 | int free_count; |
| 192 | |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 193 | if (!pt) |
| 194 | DRM_MEM_ERROR(area, "Attempt to free NULL pointer\n"); |
| 195 | else |
| 196 | kfree(pt); |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 197 | spin_lock(&drm_mem_lock); |
| 198 | drm_mem_stats[area].bytes_freed += size; |
| 199 | free_count = ++drm_mem_stats[area].free_count; |
| 200 | alloc_count = drm_mem_stats[area].succeed_count; |
| 201 | spin_unlock(&drm_mem_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | if (free_count > alloc_count) { |
| 203 | DRM_MEM_ERROR(area, "Excess frees: %d frees, %d allocs\n", |
| 204 | free_count, alloc_count); |
| 205 | } |
| 206 | } |
| 207 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | #if __OS_HAS_AGP |
| 209 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 210 | DRM_AGP_MEM *drm_alloc_agp (drm_device_t *dev, int pages, u32 type) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 211 | DRM_AGP_MEM *handle; |
| 212 | |
| 213 | if (!pages) { |
| 214 | DRM_MEM_ERROR(DRM_MEM_TOTALAGP, "Allocating 0 pages\n"); |
| 215 | return NULL; |
| 216 | } |
| 217 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 218 | if ((handle = drm_agp_allocate_memory (pages, type))) { |
| 219 | spin_lock(&drm_mem_lock); |
| 220 | ++drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count; |
| 221 | drm_mem_stats[DRM_MEM_TOTALAGP].bytes_allocated |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 222 | += pages << PAGE_SHIFT; |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 223 | spin_unlock(&drm_mem_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | return handle; |
| 225 | } |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 226 | spin_lock(&drm_mem_lock); |
| 227 | ++drm_mem_stats[DRM_MEM_TOTALAGP].fail_count; |
| 228 | spin_unlock(&drm_mem_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 229 | return NULL; |
| 230 | } |
| 231 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 232 | int drm_free_agp (DRM_AGP_MEM * handle, int pages) { |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 233 | int alloc_count; |
| 234 | int free_count; |
| 235 | int retval = -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | |
| 237 | if (!handle) { |
| 238 | DRM_MEM_ERROR(DRM_MEM_TOTALAGP, |
| 239 | "Attempt to free NULL AGP handle\n"); |
| 240 | return retval; |
| 241 | } |
| 242 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 243 | if (drm_agp_free_memory (handle)) { |
| 244 | spin_lock(&drm_mem_lock); |
| 245 | free_count = ++drm_mem_stats[DRM_MEM_TOTALAGP].free_count; |
| 246 | alloc_count = drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count; |
| 247 | drm_mem_stats[DRM_MEM_TOTALAGP].bytes_freed |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 248 | += pages << PAGE_SHIFT; |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 249 | spin_unlock(&drm_mem_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | if (free_count > alloc_count) { |
| 251 | DRM_MEM_ERROR(DRM_MEM_TOTALAGP, |
| 252 | "Excess frees: %d frees, %d allocs\n", |
| 253 | free_count, alloc_count); |
| 254 | } |
| 255 | return 0; |
| 256 | } |
| 257 | return retval; |
| 258 | } |
| 259 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 260 | int drm_bind_agp (DRM_AGP_MEM * handle, unsigned int start) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | int retcode = -EINVAL; |
| 262 | |
| 263 | if (!handle) { |
| 264 | DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, |
| 265 | "Attempt to bind NULL AGP handle\n"); |
| 266 | return retcode; |
| 267 | } |
| 268 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 269 | if (!(retcode = drm_agp_bind_memory (handle, start))) { |
| 270 | spin_lock(&drm_mem_lock); |
| 271 | ++drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count; |
| 272 | drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_allocated |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 273 | += handle->page_count << PAGE_SHIFT; |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 274 | spin_unlock(&drm_mem_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | return retcode; |
| 276 | } |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 277 | spin_lock(&drm_mem_lock); |
| 278 | ++drm_mem_stats[DRM_MEM_BOUNDAGP].fail_count; |
| 279 | spin_unlock(&drm_mem_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | return retcode; |
| 281 | } |
| 282 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 283 | int drm_unbind_agp (DRM_AGP_MEM * handle) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | int alloc_count; |
| 285 | int free_count; |
| 286 | int retcode = -EINVAL; |
| 287 | |
| 288 | if (!handle) { |
| 289 | DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, |
| 290 | "Attempt to unbind NULL AGP handle\n"); |
| 291 | return retcode; |
| 292 | } |
| 293 | |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 294 | if ((retcode = drm_agp_unbind_memory (handle))) |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 295 | return retcode; |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 296 | spin_lock(&drm_mem_lock); |
| 297 | free_count = ++drm_mem_stats[DRM_MEM_BOUNDAGP].free_count; |
| 298 | alloc_count = drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count; |
| 299 | drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_freed |
Dave Airlie | b5e89ed | 2005-09-25 14:28:13 +1000 | [diff] [blame] | 300 | += handle->page_count << PAGE_SHIFT; |
Dave Airlie | f0c408b | 2006-01-02 19:52:09 +1100 | [diff] [blame] | 301 | spin_unlock(&drm_mem_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | if (free_count > alloc_count) { |
| 303 | DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, |
| 304 | "Excess frees: %d frees, %d allocs\n", |
| 305 | free_count, alloc_count); |
| 306 | } |
| 307 | return retcode; |
| 308 | } |
| 309 | #endif |