mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 02:22:34 +03:00
gpu: nvgpu: move gpfifo submit wait to userspace
Instead of blocking for gpfifo space in the nvgpu driver, return -EAGAIN and allow userspace to decide the blocking policy. Bug 1795076 Change-Id: Ie091caa92aad3f68bc01a3456ad948e76883bc50 Signed-off-by: Aingara Paramakuru <aparamakuru@nvidia.com> Reviewed-on: http://git-master/r/1202591 (cherry picked from commit 8056f422c6a34a4239fc4993c40c2e517c932714) Reviewed-on: http://git-master/r/1203800 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
b700d3a040
commit
3366506072
@@ -1194,7 +1194,6 @@ struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g,
|
|||||||
|
|
||||||
init_waitqueue_head(&ch->notifier_wq);
|
init_waitqueue_head(&ch->notifier_wq);
|
||||||
init_waitqueue_head(&ch->semaphore_wq);
|
init_waitqueue_head(&ch->semaphore_wq);
|
||||||
init_waitqueue_head(&ch->submit_wq);
|
|
||||||
|
|
||||||
ch->update_fn = NULL;
|
ch->update_fn = NULL;
|
||||||
ch->update_fn_data = NULL;
|
ch->update_fn_data = NULL;
|
||||||
@@ -1974,9 +1973,6 @@ void gk20a_channel_update(struct channel_gk20a *c, int nr_completed)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_gp_get(c->g, c);
|
|
||||||
wake_up(&c->submit_wq);
|
|
||||||
|
|
||||||
trace_gk20a_channel_update(c->hw_chid);
|
trace_gk20a_channel_update(c->hw_chid);
|
||||||
gk20a_channel_schedule_job_clean_up(c);
|
gk20a_channel_schedule_job_clean_up(c);
|
||||||
|
|
||||||
@@ -2181,22 +2177,16 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
|
|||||||
gk20a_dbg_info("pre-submit put %d, get %d, size %d",
|
gk20a_dbg_info("pre-submit put %d, get %d, size %d",
|
||||||
c->gpfifo.put, c->gpfifo.get, c->gpfifo.entry_num);
|
c->gpfifo.put, c->gpfifo.get, c->gpfifo.entry_num);
|
||||||
|
|
||||||
/* Make sure we have enough space for gpfifo entries. If not,
|
/*
|
||||||
* wait for signals from completed submits */
|
* Make sure we have enough space for gpfifo entries. Check cached
|
||||||
|
* values first and then read from HW. If no space, return EAGAIN
|
||||||
|
* and let userpace decide to re-try request or not.
|
||||||
|
*/
|
||||||
if (gp_free_count(c) < num_entries + extra_entries) {
|
if (gp_free_count(c) < num_entries + extra_entries) {
|
||||||
/* we can get here via locked ioctl and other paths too */
|
if (get_gp_free_count(c) < num_entries + extra_entries) {
|
||||||
int locked_path = mutex_is_locked(&c->ioctl_lock);
|
err = -EAGAIN;
|
||||||
if (locked_path)
|
goto clean_up;
|
||||||
mutex_unlock(&c->ioctl_lock);
|
}
|
||||||
|
|
||||||
trace_gk20a_gpfifo_submit_wait_for_space(dev_name(c->g->dev));
|
|
||||||
err = wait_event_interruptible(c->submit_wq,
|
|
||||||
get_gp_free_count(c) >= num_entries + extra_entries ||
|
|
||||||
c->has_timedout);
|
|
||||||
trace_gk20a_gpfifo_submit_wait_for_space_done(dev_name(c->g->dev));
|
|
||||||
|
|
||||||
if (locked_path)
|
|
||||||
mutex_lock(&c->ioctl_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->has_timedout) {
|
if (c->has_timedout) {
|
||||||
@@ -2204,10 +2194,6 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
|
|||||||
goto clean_up;
|
goto clean_up;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err) {
|
|
||||||
err = -ENOSPC;
|
|
||||||
goto clean_up;
|
|
||||||
}
|
|
||||||
|
|
||||||
mutex_lock(&c->sync_lock);
|
mutex_lock(&c->sync_lock);
|
||||||
if (!c->sync) {
|
if (!c->sync) {
|
||||||
|
|||||||
@@ -145,7 +145,6 @@ struct channel_gk20a {
|
|||||||
|
|
||||||
wait_queue_head_t notifier_wq;
|
wait_queue_head_t notifier_wq;
|
||||||
wait_queue_head_t semaphore_wq;
|
wait_queue_head_t semaphore_wq;
|
||||||
wait_queue_head_t submit_wq;
|
|
||||||
|
|
||||||
u32 timeout_accumulated_ms;
|
u32 timeout_accumulated_ms;
|
||||||
u32 timeout_gpfifo_get;
|
u32 timeout_gpfifo_get;
|
||||||
|
|||||||
@@ -1210,7 +1210,6 @@ static bool gk20a_fifo_set_ctx_mmu_error(struct gk20a *g,
|
|||||||
/* unblock pending waits */
|
/* unblock pending waits */
|
||||||
wake_up(&ch->semaphore_wq);
|
wake_up(&ch->semaphore_wq);
|
||||||
wake_up(&ch->notifier_wq);
|
wake_up(&ch->notifier_wq);
|
||||||
wake_up(&ch->submit_wq);
|
|
||||||
return verbose;
|
return verbose;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -694,7 +694,6 @@ static void vgpu_fifo_set_ctx_mmu_error(struct gk20a *g,
|
|||||||
/* unblock pending waits */
|
/* unblock pending waits */
|
||||||
wake_up(&ch->semaphore_wq);
|
wake_up(&ch->semaphore_wq);
|
||||||
wake_up(&ch->notifier_wq);
|
wake_up(&ch->notifier_wq);
|
||||||
wake_up(&ch->submit_wq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int vgpu_fifo_isr(struct gk20a *g, struct tegra_vgpu_fifo_intr_info *info)
|
int vgpu_fifo_isr(struct gk20a *g, struct tegra_vgpu_fifo_intr_info *info)
|
||||||
|
|||||||
@@ -55,16 +55,6 @@ DEFINE_EVENT(gk20a, gk20a_finalize_poweron_done,
|
|||||||
TP_ARGS(name)
|
TP_ARGS(name)
|
||||||
);
|
);
|
||||||
|
|
||||||
DEFINE_EVENT(gk20a, gk20a_gpfifo_submit_wait_for_space,
|
|
||||||
TP_PROTO(const char *name),
|
|
||||||
TP_ARGS(name)
|
|
||||||
);
|
|
||||||
|
|
||||||
DEFINE_EVENT(gk20a, gk20a_gpfifo_submit_wait_for_space_done,
|
|
||||||
TP_PROTO(const char *name),
|
|
||||||
TP_ARGS(name)
|
|
||||||
);
|
|
||||||
|
|
||||||
DEFINE_EVENT(gk20a, gk20a_mm_l2_invalidate,
|
DEFINE_EVENT(gk20a, gk20a_mm_l2_invalidate,
|
||||||
TP_PROTO(const char *name),
|
TP_PROTO(const char *name),
|
||||||
TP_ARGS(name)
|
TP_ARGS(name)
|
||||||
|
|||||||
Reference in New Issue
Block a user