Maarten Lankhorst
2014-Jul-31 15:30 UTC
[Nouveau] [PATCH 00/17] Convert TTM to the new fence interface. v2
This series applies on top of the driver-core-next branch of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git Before converting ttm to the new fence interface I had to fix some drivers to require a reservation before poking with fence_obj. After flipping the switch RCU becomes available instead, and the extra reservations can be dropped again. I've done at least basic testing on all the drivers I've converted at some point, but more testing is definitely welcomed! Changes since v1: - Almost all radeon changes, radeon reworked their page flip code which made things easier for me. - Added a delayed work for radeon that checks gpu lockups. - Reworked the radeon fence implementation to remove deadlocks, and end up slightly cleaner. --- Maarten Lankhorst (18): fence: add debugging lines to fence_is_signaled for the callback drm/ttm: add interruptible parameter to ttm_eu_reserve_buffers drm/ttm: kill off some members to ttm_validate_buffer drm/nouveau: add reservation to nouveau_gem_ioctl_cpu_prep drm/nouveau: require reservations for nouveau_fence_sync and nouveau_bo_fence drm/ttm: call ttm_bo_wait while inside a reservation drm/ttm: kill fence_lock drm/nouveau: rework to new fence interface drm/radeon: handle lockup in delayed work, v2 drm/radeon: add timeout argument to radeon_fence_wait_seq drm/radeon: use common fence implementation for fences, v2 drm/qxl: rework to new fence interface drm/vmwgfx: get rid of different types of fence_flags entirely drm/vmwgfx: rework to new fence interface drm/ttm: flip the switch, and convert to dma_fence drm/nouveau: use rcu in nouveau_gem_ioctl_cpu_prep drm/radeon: use rcu waits in some ioctls drm/vmwgfx: use rcu in vmw_user_dmabuf_synccpu_grab drivers/gpu/drm/nouveau/core/core/event.c | 4 drivers/gpu/drm/nouveau/nouveau_bo.c | 59 +--- drivers/gpu/drm/nouveau/nouveau_display.c | 25 +- drivers/gpu/drm/nouveau/nouveau_fence.c | 431 +++++++++++++++++++---------- drivers/gpu/drm/nouveau/nouveau_fence.h | 22 + drivers/gpu/drm/nouveau/nouveau_gem.c | 55 +--- drivers/gpu/drm/nouveau/nv04_fence.c | 4 drivers/gpu/drm/nouveau/nv10_fence.c | 4 drivers/gpu/drm/nouveau/nv17_fence.c | 2 drivers/gpu/drm/nouveau/nv50_fence.c | 2 drivers/gpu/drm/nouveau/nv84_fence.c | 11 - drivers/gpu/drm/qxl/Makefile | 2 drivers/gpu/drm/qxl/qxl_cmd.c | 7 drivers/gpu/drm/qxl/qxl_debugfs.c | 16 + drivers/gpu/drm/qxl/qxl_drv.h | 20 - drivers/gpu/drm/qxl/qxl_fence.c | 91 ------ drivers/gpu/drm/qxl/qxl_kms.c | 1 drivers/gpu/drm/qxl/qxl_object.c | 2 drivers/gpu/drm/qxl/qxl_object.h | 6 drivers/gpu/drm/qxl/qxl_release.c | 172 ++++++++++-- drivers/gpu/drm/qxl/qxl_ttm.c | 93 ------ drivers/gpu/drm/radeon/radeon.h | 21 + drivers/gpu/drm/radeon/radeon_cs.c | 10 + drivers/gpu/drm/radeon/radeon_device.c | 27 +- drivers/gpu/drm/radeon/radeon_display.c | 8 - drivers/gpu/drm/radeon/radeon_fence.c | 405 +++++++++++++++++++++------ drivers/gpu/drm/radeon/radeon_gem.c | 19 + drivers/gpu/drm/radeon/radeon_irq_kms.c | 43 +++ drivers/gpu/drm/radeon/radeon_object.c | 8 - drivers/gpu/drm/radeon/radeon_ring.c | 1 drivers/gpu/drm/radeon/radeon_ttm.c | 34 -- drivers/gpu/drm/radeon/radeon_uvd.c | 10 - drivers/gpu/drm/radeon/radeon_vm.c | 16 + drivers/gpu/drm/ttm/ttm_bo.c | 239 +++++++++------- drivers/gpu/drm/ttm/ttm_bo_util.c | 28 -- drivers/gpu/drm/ttm/ttm_bo_vm.c | 3 drivers/gpu/drm/ttm/ttm_execbuf_util.c | 146 +++------- drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c | 47 --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 1 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 24 -- drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 329 ++++++++++++---------- drivers/gpu/drm/vmwgfx/vmwgfx_fence.h | 35 +- drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 43 +-- include/drm/ttm/ttm_bo_api.h | 7 include/drm/ttm/ttm_bo_driver.h | 29 -- include/drm/ttm/ttm_execbuf_util.h | 22 + include/linux/fence.h | 23 +- 47 files changed, 1408 insertions(+), 1199 deletions(-) delete mode 100644 drivers/gpu/drm/qxl/qxl_fence.c -- Signature
Maarten Lankhorst
2014-Jul-31 15:30 UTC
[Nouveau] [PATCH 01/18] fence: add debugging lines to fence_is_signaled for the callback
fence_is_signaled callback should support being run in atomic context, but not in irq context. Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com> --- include/linux/fence.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/include/linux/fence.h b/include/linux/fence.h index d174585b874b..c1a4519ba2f5 100644 --- a/include/linux/fence.h +++ b/include/linux/fence.h @@ -143,6 +143,7 @@ struct fence_cb { * the second time will be a noop since it was already signaled. * * Notes on signaled: + * Called with interrupts enabled, and never from interrupt context. * May set fence->status if returning true. * * Notes on wait: @@ -268,15 +269,29 @@ fence_is_signaled_locked(struct fence *fence) static inline bool fence_is_signaled(struct fence *fence) { + bool ret; + if (test_bit(FENCE_FLAG_SIGNALED_BIT, &fence->flags)) return true; - if (fence->ops->signaled && fence->ops->signaled(fence)) { + if (!fence->ops->signaled) + return false; + + if (config_enabled(CONFIG_PROVE_LOCKING)) + WARN_ON(in_interrupt() || irqs_disabled()); + + if (config_enabled(CONFIG_DEBUG_ATOMIC_SLEEP)) + preempt_disable(); + + ret = fence->ops->signaled(fence); + + if (config_enabled(CONFIG_DEBUG_ATOMIC_SLEEP)) + preempt_enable(); + + if (ret) fence_signal(fence); - return true; - } - return false; + return ret; } /**
Maarten Lankhorst
2014-Jul-31 15:35 UTC
[Nouveau] [PATCH 00/17] Convert TTM to the new fence interface. v2
op 31-07-14 17:30, Maarten Lankhorst schreef:> This series applies on top of the driver-core-next branch of > git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git > > Before converting ttm to the new fence interface I had to fix some > drivers to require a reservation before poking with fence_obj. > After flipping the switch RCU becomes available instead, and > the extra reservations can be dropped again. > > I've done at least basic testing on all the drivers I've converted > at some point, but more testing is definitely welcomed! > > Changes since v1: > - Almost all radeon changes, radeon reworked their page flip code which > made things easier for me. > - Added a delayed work for radeon that checks gpu lockups. > - Reworked the radeon fence implementation to remove deadlocks, > and end up slightly cleaner. >Oops, managed to screw up sending patches. There are 19 patches in this series, starting with [PATCH 01/19] fence: add debugging lines to fence_is_signaled for the callback Sorry for the noise. ~Maarten
Apparently Analagous Threads
- [PATCH 00/17] Convert TTM to the new fence interface.
- [PATCH 00/17] Convert TTM to the new fence interface.
- [RFC PATCH v1 00/16] Convert all ttm drivers to use the new reservation interface
- [PATCH 01/19] fence: add debugging lines to fence_is_signaled for the callback
- [PATCH 09/17] drm/radeon: use common fence implementation for fences