aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-19 20:39:38 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-19 20:39:38 -0800
commitc69bde78f05c34f0f3c1f3025d6214d6e06389f4 (patch)
tree8a0787fe41c2c22fff9f683b1be82e036e1ea27e /drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
parentMerge tag 'for-linus-4.4' of git://git.code.sf.net/p/openipmi/linux-ipmi (diff)
parentMerge tag 'drm-intel-fixes-2015-11-19' of git://anongit.freedesktop.org/drm-intel into drm-fixes (diff)
downloadlinux-dev-c69bde78f05c34f0f3c1f3025d6214d6e06389f4.tar.xz
linux-dev-c69bde78f05c34f0f3c1f3025d6214d6e06389f4.zip
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Pull drm fixes from Dave Airlie: "A varied bunch of fixes, the radeon pull is probably a bit larger than I'd like, but it contains 2 weeks of stuff, and the Fiji fixes are a bit large, but they are Fiji specific. Otherwise: - mgag200: One cursor regression oops fix. - vc4: A few small fixes and cleanups. - core: Atomic fixes and Atomic helper fixes - i915: Revert for the backlight regression along with a bunch of fixes" * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (58 commits) drm/atomic-helper: Check encoder/crtc constraints Revert "drm/i915: skip modeset if compatible for everyone." drm/mgag200: fix kernel hang in cursor code. drm/amdgpu: reserve/unreserve objects out of map/unmap operations drm/amdgpu: move bo_reserve out of amdgpu_vm_clear_bo drm/amdgpu: add lock for interval tree in vm drm/amdgpu: keep the owner for VMIDs drm/amdgpu: move VM manager clean into the VM code again drm/amdgpu: cleanup VM coding style drm/amdgpu: remove unused VM manager field drm/amdgpu: cleanup scheduler command submission drm/amdgpu: fix typo in firmware name drm/i915: Consider SPLL as another shared pll, v2. drm/i915: Fix gpu frequency change tracing drm/vc4: Make sure that planes aren't scaled. drm/vc4: Fix some failure to track __iomem decorations on pointers. drm/vc4: checking for NULL instead of IS_ERR drm/vc4: fix itnull.cocci warnings drm/vc4: fix platform_no_drv_owner.cocci warnings drm/vc4: vc4_plane_duplicate_state() can be static ...
Diffstat (limited to 'drivers/gpu/drm/amd/scheduler/gpu_scheduler.c')
-rw-r--r--drivers/gpu/drm/amd/scheduler/gpu_scheduler.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
index 89619a5a4289..ea30d6ad4c13 100644
--- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
@@ -34,6 +34,9 @@ static struct amd_sched_job *
amd_sched_entity_pop_job(struct amd_sched_entity *entity);
static void amd_sched_wakeup(struct amd_gpu_scheduler *sched);
+struct kmem_cache *sched_fence_slab;
+atomic_t sched_fence_slab_ref = ATOMIC_INIT(0);
+
/* Initialize a given run queue struct */
static void amd_sched_rq_init(struct amd_sched_rq *rq)
{
@@ -273,22 +276,13 @@ static bool amd_sched_entity_in(struct amd_sched_job *sched_job)
*
* Returns 0 for success, negative error code otherwise.
*/
-int amd_sched_entity_push_job(struct amd_sched_job *sched_job)
+void amd_sched_entity_push_job(struct amd_sched_job *sched_job)
{
struct amd_sched_entity *entity = sched_job->s_entity;
- struct amd_sched_fence *fence = amd_sched_fence_create(
- entity, sched_job->owner);
-
- if (!fence)
- return -ENOMEM;
-
- fence_get(&fence->base);
- sched_job->s_fence = fence;
wait_event(entity->sched->job_scheduled,
amd_sched_entity_in(sched_job));
trace_amd_sched_job(sched_job);
- return 0;
}
/**
@@ -343,6 +337,7 @@ static void amd_sched_process_job(struct fence *f, struct fence_cb *cb)
list_del_init(&s_fence->list);
spin_unlock_irqrestore(&sched->fence_list_lock, flags);
}
+ trace_amd_sched_process_job(s_fence);
fence_put(&s_fence->base);
wake_up_interruptible(&sched->wake_up_worker);
}
@@ -450,6 +445,13 @@ int amd_sched_init(struct amd_gpu_scheduler *sched,
init_waitqueue_head(&sched->wake_up_worker);
init_waitqueue_head(&sched->job_scheduled);
atomic_set(&sched->hw_rq_count, 0);
+ if (atomic_inc_return(&sched_fence_slab_ref) == 1) {
+ sched_fence_slab = kmem_cache_create(
+ "amd_sched_fence", sizeof(struct amd_sched_fence), 0,
+ SLAB_HWCACHE_ALIGN, NULL);
+ if (!sched_fence_slab)
+ return -ENOMEM;
+ }
/* Each scheduler will run on a seperate kernel thread */
sched->thread = kthread_run(amd_sched_main, sched, sched->name);
@@ -470,4 +472,6 @@ void amd_sched_fini(struct amd_gpu_scheduler *sched)
{
if (sched->thread)
kthread_stop(sched->thread);
+ if (atomic_dec_and_test(&sched_fence_slab_ref))
+ kmem_cache_destroy(sched_fence_slab);
}