Repository navigation
Commit 71bb23c
drm/vgem: Pin our pages for dmabuf exports
When the caller maps their dmabuf and we return an sg_table, the caller
doesn't expect the pages beneath that sg_table to vanish on a whim (i.e.
under mempressure). The contract is that the pages are pinned for the
duration of the mapping (from dma_buf_map_attachment() to
dma_buf_unmap_attachment). To comply, we need to introduce our own
vgem_object.pages_pin_count and elevate it across the mapping. However,
the drm_prime interface we use calls drv->prime_pin on dma_buf_attach
and drv->prime_unpin on dma_buf_detach, which while that does cover the
mapping is much broader than is desired -- but it will do for now.
v2: also hold the pin across prime_vmap/vunmap
Reported-by: Tomi Sarvela <tomi.p.sarvela@intel.com>
Testcase: igt/gem_concurrent_blit/*swap*vgem*
Fixes: 5ba6c9f ("drm/vgem: Fix mmaping")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>
Cc: Laura Abbott <labbott@redhat.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: <stable@vger.kernel.org> # needs a backport
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170622134617.17912-1-chris@chris-wilson.co.uk1 parent 2bf5ccc commit 71bb23c
2 files changed
Lines changed: 64 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| 80 | + | |
| 81 | + | |
79 | 82 | | |
80 | 83 | | |
81 | 84 | | |
82 | 85 | | |
83 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
84 | 89 | | |
85 | 90 | | |
86 | 91 | | |
| |||
161 | 166 | | |
162 | 167 | | |
163 | 168 | | |
| 169 | + | |
| 170 | + | |
164 | 171 | | |
165 | 172 | | |
166 | 173 | | |
| |||
274 | 281 | | |
275 | 282 | | |
276 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
277 | 314 | | |
278 | 315 | | |
| 316 | + | |
279 | 317 | | |
280 | 318 | | |
281 | 319 | | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
| 320 | + | |
286 | 321 | | |
287 | 322 | | |
288 | 323 | | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
289 | 327 | | |
290 | | - | |
291 | 328 | | |
292 | 329 | | |
293 | 330 | | |
294 | 331 | | |
295 | | - | |
| 332 | + | |
296 | 333 | | |
297 | | - | |
298 | | - | |
| 334 | + | |
299 | 335 | | |
300 | | - | |
301 | | - | |
302 | | - | |
| 336 | + | |
| 337 | + | |
303 | 338 | | |
304 | | - | |
305 | | - | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
306 | 342 | | |
307 | | - | |
| 343 | + | |
308 | 344 | | |
309 | 345 | | |
310 | 346 | | |
| |||
333 | 369 | | |
334 | 370 | | |
335 | 371 | | |
| 372 | + | |
| 373 | + | |
336 | 374 | | |
337 | 375 | | |
338 | 376 | | |
339 | 377 | | |
340 | 378 | | |
341 | 379 | | |
342 | 380 | | |
| 381 | + | |
343 | 382 | | |
344 | 383 | | |
345 | | - | |
346 | 384 | | |
347 | | - | |
| 385 | + | |
348 | 386 | | |
349 | 387 | | |
350 | 388 | | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
| 389 | + | |
355 | 390 | | |
356 | 391 | | |
357 | 392 | | |
358 | 393 | | |
| 394 | + | |
| 395 | + | |
359 | 396 | | |
| 397 | + | |
360 | 398 | | |
361 | 399 | | |
362 | 400 | | |
| |||
409 | 447 | | |
410 | 448 | | |
411 | 449 | | |
| 450 | + | |
412 | 451 | | |
413 | 452 | | |
414 | 453 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
| |||
0 commit comments