diff --git a/drivers/gpu/nvgpu/common/linux/sched.c b/drivers/gpu/nvgpu/common/linux/sched.c index e62117902..a7da020ce 100644 --- a/drivers/gpu/nvgpu/common/linux/sched.c +++ b/drivers/gpu/nvgpu/common/linux/sched.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "gk20a/gk20a.h" #include "gk20a/gr_gk20a.h" @@ -190,6 +191,8 @@ static int gk20a_sched_dev_ioctl_get_params(struct gk20a_sched_ctrl *sched, if (tsgid >= f->num_channels) return -EINVAL; + nvgpu_speculation_barrier(); + tsg = &f->tsg[tsgid]; if (!nvgpu_ref_get_unless_zero(&tsg->refcount)) return -ENXIO; @@ -223,6 +226,8 @@ static int gk20a_sched_dev_ioctl_tsg_set_timeslice( if (tsgid >= f->num_channels) return -EINVAL; + nvgpu_speculation_barrier(); + tsg = &f->tsg[tsgid]; if (!nvgpu_ref_get_unless_zero(&tsg->refcount)) return -ENXIO; @@ -256,6 +261,8 @@ static int gk20a_sched_dev_ioctl_tsg_set_runlist_interleave( if (tsgid >= f->num_channels) return -EINVAL; + nvgpu_speculation_barrier(); + tsg = &f->tsg[tsgid]; if (!nvgpu_ref_get_unless_zero(&tsg->refcount)) return -ENXIO; @@ -316,6 +323,8 @@ static int gk20a_sched_dev_ioctl_get_tsg(struct gk20a_sched_ctrl *sched, if (tsgid >= f->num_channels) return -EINVAL; + nvgpu_speculation_barrier(); + tsg = &f->tsg[tsgid]; if (!nvgpu_ref_get_unless_zero(&tsg->refcount)) return -ENXIO; @@ -351,6 +360,8 @@ static int gk20a_sched_dev_ioctl_put_tsg(struct gk20a_sched_ctrl *sched, if (tsgid >= f->num_channels) return -EINVAL; + nvgpu_speculation_barrier(); + nvgpu_mutex_acquire(&sched->status_lock); if (!NVGPU_SCHED_ISSET(tsgid, sched->ref_tsg_bitmap)) { nvgpu_mutex_release(&sched->status_lock);