diff --git a/drivers/gpu/nvgpu/common/linux/os_sched.c b/drivers/gpu/nvgpu/common/linux/os_sched.c index ddaaad0f3..586b35ebe 100644 --- a/drivers/gpu/nvgpu/common/linux/os_sched.c +++ b/drivers/gpu/nvgpu/common/linux/os_sched.c @@ -15,6 +15,11 @@ #include +int nvgpu_current_tid(struct gk20a *g) +{ + return current->pid; +} + int nvgpu_current_pid(struct gk20a *g) { return current->tgid; diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 07ae5a167..f4a49a4b8 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -44,6 +44,7 @@ #include #include #include +#include #include "gk20a.h" #include "dbg_gpu_gk20a.h" @@ -726,8 +727,8 @@ struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g, /* now the channel is in a limbo out of the free list but not marked as * alive and used (i.e. get-able) yet */ - ch->pid = current->pid; - ch->tgid = current->tgid; /* process granularity for FECS traces */ + ch->pid = nvgpu_current_tid(g); + ch->tgid = nvgpu_current_pid(g); /* process granularity for FECS traces */ /* By default, channel is regular (non-TSG) channel */ ch->tsgid = NVGPU_INVALID_TSG_ID; diff --git a/drivers/gpu/nvgpu/include/nvgpu/os_sched.h b/drivers/gpu/nvgpu/include/nvgpu/os_sched.h index 61cee4ad6..97dc9a570 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/os_sched.h +++ b/drivers/gpu/nvgpu/include/nvgpu/os_sched.h @@ -25,6 +25,12 @@ struct gk20a; +/** + * nvgpu_current_tid - Query the id of current thread + * + */ +int nvgpu_current_tid(struct gk20a *g); + /** * nvgpu_current_pid - Query the id of current process *